private void DoToolkit() { EditorUtilities.DrawSplitter(); m_ShowToolkit.boolValue = EditorUtilities.DrawHeader("Toolkit", m_ShowToolkit.boolValue); if (m_ShowToolkit.boolValue) { GUILayout.Space(2); if (GUILayout.Button(EditorUtilities.GetContent("Export frame to EXR..."), EditorStyles.miniButton)) { var menu = new GenericMenu(); menu.AddItem(EditorUtilities.GetContent("Full Frame (as displayed)"), false, () => ExportFrameToExr(ExportMode.FullFrame)); menu.AddItem(EditorUtilities.GetContent("Disable post-processing"), false, () => ExportFrameToExr(ExportMode.DisablePost)); menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Linear)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLinear)); menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Log)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLog)); menu.ShowAsContext(); } if (GUILayout.Button( EditorUtilities.GetContent( "Select all layer volumes|Selects all the volumes that will influence this layer."), EditorStyles.miniButton)) { var volumes = RuntimeUtilities.GetAllSceneObjects <PostProcessVolume>() .Where(x => (m_VolumeLayer.intValue & (1 << x.gameObject.layer)) != 0) .Select(x => x.gameObject) .Cast <Object>() .ToArray(); if (volumes.Length > 0) { Selection.objects = volumes; } } if (GUILayout.Button( EditorUtilities.GetContent( "Select all active volumes|Selects all volumes currently affecting the layer."), EditorStyles.miniButton)) { var volumes = new List <PostProcessVolume>(); PostProcessManager.instance.GetActiveVolumes(m_Target, volumes); if (volumes.Count > 0) { Selection.objects = volumes .Select(x => x.gameObject) .Cast <Object>() .ToArray(); } } GUILayout.Space(3); } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.LabelField(EditorUtilities.GetContent("Volume blending"), EditorStyles.boldLabel); EditorGUI.indentLevel++; { // The layout system sort of break alignement when mixing inspector fields with // custom layouted fields, do the layout manually instead var indentOffset = EditorGUI.indentLevel * 15f; var lineRect = GUILayoutUtility.GetRect(1, EditorGUIUtility.singleLineHeight); var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height); var fieldRect = new Rect(labelRect.xMax, lineRect.y, lineRect.width - labelRect.width - 60f, lineRect.height); var buttonRect = new Rect(fieldRect.xMax, lineRect.y, 60f, lineRect.height); EditorGUI.PrefixLabel(labelRect, EditorUtilities.GetContent("Trigger|A transform that will act as a trigger for volume blending.")); m_VolumeTrigger.objectReferenceValue = (Transform)EditorGUI.ObjectField(fieldRect, m_VolumeTrigger.objectReferenceValue, typeof(Transform), false); if (GUI.Button(buttonRect, EditorUtilities.GetContent("This|Assigns the current GameObject as a trigger."), EditorStyles.miniButton)) { m_VolumeTrigger.objectReferenceValue = m_Target.transform; } if (m_VolumeTrigger.objectReferenceValue == null) { EditorGUILayout.HelpBox("No trigger has been set, the camera will only be affected by global volumes.", MessageType.Info); } EditorGUILayout.PropertyField(m_VolumeLayer, EditorUtilities.GetContent("Layer|This camera will only be affected by volumes in the selected scene-layers.")); int mask = m_VolumeLayer.intValue; if (mask == 0) { EditorGUILayout.HelpBox("No layer has been set, the trigger will never be affected by volumes.", MessageType.Warning); } else if (mask == -1 || ((mask & 1) != 0)) { EditorGUILayout.HelpBox("Do not use \"Everything\" or \"Default\" as a layer mask as it will slow down the volume blending process! Put post-processing volumes in their own dedicated layer for best performances.", MessageType.Warning); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorUtilities.GetContent("Anti-aliasing"), EditorStyles.boldLabel); EditorGUI.indentLevel++; { m_AntialiasingMode.intValue = EditorGUILayout.Popup(EditorUtilities.GetContent("Mode|The anti-aliasing method to use. FXAA is fast but low quality. SMAA works well for non-HDR scenes. TAA is a bit slower but higher quality and works well with HDR."), m_AntialiasingMode.intValue, s_AntialiasingMethodNames); if (m_AntialiasingMode.intValue == (int)PostProcessLayer.Antialiasing.TemporalAntialiasing) { if (RuntimeUtilities.isSinglePassStereoEnabled) { EditorGUILayout.HelpBox("TAA doesn't work with Single-pass stereo rendering.", MessageType.Warning); } EditorGUILayout.PropertyField(m_TaaJitterSpread); EditorGUILayout.PropertyField(m_TaaStationaryBlending); EditorGUILayout.PropertyField(m_TaaMotionBlending); EditorGUILayout.PropertyField(m_TaaSharpen); } else if (m_AntialiasingMode.intValue == (int)PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing) { if (RuntimeUtilities.isSinglePassStereoEnabled) { EditorGUILayout.HelpBox("SMAA doesn't work with Single-pass stereo rendering.", MessageType.Warning); } } else if (m_AntialiasingMode.intValue == (int)PostProcessLayer.Antialiasing.FastApproximateAntialiasing) { EditorGUILayout.PropertyField(m_FxaaMobileOptimized); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorUtilities.GetContent("Debug Layer"), EditorStyles.boldLabel); EditorGUI.indentLevel++; { EditorGUILayout.PropertyField(m_DebugDisplay, EditorUtilities.GetContent("Display|Toggle visibility of the debug layer on & off in the Game View.")); if (m_DebugDisplay.boolValue) { if (!SystemInfo.supportsComputeShaders) { EditorGUILayout.HelpBox("The debug layer only works on compute-shader enabled platforms.", MessageType.Info); } EditorGUILayout.PropertyField(m_DebugMonitor, EditorUtilities.GetContent("Monitor|The real-time monitor to display on the debug layer.")); EditorGUILayout.PropertyField(m_DebugLightMeter, EditorUtilities.GetContent("HDR Light Meter|Light metering utility used to setup auto exposure. Note that it will only display correct values when using a full-HDR workflow (HDR camera, HDR/Custom color grading).")); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); // Toolkit EditorUtilities.DrawSplitter(); GlobalSettings.showLayerToolkit = EditorUtilities.DrawHeader("Toolkit", GlobalSettings.showLayerToolkit); if (GlobalSettings.showLayerToolkit) { EditorGUILayout.Space(); if (GUILayout.Button(EditorUtilities.GetContent("Export frame to EXR..."), EditorStyles.miniButton)) { var menu = new GenericMenu(); menu.AddItem(EditorUtilities.GetContent("Full Frame (as displayed)"), false, () => ExportFrameToExr(ExportMode.FullFrame)); menu.AddItem(EditorUtilities.GetContent("Disable post-processing"), false, () => ExportFrameToExr(ExportMode.DisablePost)); menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Linear)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLinear)); menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Log)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLog)); menu.ShowAsContext(); } if (GUILayout.Button(EditorUtilities.GetContent("Select all layer volumes|Selects all the volumes that will influence this layer."), EditorStyles.miniButton)) { var volumes = RuntimeUtilities.GetAllSceneObjects <PostProcessVolume>() .Where(x => (m_VolumeLayer.intValue & (1 << x.gameObject.layer)) != 0) .Select(x => x.gameObject) .Cast <UnityEngine.Object>() .ToArray(); if (volumes.Length > 0) { Selection.objects = volumes; } } if (GUILayout.Button(EditorUtilities.GetContent("Select all active volumes|Selects all volumes currently affecting the layer."), EditorStyles.miniButton)) { var volumes = new List <PostProcessVolume>(); PostProcessManager.instance.GetActiveVolumes(m_Target, volumes); if (volumes.Count > 0) { Selection.objects = volumes .Select(x => x.gameObject) .Cast <UnityEngine.Object>() .ToArray(); } } EditorGUILayout.Space(); } // Custom user effects sorter EditorUtilities.DrawSplitter(); GlobalSettings.showCustomSorter = EditorUtilities.DrawHeader("Custom Effect Sorting", GlobalSettings.showCustomSorter); if (GlobalSettings.showCustomSorter) { EditorGUILayout.Space(); bool anyList = false; if (m_CustomLists != null) { foreach (var kvp in m_CustomLists) { var list = kvp.Value; // Skip empty lists to avoid polluting the inspector if (list.count == 0) { continue; } list.DoLayoutList(); anyList = true; } } if (!anyList) { EditorGUILayout.HelpBox("No custom effect loaded.", MessageType.Info); EditorGUILayout.Space(); } } EditorUtilities.DrawSplitter(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }