/// <summary>
            /// Executed when activate is called from the settings provider.
            /// </summary>
            /// <param name="searchContext"></param>
            /// <param name="rootElement"></param>
            public void OnActivate(string searchContext, VisualElement rootElement)
            {
                if (HDRenderPipeline.defaultAsset == null)
                {
                    return;
                }

                m_ScrollViewPosition = Vector2.zero;
                InitializeCustomPostProcessesLists();

                m_DiffusionProfileUI = new DiffusionProfileSettingsListUI()
                {
                    drawElement = DrawDiffusionProfileElement
                };

                var serializedObject = new SerializedObject(HDRenderPipeline.defaultAsset);

                m_SerializeHDRPAsset = new SerializedHDRenderPipelineAsset(serializedObject);

                var editorResources = HDRenderPipeline.defaultAsset.renderPipelineEditorResources;

                if (!EditorUtility.IsPersistent(editorResources))
                {
                    var editorResourcesPath = HDUtils.GetHDRenderPipelinePath() + "Editor/RenderPipelineResources/HDRenderPipelineEditorResources.asset";
                    HDRenderPipeline.defaultAsset.renderPipelineEditorResources = AssetDatabase.LoadAssetAtPath <HDRenderPipelineEditorResources>(editorResourcesPath);
                }
            }
示例#2
0
        public SerializedHDRenderPipelineGlobalSettings(SerializedObject serializedObject)
        {
            this.serializedObject = serializedObject;

            // do the cast only once
            foreach (var currentSetting in serializedObject.targetObjects)
            {
                if (currentSetting is HDRenderPipelineGlobalSettings hdrpSettings)
                {
                    serializedSettings.Add(hdrpSettings);
                }
                else
                {
                    throw new Exception($"Target object has an invalid object, objects must be of type {typeof(HDRenderPipelineGlobalSettings)}");
                }
            }

            renderPipelineResources                     = serializedObject.FindProperty("m_RenderPipelineResources");
            renderPipelineRayTracingResources           = serializedObject.FindProperty("m_RenderPipelineRayTracingResources");
            defaultCameraFrameSettings                  = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultCameraFrameSettings"), null);                  //no overrides in HDRPAsset
            defaultBakedOrCustomReflectionFrameSettings = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings"), null); //no overrides in HDRPAsset
            defaultRealtimeReflectionFrameSettings      = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultRealtimeReflectionFrameSettings"), null);      //no overrides in HDRPAsset

            InitializeCustomPostProcessesLists();

            defaultVolumeProfile = serializedObject.FindProperty("m_DefaultVolumeProfile");
            lookDevVolumeProfile = serializedObject.FindProperty("m_LookDevVolumeProfile");

            lightLayerName0 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName0);
            lightLayerName1 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName1);
            lightLayerName2 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName2);
            lightLayerName3 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName3);
            lightLayerName4 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName4);
            lightLayerName5 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName5);
            lightLayerName6 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName6);
            lightLayerName7 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName7);

            decalLayerName0 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName0);
            decalLayerName1 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName1);
            decalLayerName2 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName2);
            decalLayerName3 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName3);
            decalLayerName4 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName4);
            decalLayerName5 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName5);
            decalLayerName6 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName6);
            decalLayerName7 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.decalLayerName7);

            shaderVariantLogLevel = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.shaderVariantLogLevel);

            lensAttenuation = serializedObject.FindProperty("lensAttenuationMode");
            diffusionProfileSettingsList = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.diffusionProfileSettingsList);
            m_DiffusionProfileUI         = new DiffusionProfileSettingsListUI()
            {
                drawElement = DrawDiffusionProfileElement
            };


            DLSSProjectId          = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.DLSSProjectId);
            useDLSSCustomProjectId = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.useDLSSCustomProjectId);
        }