void Draw_VolumeInspector()
            {
                var hdrpAsset = HDRenderPipeline.defaultAsset;

                if (hdrpAsset == null)
                {
                    return;
                }

                var oldWidth = EditorGUIUtility.labelWidth;

                EditorGUIUtility.labelWidth = k_LabelWidth;

                var asset = EditorDefaultSettings.GetOrAssignDefaultVolumeProfile();

                var newAsset = (VolumeProfile)EditorGUILayout.ObjectField(k_DefaultVolumeProfileLabel, asset, typeof(VolumeProfile), false);

                if (newAsset == null)
                {
                    Debug.Log("Default Volume Profile Asset cannot be null. Rolling back to previous value.");
                }
                else if (newAsset != asset)
                {
                    asset = newAsset;
                    hdrpAsset.defaultVolumeProfile = asset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                Editor.CreateCachedEditor(asset,
                                          Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_Cached);
                EditorGUIUtility.labelWidth -= 18;
                m_Cached.OnInspectorGUI();
                EditorGUIUtility.labelWidth = oldWidth;
            }
예제 #2
0
            void Draw_VolumeInspector()
            {
                var hdrpAsset = HDRenderPipeline.defaultAsset;

                if (hdrpAsset == null)
                {
                    return;
                }

                var oldWidth = EditorGUIUtility.labelWidth;

                EditorGUIUtility.labelWidth = Styles.labelWidth;

                var asset    = EditorDefaultSettings.GetOrAssignDefaultVolumeProfile();
                var newAsset = (VolumeProfile)EditorGUILayout.ObjectField(Styles.defaultVolumeProfileLabel, asset, typeof(VolumeProfile), false);

                if (newAsset == null)
                {
                    Debug.Log("Default Volume Profile Asset cannot be null. Rolling back to previous value.");
                }
                else if (newAsset != asset)
                {
                    asset = newAsset;
                    hdrpAsset.defaultVolumeProfile = asset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                Editor.CreateCachedEditor(asset,
                                          Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_Cached);
                EditorGUIUtility.labelWidth -= 18;
                m_Cached.OnInspectorGUI();
                EditorGUIUtility.labelWidth = oldWidth;

                EditorGUILayout.Space();

                var lookDevAsset = EditorDefaultSettings.GetOrAssignLookDevVolumeProfile();

                EditorGUIUtility.labelWidth = 221;
                var newLookDevAsset = (VolumeProfile)EditorGUILayout.ObjectField(Styles.lookDevVolumeProfileLabel, lookDevAsset, typeof(VolumeProfile), false);

                if (lookDevAsset == null)
                {
                    Debug.Log("LookDev Volume Profile Asset cannot be null. Rolling back to previous value.");
                }
                else if (newLookDevAsset != lookDevAsset)
                {
                    hdrpAsset.defaultLookDevProfile = newLookDevAsset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                if (lookDevAsset.Has <VisualEnvironment>())
                {
                    EditorGUILayout.HelpBox("VisualEnvironment is not modifiable and will be overridden by the LookDev", MessageType.Warning);
                }
                if (lookDevAsset.Has <HDRISky>())
                {
                    EditorGUILayout.HelpBox("HDRISky is not modifiable and will be overridden by the LookDev", MessageType.Warning);
                }
            }
        void FixDefaultVolumeProfileAssigned()
        {
            if (!IsHdrpAssetUsedCorrect())
            {
                FixHdrpAssetUsed(fromAsync: false);
            }

            var hdAsset = HDRenderPipeline.currentAsset;

            EditorDefaultSettings.GetOrAssignDefaultVolumeProfile(hdAsset);
        }
예제 #4
0
            public override void Action(int instanceId, string pathName, string resourceFile)
            {
                var newAsset = CreateInstance <HDRenderPipelineAsset>();

                newAsset.name = Path.GetFileName(pathName);
                // Load default renderPipelineResources / Material / Shader
                newAsset.renderPipelineResources = AssetDatabase.LoadAssetAtPath <RenderPipelineResources>(s_RenderPipelineResourcesPath);
                EditorDefaultSettings.GetOrAssignDefaultVolumeProfile(newAsset);

                //as we must init the editor resources with lazy init, it is not required here

                AssetDatabase.CreateAsset(newAsset, pathName);
                ProjectWindowUtil.ShowCreatedAsset(newAsset);
            }
        void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
        {
            if (!IsHdrpAssetUsedCorrect())
            {
                FixHdrpAssetUsed(fromAsync: false);
            }

            var hdrpAsset = HDRenderPipeline.currentAsset;

            if (hdrpAsset == null)
            {
                return;
            }

            EditorDefaultSettings.GetOrAssignDefaultVolumeProfile(hdrpAsset);
            EditorUtility.SetDirty(hdrpAsset);
        }
예제 #6
0
            void Draw_VolumeInspector()
            {
                var hdrpAsset = HDRenderPipeline.defaultAsset;

                if (hdrpAsset == null)
                {
                    return;
                }

                var asset = EditorDefaultSettings.GetOrAssignDefaultVolumeProfile();

                var newAsset = (VolumeProfile)EditorGUILayout.ObjectField(k_DefaultVolumeProfileLabel, asset, typeof(VolumeProfile), false);

                if (newAsset != null && newAsset != asset)
                {
                    asset = newAsset;
                    hdrpAsset.defaultVolumeProfile = asset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                Editor.CreateCachedEditor(asset,
                                          Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_Cached);
                m_Cached.OnInspectorGUI();
            }
예제 #7
0
            void Draw_VolumeInspector()
            {
                var hdrpAsset = HDRenderPipeline.defaultAsset;

                if (hdrpAsset == null)
                {
                    return;
                }

                var oldWidth = EditorGUIUtility.labelWidth;

                EditorGUIUtility.labelWidth = Styles.labelWidth;

                EditorGUILayout.BeginHorizontal();
                var asset    = EditorDefaultSettings.GetOrAssignDefaultVolumeProfile();
                var newAsset = (VolumeProfile)EditorGUILayout.ObjectField(Styles.defaultVolumeProfileLabel, asset, typeof(VolumeProfile), false);

                if (newAsset == null)
                {
                    Debug.Log("Default Volume Profile Asset cannot be null. Rolling back to previous value.");
                }
                else if (newAsset != asset)
                {
                    asset = newAsset;
                    hdrpAsset.defaultVolumeProfile = asset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a new Volume Profile for default in your default resource folder (defined in Wizard)"), GUILayout.Width(38), GUILayout.Height(18)))
                {
                    DefaultVolumeProfileCreator.CreateAndAssign(DefaultVolumeProfileCreator.Kind.Default);
                }
                EditorGUILayout.EndHorizontal();

                // The state of the profile can change without the asset reference changing so in this case we need to reset the editor.
                if (m_CurrentVolumeProfileInstanceID != asset.GetInstanceID() && m_CachedDefaultVolumeProfileEditor != null)
                {
                    m_CurrentVolumeProfileInstanceID   = asset.GetInstanceID();
                    m_CachedDefaultVolumeProfileEditor = null;
                }

                Editor.CreateCachedEditor(asset, Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_CachedDefaultVolumeProfileEditor);
                EditorGUIUtility.labelWidth -= 18;
                bool oldEnabled = GUI.enabled;

                GUI.enabled = AssetDatabase.IsOpenForEdit(asset);
                m_CachedDefaultVolumeProfileEditor.OnInspectorGUI();
                GUI.enabled = oldEnabled;
                EditorGUIUtility.labelWidth = oldWidth;

                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                var lookDevAsset = EditorDefaultSettings.GetOrAssignLookDevVolumeProfile();

                EditorGUIUtility.labelWidth = 221;
                var newLookDevAsset = (VolumeProfile)EditorGUILayout.ObjectField(Styles.lookDevVolumeProfileLabel, lookDevAsset, typeof(VolumeProfile), false);

                if (lookDevAsset == null)
                {
                    Debug.Log("LookDev Volume Profile Asset cannot be null. Rolling back to previous value.");
                }
                else if (newLookDevAsset != lookDevAsset)
                {
                    hdrpAsset.defaultLookDevProfile = newLookDevAsset;
                    EditorUtility.SetDirty(hdrpAsset);
                }

                if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a new Volume Profile for default in your default resource folder (defined in Wizard)"), GUILayout.Width(38), GUILayout.Height(18)))
                {
                    DefaultVolumeProfileCreator.CreateAndAssign(DefaultVolumeProfileCreator.Kind.LookDev);
                }
                EditorGUILayout.EndHorizontal();

                Editor.CreateCachedEditor(lookDevAsset, Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_CachedLookDevVolumeProfileEditor);
                EditorGUIUtility.labelWidth -= 18;
                oldEnabled  = GUI.enabled;
                GUI.enabled = AssetDatabase.IsOpenForEdit(asset);
                m_CachedLookDevVolumeProfileEditor.OnInspectorGUI();
                GUI.enabled = oldEnabled;
                EditorGUIUtility.labelWidth = oldWidth;

                if (lookDevAsset.Has <VisualEnvironment>())
                {
                    EditorGUILayout.HelpBox("VisualEnvironment is not modifiable and will be overridden by the LookDev", MessageType.Warning);
                }
                if (lookDevAsset.Has <HDRISky>())
                {
                    EditorGUILayout.HelpBox("HDRISky is not modifiable and will be overridden by the LookDev", MessageType.Warning);
                }
            }