public static void GX_Presets_Normal() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.Normal); MarkDirty(hbao); } }
public static void GX_Presets_HighestQuality() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.HighestQuality); MarkDirty(hbao); } }
public static void GX_Presets_FastPerformance() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.FastPerformance); MarkDirty(hbao); } }
public override void OnInspectorGUI() { serializedObject.Update(); SetStyles(); EditorGUILayout.BeginVertical(); { // header GUILayout.Space(10.0f); GUILayout.Label(m_HBAOTex, m_TitleLabelStyle, GUILayout.ExpandWidth(true)); //if (m_HBAO.GetComponents<MonoBehaviour>()[0] != m_HBAO) //{ //GUILayout.Space(6.0f); //EditorGUILayout.HelpBox("This Post FX should be one of the first in your effect stack", MessageType.Info); //} Event e = Event.current; // settings groups foreach (var group in m_GroupFields) { var groupProperty = serializedObject.FindProperty(group.Key.Name); if (groupProperty == null) { continue; } GUILayout.Space(6.0f); Rect rect = GUILayoutUtility.GetRect(16f, 22f, m_SettingsGroupStyle); GUI.Box(rect, ObjectNames.NicifyVariableName(groupProperty.displayName), m_SettingsGroupStyle); if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) { groupProperty.isExpanded = !groupProperty.isExpanded; e.Use(); } if (!groupProperty.isExpanded) { continue; } // presets is a special case if (group.Key.FieldType == typeof(HBAO.Presets)) { GUILayout.Space(6.0f); m_SelectedPreset = GUILayout.SelectionGrid(m_SelectedPreset, m_Presets.Values.Select(x => ObjectNames.NicifyVariableName(x.ToString())).ToArray(), 3); GUILayout.Space(6.0f); if (GUILayout.Button("Apply Preset")) { m_HBAO.ApplyPreset(m_Presets[m_SelectedPreset]); EditorUtility.SetDirty(target); if (!EditorApplication.isPlaying) { #if (UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorApplication.MarkSceneDirty(); #else UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); #endif } } } foreach (var field in group.Value) { // hide real presets if (group.Key.FieldType == typeof(HBAO.Presets)) { continue; } // hide resolution when deinterleaved HBAO is on if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "resolution") { if (m_HBAO.generalSettings.deinterleaving != HBAO.Deinterleaving.Disabled) { continue; } } // hide noise type when deinterleaved HBAO is on else if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "noiseType") { if (m_HBAO.generalSettings.deinterleaving != HBAO.Deinterleaving.Disabled) { continue; } } // warn about distance falloff greater than max distance else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "baseColor") { if (m_HBAO.aoSettings.distanceFalloff > m_HBAO.aoSettings.maxDistance) { GUILayout.Space(6.0f); EditorGUILayout.HelpBox("Distance Falloff shoudn't be superior to Max Distance", MessageType.Warning); } } // hide albedoMultiplier when not in deferred else if (group.Key.FieldType == typeof(HBAO.ColorBleedingSettings) && field.name == "albedoMultiplier") { RenderingPath renderingPath = m_HBAO.GetComponent <Camera>().renderingPath; if (renderingPath != RenderingPath.DeferredShading && (renderingPath != RenderingPath.UsePlayerSettings || PlayerSettings.renderingPath != RenderingPath.DeferredShading)) { continue; } } EditorGUILayout.BeginHorizontal(); GUILayout.Space(12.0f); EditorGUILayout.PropertyField(field); EditorGUILayout.EndHorizontal(); } } } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }