public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); var e = (CameraEvent)EditorGUILayout.EnumPopup("Render Event", _effect.RenderEvent); if (e != _effect.RenderEvent) { Undo.RecordObject(_effect, "Set Render Event"); _effect.RenderEvent = e; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_effect.gameObject); if (!EditorApplication.isPlayingOrWillChangePlaymode) { EditorSceneManager.MarkSceneDirty(_effect.gameObject.scene); } } if (_effect.OutlineLayers.Count > 0) { _previewOpened = EditorGUILayout.Foldout(_previewOpened, "Preview", true); if (_previewOpened) { OutlineEditorUtility.RenderPreview(_effect.OutlineLayers, true); } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // 1) Outline settings. EditorGUI.BeginChangeCheck(); OutlineEditorUtility.Render(_effect, _effect); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_effect.gameObject); if (!EditorApplication.isPlayingOrWillChangePlaymode) { EditorSceneManager.MarkSceneDirty(_effect.gameObject.scene); } } // 2) Renderers (read-only). _renderersOpened = EditorGUILayout.Foldout(_renderersOpened, "Renderers", true); if (_renderersOpened) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; var rendererNumber = 1; foreach (var renderer in _effect.OutlineRenderers) { EditorGUILayout.ObjectField("#" + rendererNumber.ToString(), renderer, typeof(Renderer), true); rendererNumber++; } EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } // 3) Cameras (read-only). _camerasOpened = EditorGUILayout.Foldout(_camerasOpened, "Cameras", true); if (_camerasOpened) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; var cameraNumber = 1; foreach (var camera in _effect.Cameras) { EditorGUILayout.ObjectField("#" + cameraNumber.ToString(), camera, typeof(Camera), true); cameraNumber++; } EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); OutlineEditorUtility.Render(_settings, _settings); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_settings); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (_effect.OutlineLayers.Count > 0) { _previewOpened = EditorGUILayout.Foldout(_previewOpened, "Preview", true); if (_previewOpened) { OutlineEditorUtility.RenderPreview(_effect.OutlineLayers, true); } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); var e = (CameraEvent)EditorGUILayout.EnumPopup("Render Event", _effect.RenderEvent); if (e != _effect.RenderEvent) { Undo.RecordObject(_effect, "Set Render Event"); _effect.RenderEvent = e; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_effect.gameObject); if (!EditorApplication.isPlayingOrWillChangePlaymode) { EditorSceneManager.MarkSceneDirty(_effect.gameObject.scene); } } if (_effect.OutlineLayers.Count > 0) { _previewOpened = EditorGUILayout.Foldout(_previewOpened, "Preview", true); if (_previewOpened) { OutlineEditorUtility.RenderPreview(_effect.OutlineLayers, true); } } _debugOpened = EditorGUILayout.Foldout(_debugOpened, "Debug", true); if (_debugOpened) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; EditorGUILayout.IntField("Command buffer updates", _effect.NumberOfCommandBufferUpdates); EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // 1) Outline settings. EditorGUI.BeginChangeCheck(); var mask = EditorGUILayout.MaskField("Ignore layers", _effect.IgnoreLayerMask, InternalEditorUtility.layers); if (_effect.IgnoreLayerMask != mask) { Undo.RecordObject(_effect, "Set Ignore Layers"); _effect.IgnoreLayerMask = mask; } var obj = (OutlineSettings)EditorGUILayout.ObjectField("Outline Settings", _effect.OutlineSettings, typeof(OutlineSettings), true); if (_effect.OutlineSettings != obj) { Undo.RecordObject(_effect, "Set Settings"); _effect.OutlineSettings = obj; } if (obj) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; OutlineEditorUtility.Render(_effect, _effect); EditorGUILayout.HelpBox(string.Format("Outline settings are overriden with values from {0}.", obj.name), MessageType.Info, true); EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } else { EditorGUI.indentLevel += 1; OutlineEditorUtility.Render(_effect, _effect); EditorGUI.indentLevel -= 1; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_effect.gameObject); if (!EditorApplication.isPlayingOrWillChangePlaymode) { EditorSceneManager.MarkSceneDirty(_effect.gameObject.scene); } } // 2) Renderers (read-only). _renderersOpened = EditorGUILayout.Foldout(_renderersOpened, "Renderers", true); if (_renderersOpened) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; var rendererNumber = 1; foreach (var renderer in _effect.OutlineRenderers) { EditorGUILayout.ObjectField("#" + rendererNumber.ToString(), renderer, typeof(Renderer), true); rendererNumber++; } EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } // 3) Cameras (read-only). _camerasOpened = EditorGUILayout.Foldout(_camerasOpened, "Cameras", true); if (_camerasOpened) { EditorGUI.BeginDisabledGroup(true); EditorGUI.indentLevel += 1; var cameraNumber = 1; foreach (var camera in _effect.Cameras) { EditorGUILayout.ObjectField("#" + cameraNumber.ToString(), camera, typeof(Camera), true); cameraNumber++; } EditorGUI.indentLevel -= 1; EditorGUI.EndDisabledGroup(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); var removeLayer = -1; // 1) Layers list. if (_layers.Count > 0) { for (var i = 0; i < _layers.Count; i++) { EditorGUILayout.Space(); var rect = EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Layer #" + i.ToString()); GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove", _layerButtonStyle)) { removeLayer = i; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); rect.xMin -= 2; rect.xMax += 2; rect.yMin -= 2; rect.yMax += 2; GUI.Box(rect, GUIContent.none); OutlineEditorUtility.Render(_layers[i], _layers); } } else { EditorGUILayout.HelpBox("The layer collection is empty.", MessageType.Info, true); } // Add/remove processing. OutlineEditorUtility.RenderDivider(Color.gray); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add New", _layerButtonStyle)) { Undo.RecordObject(_layers, "Add Layer"); _layers.Add(new OutlineLayer()); } if (GUILayout.Button("Remove All", _layerButtonStyle)) { Undo.RecordObject(_layers, "Remove All Layers"); _layers.Clear(); } if (removeLayer >= 0) { Undo.RecordObject(_layers, "Remove Layer"); _layers.RemoveAt(removeLayer); } EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_layers); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); var removeLayer = -1; // 1) Layers list. if (_layers.Count > 0) { for (var i = 0; i < _layers.Count; i++) { EditorGUILayout.Space(); var rect = EditorGUILayout.BeginHorizontal(); var enabled = EditorGUILayout.ToggleLeft("Layer #" + i.ToString(), _layers[i].Enabled); if (enabled != _layers[i].Enabled) { if (enabled) { Undo.RecordObject(_layers, "Enable Layer"); } else { Undo.RecordObject(_layers, "Disable Layer"); } _layers[i].Enabled = enabled; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove", _layerButtonStyle)) { removeLayer = i; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); rect.xMin -= 2; rect.xMax += 2; rect.yMin -= 2; rect.yMax += 2; GUI.Box(rect, GUIContent.none); var name = EditorGUILayout.TextField("Layer Name", _layers[i].NameTag); if (name != _layers[i].NameTag) { Undo.RecordObject(_layers, "Set Layer Name"); _layers[i].NameTag = name; } var priority = EditorGUILayout.IntField("Layer Priority", _layers[i].Priority); if (priority != _layers[i].Priority) { Undo.RecordObject(_layers, "Set Layer Priority"); _layers[i].Priority = priority; } OutlineEditorUtility.Render(_layers[i], _layers); } } else { EditorGUILayout.HelpBox("The layer collection is empty.", MessageType.Info, true); } // Add/remove processing. OutlineEditorUtility.RenderDivider(Color.gray); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add New", _layerButtonStyle)) { Undo.RecordObject(_layers, "Add Layer"); _layers.Add(new OutlineLayer()); } if (GUILayout.Button("Remove All", _layerButtonStyle)) { Undo.RecordObject(_layers, "Remove All Layers"); _layers.Clear(); } if (removeLayer >= 0) { Undo.RecordObject(_layers, "Remove Layer"); _layers.RemoveAt(removeLayer); } EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_layers); } }