From 5914d5c7e06a7e460685b679c1248fe18605031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 21 Sep 2021 12:07:52 +0200 Subject: [PATCH 1/8] SRP Workflows - Improve working with volumes on XPipeline projects --- .../Editor/Volume/VolumeComponentEditor.cs | 27 ++++++++++- .../Volume/VolumeComponentListEditor.cs | 24 +++++++++- .../Runtime/Volume/VolumeComponent.cs | 13 +++++- .../Runtime/Volume/VolumeProfile.cs | 45 +++++++++++++++++++ .../VolumeComponentWithQualityEditor.cs | 9 ++-- 5 files changed, 108 insertions(+), 10 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs index 42c2bee8539..8429e24a28b 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs @@ -150,6 +150,27 @@ public bool showAdditionalProperties } } + EditorPrefBool m_ShowOnlyOverridedParameters; + internal void SetShowOnlyOverridedParameters(bool value) + { + m_ShowOnlyOverridedParameters.value = value; + } + + internal void InitShowOnlyOverridedParametersPreference() + { + string key = $"UI_Show_Only_Overrided_Parameters_{GetType()}"; + m_ShowOnlyOverridedParameters = new EditorPrefBool(key); + } + + /// + /// Set to true to show only the parameters that are overrided + /// + public bool showOnlyOverridedParameters + { + get => m_ShowOnlyOverridedParameters.value; + set => SetShowOnlyOverridedParameters(value); + } + /// /// Start a scope for additional properties. /// This will handle the highlight of the background when toggled on and off. @@ -247,9 +268,10 @@ internal void Init(VolumeComponent target, Editor inspector) this.target = target; m_Inspector = inspector; serializedObject = new SerializedObject(target); - activeProperty = serializedObject.FindProperty("active"); + activeProperty = serializedObject.FindProperty("m_Active"); InitAdditionalPropertiesPreference(); + InitShowOnlyOverridedParametersPreference(); m_AdditionalPropertiesAnimation = new AnimFloat(0, Repaint) { @@ -557,6 +579,9 @@ protected bool PropertyField(SerializedDataParameter property, GUIContent title) /// A custom label and/or tooltip. private bool DrawPropertyField(SerializedDataParameter property, GUIContent title) { + if (!property.overrideState.boolValue && showOnlyOverridedParameters) + return false; + using (var scope = new OverridablePropertyScope(property, title, this)) { if (!scope.displayed) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index 209aee6e6b5..44d80be29ab 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -45,6 +45,12 @@ namespace UnityEditor.Rendering /// public sealed class VolumeComponentListEditor { + class Styles + { + public static readonly string noSRPInUse = L10n.Tr("No SRP in Use"); + public static readonly string unsuportedFeature = L10n.Tr("This feature is not supported by the current active render pipeline"); + } + /// /// A direct reference to the this editor displays. /// @@ -89,6 +95,9 @@ public void Init(VolumeProfile asset, SerializedObject serializedObject) Assert.IsNotNull(asset); Assert.IsNotNull(serializedObject); + // Make sure that the volumes are being updated + asset.UpdateIsSupportedOnCurrentPipeline(); + this.asset = asset; m_SerializedObject = serializedObject; m_ComponentsProperty = serializedObject.Find((VolumeProfile x) => x.components); @@ -210,6 +219,13 @@ public void OnGUI() if (asset == null) return; + var currentPipeline = RenderPipelineManager.currentPipeline; + if (currentPipeline == null) + { + EditorGUILayout.HelpBox(Styles.noSRPInUse, MessageType.Info, true); + return; + } + // Even if the asset is not dirty, the list of component may have been changed by another inspector. // In this case, only the hash will tell us that we need to refresh. if (asset.isDirty || asset.GetComponentListHashCode() != m_CurrentHashCode) @@ -246,7 +262,10 @@ public void OnGUI() if (displayContent) { - using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue)) + if (!editor.target.supportedOnCurrentPipeline) + EditorGUILayout.HelpBox(Styles.unsuportedFeature, MessageType.Warning, true); + + using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline)) editor.OnInternalInspectorGUI(); } } @@ -308,7 +327,8 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), targetEditor.showAdditionalProperties, () => targetEditor.showAdditionalProperties ^= true); else menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Show Additional Properties")); - menu.AddItem(EditorGUIUtility.TrTextContent("Show All Additional Properties..."), false, () => CoreRenderPipelinePreferences.Open()); + menu.AddItem(EditorGUIUtility.TrTextContent("Show Only overrided parameters"), targetEditor.showOnlyOverridedParameters, () => targetEditor.showOnlyOverridedParameters = !targetEditor.showOnlyOverridedParameters); + menu.AddItem(EditorGUIUtility.TrTextContent("Open Core Render Pipeline Preferences..."), false, () => CoreRenderPipelinePreferences.Open()); menu.AddSeparator(string.Empty); menu.AddItem(EditorGUIUtility.TrTextContent("Copy Settings"), false, () => CopySettings(targetComponent)); diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs index adf1a8eeae3..f36f32dc4bf 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs @@ -3,6 +3,7 @@ using System.Collections.ObjectModel; using System.Reflection; using System.Linq; +using UnityEngine.Serialization; namespace UnityEngine.Rendering { @@ -109,11 +110,21 @@ public Indent(int relativeAmount = 1) => this.relativeAmount = relativeAmount; } + [SerializeField] + [FormerlySerializedAs("active")] + private bool m_Active = true; + + internal bool supportedOnCurrentPipeline { get; set; } = true; + /// /// The active state of the set of parameters defined in this class. You can use this to /// quickly turn on or off all the overrides at once. /// - public bool active = true; + public bool active + { + get => m_Active && supportedOnCurrentPipeline; + set => m_Active = value; + } /// /// The name displayed in the component header. If you do not set a name, Unity generates one from diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs index 30ec7ce4e28..484a9b23b73 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Reflection; using UnityEngine.Assertions; namespace UnityEngine.Rendering @@ -30,6 +32,40 @@ void OnEnable() // harmless and happens because Unity does a redraw of the editor (and thus the current // frame) before the recompilation step. components.RemoveAll(x => x == null); + + // Subscribe to the changes performed on the current pipeline to know which Volume Components are supported on the current pipeline + RenderPipelineManager.activeRenderPipelineTypeChanged += UpdateIsSupportedOnCurrentPipeline; + UpdateIsSupportedOnCurrentPipeline(); + } + + private void OnDisable() + { + RenderPipelineManager.activeRenderPipelineTypeChanged -= UpdateIsSupportedOnCurrentPipeline; + } + + internal void UpdateIsSupportedOnCurrentPipeline() + { + var currentPipeline = RenderPipelineManager.currentPipeline; + if (currentPipeline != null) + { + var currentPipelineType = currentPipeline.GetType(); + foreach (var component in components) + { + SetIsSupportedOnCurrentPipeline(component, currentPipelineType); + } + } + } + + void SetIsSupportedOnCurrentPipeline(VolumeComponent component, Type currentPipelineType) + { + bool supportedOnCurrentPipeline = true; + + // Get the supported pipelines for the volume component + if (component.GetType().GetCustomAttribute(typeof(VolumeComponentMenuForRenderPipeline), false) is VolumeComponentMenuForRenderPipeline supportedOn) + { + supportedOnCurrentPipeline = supportedOn.pipelineTypes.Contains(currentPipelineType); + } + component.supportedOnCurrentPipeline = supportedOnCurrentPipeline; } /// @@ -80,7 +116,16 @@ public VolumeComponent Add(Type type, bool overrides = false) component.name = type.Name; #endif component.SetAllOverridesTo(overrides); + + var currentPipeline = RenderPipelineManager.currentPipeline; + if (currentPipeline != null) + { + var currentPipelineType = currentPipeline.GetType(); + SetIsSupportedOnCurrentPipeline(component, currentPipeline.GetType()); + } + components.Add(component); + isDirty = true; return component; } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeComponentWithQualityEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeComponentWithQualityEditor.cs index b908537351e..3ff496a5f0d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeComponentWithQualityEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeComponentWithQualityEditor.cs @@ -169,8 +169,7 @@ public override void OnInspectorGUI() // If we have switched to custom quality from a preset, then load the last custom quality settings the user has used in this volume if (prevQualityLevel != k_CustomQuality) { - QualitySettingsBlob history = null; - s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out history); + s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out QualitySettingsBlob history); if (history != null) { LoadSettingsFromObject(history); @@ -180,14 +179,12 @@ public override void OnInspectorGUI() else { // If we are going to use a quality preset, then load the preset values so they are reflected in the UI - var pipeline = (HDRenderPipeline)RenderPipelineManager.currentPipeline; - if (pipeline != null) + if (RenderPipelineManager.currentPipeline is HDRenderPipeline pipeline) { // If we switch from a custom quality level, then save these values so we can re-use them if teh user switches back if (prevQualityLevel == k_CustomQuality) { - QualitySettingsBlob history = null; - s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out history); + s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out QualitySettingsBlob history); if (history != null) { SaveCustomQualitySettingsAsObject(history); From 49ede2ad5e73c446c096c6d24ebc0ccb2d3037f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 21 Sep 2021 12:17:21 +0200 Subject: [PATCH 2/8] Changelog --- com.unity.render-pipelines.core/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/CHANGELOG.md b/com.unity.render-pipelines.core/CHANGELOG.md index d045ee7c356..e5fa5b1ddcf 100644 --- a/com.unity.render-pipelines.core/CHANGELOG.md +++ b/com.unity.render-pipelines.core/CHANGELOG.md @@ -22,11 +22,13 @@ The version number for this package has increased due to a version update of a r ### Added - New `IVolumeDebugSettings` interface and `VolumeDebugSettings` class that stores the information for the Volumes Debug Panel. - Added AMD FidelityFX shaders which were originally in HDRP -- Added support for high performant unsafe (uint only) Radix, Merge and Insertion sort algorithms on CoreUnsafeUtils. +- Added warning on Volumes not supported by the current pipeline. +- Added option to hide not overrided properties on Volume Components. ### Fixed - Fixed black pixel issue in AMD FidelityFX RCAS implementation - Fixed a critical issue on android devices & lens flares. Accidentally creating a 16 bit texture was causing gpus not supporting them to fail. +- Fixed the processing of volumes that are not supported to the current pipeline. ## [12.0.0] - 2021-01-11 From 8e26fd8b0b18df0c69baf77d0c78acb3e4287c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 21 Sep 2021 14:22:56 +0200 Subject: [PATCH 3/8] Fixes from UX --- .../Editor/Volume/VolumeComponentListEditor.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index 44d80be29ab..d9c73fe6624 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -263,10 +263,14 @@ public void OnGUI() if (displayContent) { if (!editor.target.supportedOnCurrentPipeline) + { EditorGUILayout.HelpBox(Styles.unsuportedFeature, MessageType.Warning, true); - - using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline)) - editor.OnInternalInspectorGUI(); + } + else + { + using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline)) + editor.OnInternalInspectorGUI(); + } } } @@ -327,7 +331,7 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), targetEditor.showAdditionalProperties, () => targetEditor.showAdditionalProperties ^= true); else menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Show Additional Properties")); - menu.AddItem(EditorGUIUtility.TrTextContent("Show Only overrided parameters"), targetEditor.showOnlyOverridedParameters, () => targetEditor.showOnlyOverridedParameters = !targetEditor.showOnlyOverridedParameters); + menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overrided Parameters"), targetEditor.showOnlyOverridedParameters, () => targetEditor.showOnlyOverridedParameters = !targetEditor.showOnlyOverridedParameters); menu.AddItem(EditorGUIUtility.TrTextContent("Open Core Render Pipeline Preferences..."), false, () => CoreRenderPipelinePreferences.Open()); menu.AddSeparator(string.Empty); From 22712f0ac2a441d34cd60bfad030029f1c167159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 22 Sep 2021 11:53:00 +0200 Subject: [PATCH 4/8] Suggestion from UX --- .../Editor/Volume/VolumeComponentEditor.cs | 26 ++++++++++++++----- .../Volume/VolumeComponentListEditor.cs | 19 ++------------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs index 8429e24a28b..23138f202c4 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs @@ -78,11 +78,12 @@ public class VolumeComponentEditor { class Styles { - public static GUIContent overrideSettingText { get; } = EditorGUIUtility.TrTextContent("", "Override this setting for this volume."); - public static GUIContent allText { get; } = EditorGUIUtility.TrTextContent("ALL", "Toggle all overrides on. To maximize performances you should only toggle overrides that you actually need."); - public static GUIContent noneText { get; } = EditorGUIUtility.TrTextContent("NONE", "Toggle all overrides off."); + public readonly static GUIContent overrideSettingText = EditorGUIUtility.TrTextContent("", "Override this setting for this volume."); + public readonly static GUIContent allText = EditorGUIUtility.TrTextContent("ALL", "Toggle all overrides on. To maximize performances you should only toggle overrides that you actually need."); + public readonly static GUIContent noneText = EditorGUIUtility.TrTextContent("NONE", "Toggle all overrides off."); - public static string toggleAllText { get; } = L10n.Tr("Toggle All"); + public static readonly string toggleAllText = L10n.Tr("Toggle All"); + public static readonly string unsuportedFeature = L10n.Tr("This feature is not supported by the current active render pipeline"); public const int overrideCheckboxWidth = 14; public const int overrideCheckboxOffset = 9; @@ -359,8 +360,18 @@ internal void OnInternalInspectorGUI() serializedObject.Update(); using (new EditorGUILayout.VerticalScope()) { - TopRowFields(); - OnInspectorGUI(); + if (!target.supportedOnCurrentPipeline) + { + EditorGUILayout.HelpBox(Styles.unsuportedFeature, MessageType.Warning, true); + } + else + { + TopRowFields(); + } + + using (new EditorGUI.DisabledScope(!target.supportedOnCurrentPipeline)) + OnInspectorGUI(); + EditorGUILayout.Space(); } serializedObject.ApplyModifiedProperties(); @@ -653,6 +664,9 @@ private bool DrawEmbeddedField(SerializedDataParameter property, GUIContent titl /// The property to draw the override checkbox for protected void DrawOverrideCheckbox(SerializedDataParameter property) { + if (!target.supportedOnCurrentPipeline) + return; + // Create a rect the height + vspacing of the property that is being overriden float height = EditorGUI.GetPropertyHeight(property.value) + EditorGUIUtility.standardVerticalSpacing; var overrideRect = GUILayoutUtility.GetRect(Styles.allText, CoreEditorStyles.miniLabelButton, GUILayout.Height(height), GUILayout.Width(Styles.overrideCheckboxWidth + Styles.overrideCheckboxOffset), GUILayout.ExpandWidth(false)); diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index d9c73fe6624..90cf4f83015 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -48,7 +48,6 @@ public sealed class VolumeComponentListEditor class Styles { public static readonly string noSRPInUse = L10n.Tr("No SRP in Use"); - public static readonly string unsuportedFeature = L10n.Tr("This feature is not supported by the current active render pipeline"); } /// @@ -219,13 +218,6 @@ public void OnGUI() if (asset == null) return; - var currentPipeline = RenderPipelineManager.currentPipeline; - if (currentPipeline == null) - { - EditorGUILayout.HelpBox(Styles.noSRPInUse, MessageType.Info, true); - return; - } - // Even if the asset is not dirty, the list of component may have been changed by another inspector. // In this case, only the hash will tell us that we need to refresh. if (asset.isDirty || asset.GetComponentListHashCode() != m_CurrentHashCode) @@ -262,15 +254,8 @@ public void OnGUI() if (displayContent) { - if (!editor.target.supportedOnCurrentPipeline) - { - EditorGUILayout.HelpBox(Styles.unsuportedFeature, MessageType.Warning, true); - } - else - { - using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline)) - editor.OnInternalInspectorGUI(); - } + using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline)) + editor.OnInternalInspectorGUI(); } } From 26d127108cf22a23a51a1d298af1149f42a756ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 28 Sep 2021 12:16:00 +0200 Subject: [PATCH 5/8] Comments from code review --- .../Runtime/Volume/VolumeProfile.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs index 484a9b23b73..3946f7b4646 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs @@ -51,19 +51,19 @@ internal void UpdateIsSupportedOnCurrentPipeline() var currentPipelineType = currentPipeline.GetType(); foreach (var component in components) { - SetIsSupportedOnCurrentPipeline(component, currentPipelineType); + SetIsSupportedOnPipeline(component, currentPipelineType); } } } - void SetIsSupportedOnCurrentPipeline(VolumeComponent component, Type currentPipelineType) + void SetIsSupportedOnPipeline(VolumeComponent component, Type renderPipelineType) { bool supportedOnCurrentPipeline = true; // Get the supported pipelines for the volume component if (component.GetType().GetCustomAttribute(typeof(VolumeComponentMenuForRenderPipeline), false) is VolumeComponentMenuForRenderPipeline supportedOn) { - supportedOnCurrentPipeline = supportedOn.pipelineTypes.Contains(currentPipelineType); + supportedOnCurrentPipeline = supportedOn.pipelineTypes.Contains(renderPipelineType); } component.supportedOnCurrentPipeline = supportedOnCurrentPipeline; } @@ -121,7 +121,7 @@ public VolumeComponent Add(Type type, bool overrides = false) if (currentPipeline != null) { var currentPipelineType = currentPipeline.GetType(); - SetIsSupportedOnCurrentPipeline(component, currentPipeline.GetType()); + SetIsSupportedOnPipeline(component, currentPipeline.GetType()); } components.Add(component); From 4d577583ea3a897bc6ad57e2e2257e04bb5c76ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Mon, 18 Oct 2021 16:21:05 +0200 Subject: [PATCH 6/8] Fix overrided to overriden --- .../Editor/Volume/VolumeComponentEditor.cs | 12 ++++++------ .../Editor/Volume/VolumeComponentListEditor.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs index 23138f202c4..4dd87f9a39f 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs @@ -151,24 +151,24 @@ public bool showAdditionalProperties } } - EditorPrefBool m_ShowOnlyOverridedParameters; + EditorPrefBool m_ShowOnlyOverridenParameters; internal void SetShowOnlyOverridedParameters(bool value) { - m_ShowOnlyOverridedParameters.value = value; + m_ShowOnlyOverridenParameters.value = value; } internal void InitShowOnlyOverridedParametersPreference() { string key = $"UI_Show_Only_Overrided_Parameters_{GetType()}"; - m_ShowOnlyOverridedParameters = new EditorPrefBool(key); + m_ShowOnlyOverridenParameters = new EditorPrefBool(key); } /// /// Set to true to show only the parameters that are overrided /// - public bool showOnlyOverridedParameters + public bool showOnlyOverridenParameters { - get => m_ShowOnlyOverridedParameters.value; + get => m_ShowOnlyOverridenParameters.value; set => SetShowOnlyOverridedParameters(value); } @@ -590,7 +590,7 @@ protected bool PropertyField(SerializedDataParameter property, GUIContent title) /// A custom label and/or tooltip. private bool DrawPropertyField(SerializedDataParameter property, GUIContent title) { - if (!property.overrideState.boolValue && showOnlyOverridedParameters) + if (!property.overrideState.boolValue && showOnlyOverridenParameters) return false; using (var scope = new OverridablePropertyScope(property, title, this)) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index 90cf4f83015..a3a5e76b5e2 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -316,7 +316,7 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), targetEditor.showAdditionalProperties, () => targetEditor.showAdditionalProperties ^= true); else menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Show Additional Properties")); - menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overrided Parameters"), targetEditor.showOnlyOverridedParameters, () => targetEditor.showOnlyOverridedParameters = !targetEditor.showOnlyOverridedParameters); + menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overriden Parameters"), targetEditor.showOnlyOverridenParameters, () => targetEditor.showOnlyOverridenParameters = !targetEditor.showOnlyOverridenParameters); menu.AddItem(EditorGUIUtility.TrTextContent("Open Core Render Pipeline Preferences..."), false, () => CoreRenderPipelinePreferences.Open()); menu.AddSeparator(string.Empty); From f8f8747cd4166c29615d20fcd5e44881f69e1c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Mon, 18 Oct 2021 17:12:01 +0200 Subject: [PATCH 7/8] Add warning message to the inspector as the volumes are not availabel --- .../Editor/Volume/VolumeEditor.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs index 2e7e88df9ac..92a4d16ba23 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs @@ -118,6 +118,13 @@ private static void EnableAllOverrides(MenuCommand command) public override void OnInspectorGUI() { + var currentPipeline = RenderPipelineManager.currentPipeline; + if (currentPipeline == null) + { + EditorGUILayout.HelpBox("No SRP in use", MessageType.Warning, true); + return; + } + serializedObject.Update(); Rect lineRect = EditorGUILayout.GetControlRect(); From 01e5a8c94a349dd7376a8f526cc0304cf2d6f03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 19 Oct 2021 11:57:49 +0200 Subject: [PATCH 8/8] Fix --- .../Editor/Volume/VolumeComponentEditor.cs | 14 +++++++------- .../Editor/Volume/VolumeComponentListEditor.cs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs index 4dd87f9a39f..1e227c1977e 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs @@ -151,24 +151,24 @@ public bool showAdditionalProperties } } - EditorPrefBool m_ShowOnlyOverridenParameters; + EditorPrefBool m_ShowOnlyOverriddenParameters; internal void SetShowOnlyOverridedParameters(bool value) { - m_ShowOnlyOverridenParameters.value = value; + m_ShowOnlyOverriddenParameters.value = value; } internal void InitShowOnlyOverridedParametersPreference() { - string key = $"UI_Show_Only_Overrided_Parameters_{GetType()}"; - m_ShowOnlyOverridenParameters = new EditorPrefBool(key); + string key = $"UI_Show_Only_Overridden_Parameters_{GetType()}"; + m_ShowOnlyOverriddenParameters = new EditorPrefBool(key); } /// /// Set to true to show only the parameters that are overrided /// - public bool showOnlyOverridenParameters + public bool showOnlyOverriddenParameters { - get => m_ShowOnlyOverridenParameters.value; + get => m_ShowOnlyOverriddenParameters.value; set => SetShowOnlyOverridedParameters(value); } @@ -590,7 +590,7 @@ protected bool PropertyField(SerializedDataParameter property, GUIContent title) /// A custom label and/or tooltip. private bool DrawPropertyField(SerializedDataParameter property, GUIContent title) { - if (!property.overrideState.boolValue && showOnlyOverridenParameters) + if (!property.overrideState.boolValue && showOnlyOverriddenParameters) return false; using (var scope = new OverridablePropertyScope(property, title, this)) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index a3a5e76b5e2..87a6dfee951 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -316,7 +316,7 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), targetEditor.showAdditionalProperties, () => targetEditor.showAdditionalProperties ^= true); else menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Show Additional Properties")); - menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overriden Parameters"), targetEditor.showOnlyOverridenParameters, () => targetEditor.showOnlyOverridenParameters = !targetEditor.showOnlyOverridenParameters); + menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overridden Parameters"), targetEditor.showOnlyOverriddenParameters, () => targetEditor.showOnlyOverriddenParameters = !targetEditor.showOnlyOverriddenParameters); menu.AddItem(EditorGUIUtility.TrTextContent("Open Core Render Pipeline Preferences..."), false, () => CoreRenderPipelinePreferences.Open()); menu.AddSeparator(string.Empty);