private void ShowEdiorButtonGUI() { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); if (GUILayout.Button(!(bool)((Object)instance) || !instance.IsVisible() ? this.showWindowText : (instance.GetNumTabs() <= 1 ? this.closeWindowText : this.hideWindowText), EditorStyles.miniButton, new GUILayoutOption[1] { GUILayout.Width(110f) })) { if ((bool)((Object)instance)) { if (instance.IsVisible()) { if (!instance.ShowNextTabIfPossible()) { instance.Close(); } } else { instance.Focus(); } } else { this.Clear(); ParticleSystemWindow.CreateWindow(); GUIUtility.ExitGUI(); } } GUILayout.EndHorizontal(); }
private bool ShouldShowInspector() { // Only show the inspector GUI if we are not showing the ParticleSystemWindow ParticleSystemWindow window = ParticleSystemWindow.GetInstance(); return(!window || !window.IsVisible() || !selectedInParticleSystemWindow); }
private void ShowEdiorButtonGUI() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool selectedInParticleSystemWindow = this.selectedInParticleSystemWindow; GameObject gameObject = (base.target as ParticleSystem).gameObject; GUIContent hideWindowText = null; ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); if (((instance != null) && instance.IsVisible()) && selectedInParticleSystemWindow) { if (instance.GetNumTabs() > 1) { hideWindowText = this.hideWindowText; } else { hideWindowText = this.closeWindowText; } } else { hideWindowText = this.showWindowText; } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(110f) }; if (GUILayout.Button(hideWindowText, EditorStyles.miniButton, options)) { if (((instance != null) && instance.IsVisible()) && selectedInParticleSystemWindow) { if (!instance.ShowNextTabIfPossible()) { instance.Close(); } } else { if (!selectedInParticleSystemWindow) { ParticleSystemEditorUtils.lockedParticleSystem = null; Selection.activeGameObject = gameObject; } if (instance != null) { if (!selectedInParticleSystemWindow) { instance.Clear(); } instance.Focus(); } else { this.Clear(); ParticleSystemWindow.CreateWindow(); GUIUtility.ExitGUI(); } } } GUILayout.EndHorizontal(); }
private bool ShouldShowInspector() { ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); if ((bool)((Object)instance)) { return(!instance.IsVisible()); } return(true); }
private void OnEnable() { ParticleSystemWindow.s_Instance = this; this.m_Target = (ParticleSystem)null; ParticleEffectUI.m_VerticalLayout = EditorPrefs.GetBool("ShurikenVerticalLayout", false); EditorApplication.hierarchyWindowChanged += new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.projectWindowChanged += new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); SceneView.onSceneGUIDelegate += new SceneView.OnSceneFunc(this.OnSceneViewGUI); EditorApplication.playmodeStateChanged += new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged); Undo.undoRedoPerformed += new Undo.UndoRedoCallback(this.UndoRedoPerformed); this.autoRepaintOnSceneChange = false; }
private void OnEnable() { ParticleSystemWindow.s_Instance = this; this.m_Target = (ParticleSystem) null; ParticleEffectUI.m_VerticalLayout = EditorPrefs.GetBool("ShurikenVerticalLayout", false); EditorApplication.hierarchyWindowChanged += new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.projectWindowChanged += new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); SceneView.onSceneGUIDelegate += new SceneView.OnSceneFunc(this.OnSceneViewGUI); EditorApplication.playmodeStateChanged += new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged); Undo.undoRedoPerformed += new Undo.UndoRedoCallback(this.UndoRedoPerformed); this.autoRepaintOnSceneChange = false; }
private void OnEnable() { s_Instance = this; this.m_Target = null; ParticleEffectUI.m_VerticalLayout = EditorPrefs.GetBool("ShurikenVerticalLayout", false); EditorApplication.hierarchyWindowChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.hierarchyWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneViewGUI)); EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); base.autoRepaintOnSceneChange = false; }
private void OnDisable() { ParticleSystemEditorUtils.editorUpdateAll = false; SceneView.onSceneGUIDelegate -= new SceneView.OnSceneFunc(this.OnSceneViewGUI); EditorApplication.projectWindowChanged -= new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.hierarchyWindowChanged -= new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.playmodeStateChanged -= new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged); Undo.undoRedoPerformed -= new Undo.UndoRedoCallback(this.UndoRedoPerformed); this.Clear(); if (!((Object) ParticleSystemWindow.s_Instance == (Object) this)) return; ParticleSystemWindow.s_Instance = (ParticleSystemWindow) null; }
private void OnDisable() { SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.Remove(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneViewGUI)); EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.hierarchyWindowChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.hierarchyWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Remove(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); this.Clear(); if (ParticleSystemWindow.s_Instance == this) { ParticleSystemWindow.s_Instance = null; } }
private void OnDisable() { ParticleSystemEditorUtils.editorUpdateAll = false; SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.Remove(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneViewGUI)); EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.hierarchyWindowChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.hierarchyWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Remove(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); this.Clear(); if (ParticleSystemWindow.s_Instance == this) { ParticleSystemWindow.s_Instance = null; } }
private void ShowEdiorButtonGUI() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); GUIContent content; if (instance && instance.IsVisible()) { if (instance.GetNumTabs() > 1) { content = this.hideWindowText; } else { content = this.closeWindowText; } } else { content = this.showWindowText; } if (GUILayout.Button(content, EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.Width(110f) })) { if (instance) { if (instance.IsVisible()) { if (!instance.ShowNextTabIfPossible()) { instance.Close(); } } else { instance.Focus(); } } else { this.Clear(); ParticleSystemWindow.CreateWindow(); GUIUtility.ExitGUI(); } } GUILayout.EndHorizontal(); }
private void OnDisable() { ParticleSystemEditorUtils.editorUpdateAll = false; SceneView.onSceneGUIDelegate -= new SceneView.OnSceneFunc(this.OnSceneViewGUI); EditorApplication.projectWindowChanged -= new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.hierarchyWindowChanged -= new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged); EditorApplication.playmodeStateChanged -= new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged); Undo.undoRedoPerformed -= new Undo.UndoRedoCallback(this.UndoRedoPerformed); this.Clear(); if (!((Object)ParticleSystemWindow.s_Instance == (Object)this)) { return; } ParticleSystemWindow.s_Instance = (ParticleSystemWindow)null; }
void OnEnable() { s_Instance = this; m_Target = null; // Ensure we recreate EffectUI after script reloads ParticleEffectUI.m_VerticalLayout = EditorPrefs.GetBool("ShurikenVerticalLayout", false); // Get notified when hierarchy- or project window has changes so we can detect if particle systems have been dragged in or out. EditorApplication.hierarchyChanged += OnHierarchyOrProjectWindowWasChanged; EditorApplication.projectChanged += OnHierarchyOrProjectWindowWasChanged; SceneView.duringSceneGui += OnSceneViewGUI; EditorApplication.pauseStateChanged += OnPauseStateChanged; EditorApplication.playModeStateChanged += OnPlayModeStateChanged; Undo.undoRedoPerformed += UndoRedoPerformed; autoRepaintOnSceneChange = false; }
void OnDisable() { SceneView.duringSceneGui -= OnSceneViewGUI; EditorApplication.projectChanged -= OnHierarchyOrProjectWindowWasChanged; EditorApplication.hierarchyChanged -= OnHierarchyOrProjectWindowWasChanged; EditorApplication.pauseStateChanged -= OnPauseStateChanged; EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; Undo.undoRedoPerformed -= UndoRedoPerformed; Clear(); if (s_Instance == this) { s_Instance = null; } }
private bool ShouldShowInspector() { ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); return(((instance == null) || !instance.IsVisible()) || !this.selectedInParticleSystemWindow); }
public static void CreateWindow() { ParticleSystemWindow.s_Instance = EditorWindow.GetWindow <ParticleSystemWindow>(); ParticleSystemWindow.s_Instance.title = "Particle Effect"; ParticleSystemWindow.s_Instance.minSize = ParticleEffectUI.GetMinSize(); }
private bool ShouldShowInspector() { ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); return(!instance || !instance.IsVisible()); }
private void ShowEdiorButtonGUI() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (this.m_ParticleEffectUI == null || !this.m_ParticleEffectUI.multiEdit) { bool selectedInParticleSystemWindow = this.selectedInParticleSystemWindow; GameObject gameObject = (base.target as ParticleSystem).gameObject; ParticleSystemWindow instance = ParticleSystemWindow.GetInstance(); if (instance) { instance.customEditor = this; } GUIContent content; if (instance && instance.IsVisible() && selectedInParticleSystemWindow) { if (instance.GetNumTabs() > 1) { content = this.hideWindowText; } else { content = this.closeWindowText; } } else { content = this.showWindowText; } if (GUILayout.Button(content, EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.Width(110f) })) { if (instance && instance.IsVisible() && selectedInParticleSystemWindow) { if (!instance.ShowNextTabIfPossible()) { instance.Close(); } } else { if (!selectedInParticleSystemWindow) { ParticleSystemEditorUtils.lockedParticleSystem = null; Selection.activeGameObject = gameObject; } if (instance) { if (!selectedInParticleSystemWindow) { instance.Clear(); } instance.Focus(); } else { this.Clear(); ParticleSystemWindow.CreateWindow(); instance = ParticleSystemWindow.GetInstance(); instance.customEditor = this; GUIUtility.ExitGUI(); } } } } GUILayout.EndHorizontal(); }
void ShowEditorButtonGUI() { using (new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (m_ParticleEffectUI != null) { m_ParticleEffectUI.m_SubEmitterSelected = false; } if (m_ParticleEffectUI == null || !m_ParticleEffectUI.multiEdit) { bool alreadySelected = selectedInParticleSystemWindow; GameObject targetGameObject = (target as ParticleSystem).gameObject; // Show a button to select the sub-emitter owner, if this system is a sub-emitter List <ParticleSystem> owners = new List <ParticleSystem>(); var parent = targetGameObject.transform.parent; while (parent != null) { var ps = parent.GetComponent <ParticleSystem>(); if (ps != null) { var subEmitters = ps.subEmitters; if (subEmitters.enabled) { for (int i = 0; i < subEmitters.subEmittersCount; i++) { var subEmitter = subEmitters.GetSubEmitterSystem(i); if (subEmitter != null && subEmitter.gameObject == targetGameObject) { owners.Add(ps); break; } } } } parent = parent.parent; } if (owners.Count > 0) { if (m_ParticleEffectUI != null) { m_ParticleEffectUI.m_SubEmitterSelected = true; } if (owners.Count == 1) { if (GUILayout.Button(GUIContent.Temp(selectSubEmitterOwner.text, owners[0].name), EditorStyles.miniButton, GUILayout.Width(160))) { Selection.activeGameObject = owners[0].gameObject; } } else { if (EditorGUILayout.DropdownButton(selectSubEmitterOwner, FocusType.Passive, EditorStyles.miniButton, GUILayout.Width(160))) { GenericMenu menu = new GenericMenu(); foreach (var owner in owners) { menu.AddItem(new GUIContent(owner.name), false, OnOwnerSelected, owner); } menu.AddSeparator(""); menu.AddItem(new GUIContent("Select All"), false, OnOwnersSelected, owners); Rect buttonRect = GUILayoutUtility.topLevel.GetLast(); menu.DropDown(buttonRect); } } } // When editing a preset the GameObject will have the NotEditable flag. // We do not support the ParticleSystemWindow for Presets for two reasons: // - When selected the Preset editor creates a temporary GameObject which it then uses to edit the properties. // The ParticleSystemWindow also uses the Selection system which triggers a selection change, the Preset // editor cleans up the temp object and the ParticleSystemWindow is now unable to edit the system. // - A preset will only contain a single system, so there is no benefit to using the window. (case 1198545) if ((targetGameObject.hideFlags & HideFlags.NotEditable) != 0) { return; } GUIContent text = null; ParticleSystemWindow window = ParticleSystemWindow.GetInstance(); if (window) { window.customEditor = this; // window can be created by LoadWindowLayout, when Editor starts up, so always make sure the custom editor member is set up (case 930005) } if (window && window.IsVisible() && alreadySelected) { if (window.GetNumTabs() > 1) { text = hideWindowText; } else { text = closeWindowText; } } else { text = showWindowText; } if (GUILayout.Button(text, EditorStyles.miniButton, GUILayout.Width(110))) { if (window && window.IsVisible() && alreadySelected) { // Hide window (close instead if not possible) if (!window.ShowNextTabIfPossible()) { window.Close(); } } else { if (!alreadySelected) { ParticleSystemEditorUtils.lockedParticleSystem = null; Selection.activeGameObject = targetGameObject; } if (window) { if (!alreadySelected) { window.Clear(); } // Show window window.Focus(); } else { // Kill inspector gui first to ensure playback time is cached properly Clear(); // Create new window ParticleSystemWindow.CreateWindow(); window = ParticleSystemWindow.GetInstance(); window.customEditor = this; GUIUtility.ExitGUI(); } } } } } }
private void OnEnable() { s_Instance = this; this.m_Target = null; ParticleEffectUI.m_VerticalLayout = EditorPrefs.GetBool("ShurikenVerticalLayout", false); EditorApplication.hierarchyWindowChanged = (EditorApplication.CallbackFunction) Delegate.Combine(EditorApplication.hierarchyWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction) Delegate.Combine(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.OnHierarchyOrProjectWindowWasChanged)); SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc) Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneViewGUI)); EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction) Delegate.Combine(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); base.autoRepaintOnSceneChange = false; }
public static void CreateWindow() { s_Instance = EditorWindow.GetWindow<ParticleSystemWindow>(); s_Instance.titleContent = EditorGUIUtility.TextContent("Particle Effect"); s_Instance.minSize = ParticleEffectUI.GetMinSize(); }
void ShowEdiorButtonGUI() { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (m_ParticleEffectUI == null || !m_ParticleEffectUI.multiEdit) { bool alreadySelected = selectedInParticleSystemWindow; GameObject targetGameObject = (target as ParticleSystem).gameObject; GUIContent text = null; ParticleSystemWindow window = ParticleSystemWindow.GetInstance(); if (window) { window.customEditor = this; // window can be created by LoadWindowLayout, when Editor starts up, so always make sure the custom editor member is set up (case 930005) } if (window && window.IsVisible() && alreadySelected) { if (window.GetNumTabs() > 1) { text = hideWindowText; } else { text = closeWindowText; } } else { text = showWindowText; } if (GUILayout.Button(text, EditorStyles.miniButton, GUILayout.Width(110))) { if (window && window.IsVisible() && alreadySelected) { // Hide window (close instead if not possible) if (!window.ShowNextTabIfPossible()) { window.Close(); } } else { if (!alreadySelected) { ParticleSystemEditorUtils.lockedParticleSystem = null; Selection.activeGameObject = targetGameObject; } if (window) { if (!alreadySelected) { window.Clear(); } // Show window window.Focus(); } else { // Kill inspector gui first to ensure playback time is cached properly Clear(); // Create new window ParticleSystemWindow.CreateWindow(); window = ParticleSystemWindow.GetInstance(); window.customEditor = this; GUIUtility.ExitGUI(); } } } } } GUILayout.EndHorizontal(); }
public static void CreateWindow() { s_Instance = EditorWindow.GetWindow <ParticleSystemWindow>(); s_Instance.titleContent = EditorGUIUtility.TextContent("Particle Effect"); s_Instance.minSize = ParticleEffectUI.GetMinSize(); }
public static void CreateWindow() { ParticleSystemWindow.s_Instance = EditorWindow.GetWindow<ParticleSystemWindow>(); ParticleSystemWindow.s_Instance.title = "Particle Effect"; ParticleSystemWindow.s_Instance.minSize = ParticleEffectUI.GetMinSize(); }