public void UpdateVolumeProfile(VolumeProfile p) { if (!p.Has <PUnderwaterOverride>()) { p.Add <PUnderwaterOverride>(); } PUnderwaterOverride underwaterSettings; if (p.TryGet <PUnderwaterOverride>(out underwaterSettings)) { underwaterSettings.active = EnableUnderwater; if (EnableUnderwater) { underwaterSettings.waterLevel.Override(UnderwaterWaterLevel); underwaterSettings.maxDepth.Override(UnderwaterMaxDepth); underwaterSettings.surfaceColorBoost.Override(UnderwaterSurfaceColorBoost); underwaterSettings.shallowFogColor.Override(UnderwaterShallowFogColor); underwaterSettings.deepFogColor.Override(UnderwaterDeepFogColor); underwaterSettings.viewDistance.Override(UnderwaterViewDistance); underwaterSettings.enableCaustic.Override(UnderwaterEnableCaustic); underwaterSettings.causticTexture.Override(UnderwaterCausticTexture); underwaterSettings.causticSize.Override(UnderwaterCausticSize); underwaterSettings.causticStrength.Override(UnderwaterCausticStrength); underwaterSettings.enableDistortion.Override(UnderwaterEnableDistortion); underwaterSettings.distortionNormalMap.Override(UnderwaterDistortionTexture); underwaterSettings.distortionStrength.Override(UnderwaterDistortionStrength); underwaterSettings.waterFlowSpeed.Override(UnderwaterWaterFlowSpeed); } } if (!p.Has <PWetLensOverride>()) { p.Add <PWetLensOverride>(); } PWetLensOverride wetLensSettings; if (p.TryGet <PWetLensOverride>(out wetLensSettings)) { wetLensSettings.active = EnableWetLens; if (EnableWetLens) { wetLensSettings.normalMap.Override(WetLensNormalMap); wetLensSettings.strength.Override(WetLensStrength); } } }
public void CreateComponentTree(List <Element> tree) { var currentPipeline = RenderPipelineManager.currentPipeline; if (currentPipeline == null) { tree.Add(new GroupElement(0, "No SRP in use")); return; } tree.Add(new GroupElement(0, "Volume Overrides")); var volumeComponentTypesFiltered = VolumeManager.GetSupportedVolumeComponents(currentPipeline.GetType()); if (volumeComponentTypesFiltered.Any()) { var rootNode = new PathNode(); foreach (var(path, t) in volumeComponentTypesFiltered) { // Skip components that have already been added to the volume if (m_Target.Has(t)) { continue; } // Prep the categories & types tree AddNode(rootNode, path, t); } // Recursively add all elements to the tree Traverse(rootNode, 1, tree); } }
void UpdateSkyIntPopupData(bool reset = false) { if (m_SkyClassNames == null) { m_SkyClassNames = new List <GUIContent>(); m_SkyUniqueIDs = new List <int>(); } // We always reinit because the content can change depending on the volume and we are not always notified when this happens (like for undo/redo for example) m_SkyClassNames.Clear(); m_SkyUniqueIDs.Clear(); // Add special "None" case. m_SkyClassNames.Add(new GUIContent("None")); m_SkyUniqueIDs.Add(0); VolumeProfile profile = m_VolumeProfile.objectReferenceValue as VolumeProfile; if (profile != null) { var skyTypesDict = SkyManager.skyTypesDict; foreach (KeyValuePair <int, Type> kvp in skyTypesDict) { if (profile.Has(kvp.Value)) { m_SkyClassNames.Add(new GUIContent(kvp.Value.Name.ToString())); m_SkyUniqueIDs.Add(kvp.Key); } } } }
public void CreateComponentTree(List <Element> tree) { tree.Add(new GroupElement(0, "Volume Overrides")); var types = VolumeManager.instance.baseComponentTypeArray; var rootNode = new PathNode(); foreach (var t in types) { // Skip components that have already been added to the volume if (m_Target.Has(t)) { continue; } string path = string.Empty; // Look for a VolumeComponentMenu attribute var attrs = t.GetCustomAttributes(false); bool skipComponent = false; foreach (var attr in attrs) { if (attr is VolumeComponentMenu attrMenu) { path = attrMenu.menu; } if (attr is HideInInspector attrHide) { skipComponent = true; } if (attr is ObsoleteAttribute attrDeprecated) { skipComponent = true; } } if (skipComponent) { continue; } // If no attribute or in case something went wrong when grabbing it, fallback to a // beautified class name if (string.IsNullOrEmpty(path)) { path = ObjectNames.NicifyVariableName(t.Name); } // Prep the categories & types tree AddNode(rootNode, path, t); } // Recursively add all elements to the tree Traverse(rootNode, 1, tree); }
public void AddConvertedProfileSettingsToProfile( BIRPRendering.PostProcessEffectSettings oldSettings, VolumeProfile targetProfile) { if (oldSettings == null || oldSettings.GetType() != OldSettingsType) { return; } if (targetProfile == null || targetProfile.Has(OldSettingsType)) { return; } ConvertToTarget(oldSettings, targetProfile); }
public void CreateComponentTree(List <Element> tree) { tree.Add(new GroupElement(0, "Volume Overrides")); var attrType = typeof(VolumeComponentMenu); var types = VolumeManager.instance.baseComponentTypes; var rootNode = new PathNode(); foreach (var t in types) { // Skip components that have already been added to the volume if (m_Target.Has(t)) { continue; } string path = string.Empty; // Look for a VolumeComponentMenu attribute var attrs = t.GetCustomAttributes(attrType, false); if (attrs.Length > 0) { var attr = attrs[0] as VolumeComponentMenu; if (attr != null) { path = attr.menu; } } // If no attribute or in case something went wrong when grabbing it, fallback to a // beautified class name if (string.IsNullOrEmpty(path)) { path = ObjectNames.NicifyVariableName(t.Name); } // Prep the categories & types tree AddNode(rootNode, path, t); } // Recursively add all elements to the tree Traverse(rootNode, 1, tree); }
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; } }