void Draw_AssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; if (settingsSerialized == null) { EditorGUILayout.HelpBox("No active settings for HDRP. Rendering may be broken until a new one is assigned.", MessageType.Warning); } using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); var newAsset = (HDRenderPipelineGlobalSettings)EditorGUILayout.ObjectField(settingsSerialized, typeof(HDRenderPipelineGlobalSettings), false); if (EditorGUI.EndChangeCheck()) { HDRenderPipelineGlobalSettings.UpdateGraphicsSettings(newAsset); EditorUtility.SetDirty(settingsSerialized); } if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a HD Global Settings Asset in your default resource folder (defined in Wizard)"), GUILayout.Width(45), GUILayout.Height(18))) { HDAssetFactory.HDRenderPipelineGlobalSettingsCreator.Create(useProjectSettingsFolder: true, activateAsset: true); } bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && (settingsSerialized != null); if (GUILayout.Button(EditorGUIUtility.TrTextContent("Clone", "Clone a HD Global Settings Asset in your default resource folder (defined in Wizard)"), GUILayout.Width(45), GUILayout.Height(18))) { HDAssetFactory.HDRenderPipelineGlobalSettingsCreator.Clone(settingsSerialized, activateAsset: true); } GUI.enabled = guiEnabled; } EditorGUIUtility.labelWidth = oldWidth; EditorGUILayout.Space(); }
static void DrawMiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel); EditorGUILayout.PropertyField(serialized.lensAttenuation, Styles.lensAttenuationModeContentLabel); #if ENABLE_NVIDIA && ENABLE_NVIDIA_MODULE EditorGUILayout.PropertyField(serialized.useDLSSCustomProjectId, Styles.useDLSSCustomProjectIdLabel); if (serialized.useDLSSCustomProjectId.boolValue) { EditorGUILayout.PropertyField(serialized.DLSSProjectId, Styles.DLSSProjectIdLabel); } #endif } Type renderPipeManagerType = typeof(RenderPipelineManager); var cleanupRenderPipeline = renderPipeManagerType.GetMethod("CleanupRenderPipeline", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serialized.supportProbeVolumes, Styles.probeVolumeSupportContentLabel); if (EditorGUI.EndChangeCheck()) { cleanupRenderPipeline?.Invoke(null, null); } EditorGUIUtility.labelWidth = oldWidth; }
public void DoGUI(string searchContext) { if (HDRenderPipeline.currentPipeline == null) { EditorGUILayout.HelpBox("No HDRP pipeline currently active (see Quality Settings active level).", MessageType.Warning); } if ((serializedSettings == null) || (settingsSerialized != HDRenderPipelineGlobalSettings.instance)) { settingsSerialized = HDRenderPipelineGlobalSettings.Ensure(); var serializedObject = new SerializedObject(settingsSerialized); serializedSettings = new SerializedHDRenderPipelineGlobalSettings(serializedObject); } else { serializedSettings.serializedObject.Update(); } Draw_AssetSelection(ref serializedSettings, null); if (settingsSerialized != null && serializedSettings != null) { EditorGUILayout.Space(); Inspector.Draw(serializedSettings, null); } serializedSettings.serializedObject.ApplyModifiedProperties(); }
void DrawAssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); var newAsset = (HDRenderPipelineGlobalSettings)EditorGUILayout.ObjectField(settingsSerialized, typeof(HDRenderPipelineGlobalSettings), false); if (EditorGUI.EndChangeCheck()) { HDRenderPipelineGlobalSettings.UpdateGraphicsSettings(newAsset); Debug.Assert(newAsset == HDRenderPipelineGlobalSettings.instance); if (settingsSerialized != null && !settingsSerialized.Equals(null)) { EditorUtility.SetDirty(settingsSerialized); } } if (GUILayout.Button(Styles.newAssetButtonLabel, GUILayout.Width(45), GUILayout.Height(18))) { HDAssetFactory.HDRenderPipelineGlobalSettingsCreator.Create(useProjectSettingsFolder: true, assignToActiveAsset: true); } bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && (settingsSerialized != null); if (GUILayout.Button(Styles.cloneAssetButtonLabel, GUILayout.Width(45), GUILayout.Height(18))) { HDAssetFactory.HDRenderPipelineGlobalSettingsCreator.Clone(settingsSerialized, assignToActiveAsset: true); } GUI.enabled = guiEnabled; } EditorGUIUtility.labelWidth = oldWidth; EditorGUILayout.Space(); }
static void DrawDecalLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { m_ShowDecalLayerNames = CoreEditorUtils.DrawHeaderFoldout(Styles.decalLayersLabel, m_ShowDecalLayerNames, documentationURL: Documentation.GetPageLink(DocumentationUrls.k_DecalLayers), contextAction: pos => OnContextClickRenderingLayerNames(pos, serialized, section: 2)); if (m_ShowDecalLayerNames) { using (new EditorGUI.IndentLevelScope()) { using (var changed = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.DelayedTextField(serialized.decalLayerName0, Styles.decalLayerName0); EditorGUILayout.DelayedTextField(serialized.decalLayerName1, Styles.decalLayerName1); EditorGUILayout.DelayedTextField(serialized.decalLayerName2, Styles.decalLayerName2); EditorGUILayout.DelayedTextField(serialized.decalLayerName3, Styles.decalLayerName3); EditorGUILayout.DelayedTextField(serialized.decalLayerName4, Styles.decalLayerName4); EditorGUILayout.DelayedTextField(serialized.decalLayerName5, Styles.decalLayerName5); EditorGUILayout.DelayedTextField(serialized.decalLayerName6, Styles.decalLayerName6); EditorGUILayout.DelayedTextField(serialized.decalLayerName7, Styles.decalLayerName7); if (changed.changed) { serialized.serializedObject?.ApplyModifiedProperties(); (serialized.serializedObject.targetObject as HDRenderPipelineGlobalSettings).UpdateRenderingLayerNames(); } } } } }
static void DrawMiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(serialized.lensAttenuation, Styles.lensAttenuationModeContentLabel); EditorGUILayout.PropertyField(serialized.colorGradingSpace, Styles.colorGradingSpaceContentLabel); EditorGUILayout.PropertyField(serialized.rendererListCulling, Styles.rendererListCulling); #if ENABLE_NVIDIA && ENABLE_NVIDIA_MODULE EditorGUILayout.PropertyField(serialized.useDLSSCustomProjectId, Styles.useDLSSCustomProjectIdLabel); if (serialized.useDLSSCustomProjectId.boolValue) { EditorGUILayout.PropertyField(serialized.DLSSProjectId, Styles.DLSSProjectIdLabel); } #endif EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serialized.supportProbeVolumes, Styles.probeVolumeSupportContentLabel); if (EditorGUI.EndChangeCheck()) { // If we are running HDRP, we need to make sure the RP is reinitialized if (HDRenderPipeline.currentPipeline != null) { s_CleanupRenderPipelineMethod?.Invoke(null, null); } } EditorGUILayout.PropertyField(serialized.supportRuntimeDebugDisplay, Styles.supportRuntimeDebugDisplayContentLabel); } EditorGUIUtility.labelWidth = oldWidth; }
public void DoGUI(string searchContext) { // When the asset being serialized has been deleted before its reconstruction if (serializedSettings != null && serializedSettings.serializedObject.targetObject == null) { serializedSettings = null; settingsSerialized = null; } if (serializedSettings == null || settingsSerialized != HDRenderPipelineGlobalSettings.instance) { if (HDRenderPipeline.currentAsset != null || HDRenderPipelineGlobalSettings.instance != null) { settingsSerialized = HDRenderPipelineGlobalSettings.Ensure(); var serializedObject = new SerializedObject(settingsSerialized); serializedSettings = new SerializedHDRenderPipelineGlobalSettings(serializedObject); } } else if (settingsSerialized != null && serializedSettings != null) { serializedSettings.serializedObject.Update(); } DrawAssetSelection(ref serializedSettings, null); DrawWarnings(ref serializedSettings, null); if (settingsSerialized != null && serializedSettings != null) { EditorGUILayout.Space(); Inspector.Draw(serializedSettings, null); serializedSettings.serializedObject?.ApplyModifiedProperties(); } }
static void Drawer_CustomPostProcess(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); serialized.uiBeforeTransparentCustomPostProcesses.DoLayoutList(); } GUILayout.Space(2); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); serialized.uiBeforeTAACustomPostProcesses.DoLayoutList(); } GUILayout.Space(2); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); serialized.uiBeforePostProcessCustomPostProcesses.DoLayoutList(); } GUILayout.Space(2); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); serialized.uiAfterPostProcessCustomPostProcesses.DoLayoutList(); } }
static void Drawer_DecalLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { m_ShowDecalLayerNames = EditorGUILayout.Foldout(m_ShowDecalLayerNames, Styles.decalLayersLabel, true); if (m_ShowDecalLayerNames) { using (new EditorGUI.IndentLevelScope()) { HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName0, serialized.decalLayerName0); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName1, serialized.decalLayerName1); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName2, serialized.decalLayerName2); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName3, serialized.decalLayerName3); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName4, serialized.decalLayerName4); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName5, serialized.decalLayerName5); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName6, serialized.decalLayerName6); GUILayout.Space(2); HDEditorUtils.DrawDelayedTextField(Styles.decalLayerName7, serialized.decalLayerName7); } } }
static void Drawer_DiffusionProfileSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); serialized.m_DiffusionProfileUI.OnGUI(serialized.diffusionProfileSettingsList); } }
static void OnContextClickRenderingLayerNames(Vector2 position, SerializedHDRenderPipelineGlobalSettings serialized, int section = 0) { var menu = new GenericMenu(); menu.AddItem(section == 0 ? CoreEditorStyles.resetAllButtonLabel : CoreEditorStyles.resetButtonLabel, false, () => { var globalSettings = (serialized.serializedObject.targetObject as HDRenderPipelineGlobalSettings); globalSettings.ResetRenderingLayerNames(lightLayers: section < 2, decalLayers: section != 1); }); menu.DropDown(new Rect(position, Vector2.zero)); }
static void DrawDiffusionProfileSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5); var labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 100; serialized.m_DiffusionProfileUI.OnGUI(serialized.diffusionProfileSettingsList); EditorGUIUtility.labelWidth = labelWidth; } }
static void Drawer_MiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel); EditorGUILayout.PropertyField(serialized.lensAttenuation, Styles.lensAttenuationModeContentLabel); } EditorGUIUtility.labelWidth = oldWidth; }
static void DrawLayerNamesSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; CoreEditorUtils.DrawSplitter(); DrawLightLayerNames(serialized, owner); CoreEditorUtils.DrawSplitter(); DrawDecalLayerNames(serialized, owner); CoreEditorUtils.DrawSplitter(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth = oldWidth; }
static void Drawer_LayerNamesSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { Drawer_LightLayerNames(serialized, owner); EditorGUILayout.Space(); Drawer_DecalLayerNames(serialized, owner); EditorGUILayout.Space(); } EditorGUIUtility.labelWidth = oldWidth; }
static void DrawFrameSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.LabelField(Styles.frameSettingsLabel_Camera, CoreEditorStyles.subSectionHeaderStyle); DrawFrameSettingsSubsection(0, serialized.defaultCameraFrameSettings, owner); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.frameSettingsLabel_RTProbe, CoreEditorStyles.subSectionHeaderStyle); DrawFrameSettingsSubsection(1, serialized.defaultRealtimeReflectionFrameSettings, owner); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.frameSettingsLabel_BakedProbe, CoreEditorStyles.subSectionHeaderStyle); DrawFrameSettingsSubsection(2, serialized.defaultBakedOrCustomReflectionFrameSettings, owner); EditorGUILayout.Space(); } }
static void DrawMiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel); EditorGUILayout.PropertyField(serialized.lensAttenuation, Styles.lensAttenuationModeContentLabel); #if ENABLE_NVIDIA && ENABLE_NVIDIA_MODULE EditorGUILayout.PropertyField(serialized.useDLSSCustomProjectId, Styles.useDLSSCustomProjectIdLabel); if (serialized.useDLSSCustomProjectId.boolValue) { EditorGUILayout.PropertyField(serialized.DLSSProjectId, Styles.DLSSProjectIdLabel); } #endif } EditorGUIUtility.labelWidth = oldWidth; }
void DrawWarnings(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { bool isHDRPinUse = HDRenderPipeline.currentAsset != null; if (isHDRPinUse && serialized != null) { return; } if (isHDRPinUse) { EditorGUILayout.HelpBox(Styles.warningGlobalSettingsMissing, MessageType.Warning); } else { EditorGUILayout.HelpBox(Styles.warningHdrpNotActive, MessageType.Warning); if (serialized == null) { EditorGUILayout.HelpBox(Styles.infoGlobalSettingsMissing, MessageType.Info); } } }
static void Drawer_ResourcesSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUI.IndentLevelScope()) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; EditorGUILayout.PropertyField(serialized.renderPipelineResources, Styles.renderPipelineResourcesContent); bool oldGuiEnabled = GUI.enabled; GUI.enabled = false; EditorGUILayout.PropertyField(serialized.renderPipelineRayTracingResources, Styles.renderPipelineRayTracingResourcesContent); // Not serialized as editor only datas... Retrieve them in data EditorGUI.showMixedValue = serialized.editorResourceHasMultipleDifferentValues; var editorResources = EditorGUILayout.ObjectField(Styles.renderPipelineEditorResourcesContent, serialized.firstEditorResources, typeof(HDRenderPipelineEditorResources), allowSceneObjects: false) as HDRenderPipelineEditorResources; EditorGUI.showMixedValue = false; GUI.enabled = oldGuiEnabled; EditorGUIUtility.labelWidth = oldWidth; } }
void OnEnable() { m_SerializedHDRenderPipelineGlobalSettings = new SerializedHDRenderPipelineGlobalSettings(serializedObject); }
static void Drawer_VolumeSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUI.IndentLevelScope()) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; HDRenderPipelineGlobalSettings globalSettings = serialized.serializedObject.targetObject as HDRenderPipelineGlobalSettings; VolumeProfile asset = null; using (new EditorGUILayout.HorizontalScope()) { var oldAssetValue = serialized.volumeProfileDefault.objectReferenceValue; EditorGUILayout.PropertyField(serialized.volumeProfileDefault, Styles.defaultVolumeProfileLabel); asset = serialized.volumeProfileDefault.objectReferenceValue as VolumeProfile; if (asset == null && oldAssetValue != null) { Debug.Log("Default Volume Profile Asset cannot be null. Rolling back to previous value."); serialized.volumeProfileDefault.objectReferenceValue = oldAssetValue; } 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))) { HDAssetFactory.VolumeProfileCreator.CreateAndAssign(HDAssetFactory.VolumeProfileCreator.Kind.Default, globalSettings); } } if (asset != null) { // 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); bool oldEnabled = GUI.enabled; GUI.enabled = AssetDatabase.IsOpenForEdit(asset); m_CachedDefaultVolumeProfileEditor.OnInspectorGUI(); GUI.enabled = oldEnabled; } EditorGUILayout.Space(); VolumeProfile lookDevAsset = null; using (new EditorGUILayout.HorizontalScope()) { var oldAssetValue = serialized.volumeProfileLookDev.objectReferenceValue; EditorGUILayout.PropertyField(serialized.volumeProfileLookDev, Styles.lookDevVolumeProfileLabel); lookDevAsset = serialized.volumeProfileLookDev.objectReferenceValue as VolumeProfile; if (lookDevAsset == null && oldAssetValue != null) { Debug.Log("LookDev Volume Profile Asset cannot be null. Rolling back to previous value."); serialized.volumeProfileLookDev.objectReferenceValue = oldAssetValue; } 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))) { HDAssetFactory.VolumeProfileCreator.CreateAndAssign(HDAssetFactory.VolumeProfileCreator.Kind.LookDev, globalSettings); } } if (lookDevAsset != null) { Editor.CreateCachedEditor(lookDevAsset, Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_CachedLookDevVolumeProfileEditor); bool oldEnabled = GUI.enabled; GUI.enabled = AssetDatabase.IsOpenForEdit(lookDevAsset); m_CachedLookDevVolumeProfileEditor.OnInspectorGUI(); GUI.enabled = oldEnabled; 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); } } EditorGUIUtility.labelWidth = oldWidth; } }