예제 #1
0
 internal static void SetVector3(string key, Vector3 value)
 {
     SessionState.INTERNAL_CALL_SetVector3(key, ref value);
 }
 public void OnEnable()
 {
     this.m_TableHeight = SessionState.GetFloat(this.m_SerializationUID + SerializedPropertyTable.s_TableHeight, 200f);
 }
예제 #3
0
 public virtual void OnDisable()
 {
     SessionState.SetBool("ShowEnvironment", this.m_bShowEnvironment);
 }
 private void SaveExpandedState()
 {
     SessionState.SetIntArray(AudioMixerGroupTreeView.GetUniqueAudioMixerName(this.m_Controller), this.m_AudioGroupTreeState.expandedIDs.ToArray());
 }
 public virtual void OnDisable()
 {
     SessionState.SetBool(kShowEnvironment, m_bShowEnvironment);
 }
 private static void ToggleDebugMode()
 {
     SceneHierarchyWindow.s_Debug = !SceneHierarchyWindow.s_Debug;
     SessionState.SetBool("HierarchyWindowDebug", SceneHierarchyWindow.s_Debug);
 }
예제 #7
0
 public virtual void OnDisable()
 {
     SessionState.SetBool("ShowLightingEditor", this.m_ShowEditor);
     this.m_ShowAmbientBakeMode.valueChanged.RemoveAllListeners();
     this.m_ParentWindow = null;
 }
 void SaveExpandedState()
 {
     SessionState.SetIntArray(GetUniqueAudioMixerName(m_Controller), m_AudioGroupTreeState.expandedIDs.ToArray());
 }
예제 #9
0
 public virtual void OnDisable()
 {
     SessionState.SetBool("ShowFogEditorFoldout", this.m_ShowEditor);
 }
예제 #10
0
 public virtual void OnEnable()
 {
     m_bShowEnvironment = SessionState.GetBool(kShowEnvironment, true);
 }
예제 #11
0
        public bool InitializeIfNeeded(ParticleSystem shuriken)
        {
            ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);
            bool           result;

            if (root == null)
            {
                result = false;
            }
            else
            {
                ParticleSystem[] particleSystems = ParticleEffectUI.GetParticleSystems(root);
                if (root == this.GetRoot())
                {
                    if (this.m_ParticleSystemCurveEditor != null && this.m_Emitters != null && particleSystems.Length == this.m_Emitters.Length)
                    {
                        this.m_SelectedParticleSystem = shuriken;
                        if (this.IsShowOnlySelectedMode())
                        {
                            this.RefreshShowOnlySelected();
                        }
                        result = false;
                        return(result);
                    }
                }
                if (this.m_ParticleSystemCurveEditor != null)
                {
                    this.Clear();
                }
                this.m_SelectedParticleSystem = shuriken;
                ParticleSystemEditorUtils.PerformCompleteResimulation();
                this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                this.m_ParticleSystemCurveEditor.Init();
                this.m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", ParticleEffectUI.k_MinEmitterAreaSize.x);
                this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y);
                this.InitAllEmitters(particleSystems);
                this.m_ShowOnlySelectedMode = (this.m_Owner is ParticleSystemWindow && SessionState.GetBool("ShowSelected" + root.GetInstanceID(), false));
                if (this.IsShowOnlySelectedMode())
                {
                    this.RefreshShowOnlySelected();
                }
                this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f);
                if (this.ShouldManagePlaybackState(root))
                {
                    Vector3 vector = SessionState.GetVector3("SimulationState" + root.GetInstanceID(), Vector3.zero);
                    if (root.GetInstanceID() == (int)vector.x)
                    {
                        float z = vector.z;
                        if (z > 0f)
                        {
                            ParticleSystemEditorUtils.editorPlaybackTime = z;
                        }
                    }
                    this.Play();
                }
                result = true;
            }
            return(result);
        }
 public void OnEnable()
 {
     m_TableHeight = SessionState.GetFloat(m_SerializationUID + s_TableHeight, 200);
 }
예제 #13
0
        public bool InitializeIfNeeded(IEnumerable <ParticleSystem> systems)
        {
            bool flag = false;

            ParticleSystem[] array          = systems.ToArray <ParticleSystem>();
            bool             flag2          = array.Count <ParticleSystem>() > 1;
            bool             flag3          = false;
            ParticleSystem   particleSystem = null;

            ParticleSystem[] array2 = array;
            int i = 0;

            while (i < array2.Length)
            {
                ParticleSystem particleSystem2 = array2[i];
                if (flag2)
                {
                    ParticleSystem[] array3 = new ParticleSystem[]
                    {
                        particleSystem2
                    };
                    particleSystem = particleSystem2;
                    goto IL_11F;
                }
                ParticleSystem root = ParticleSystemEditorUtils.GetRoot(particleSystem2);
                if (!(root == null))
                {
                    ParticleSystem[] array3 = ParticleEffectUI.GetParticleSystems(root);
                    particleSystem = root;
                    if (this.m_SelectedParticleSystems != null && this.m_SelectedParticleSystems.Count > 0)
                    {
                        if (root == ParticleSystemEditorUtils.GetRoot(this.m_SelectedParticleSystems[0]))
                        {
                            if (this.m_ParticleSystemCurveEditor != null && this.m_Emitters != null && array3.Length == this.m_Emitters.Length && particleSystem2.gameObject.activeInHierarchy == this.m_EmittersActiveInHierarchy)
                            {
                                this.m_SelectedParticleSystems = new List <ParticleSystem>();
                                this.m_SelectedParticleSystems.Add(particleSystem2);
                                if (this.IsShowOnlySelectedMode())
                                {
                                    this.RefreshShowOnlySelected();
                                }
                                goto IL_1E6;
                            }
                        }
                    }
                    goto IL_11F;
                }
IL_1E6:
                i++;
                continue;
IL_11F:
                if (this.m_ParticleSystemCurveEditor != null)
                {
                    this.Clear();
                }
                flag3 = true;
                if (!flag)
                {
                    this.m_SelectedParticleSystems = new List <ParticleSystem>();
                    flag = true;
                }
                this.m_SelectedParticleSystems.Add(particleSystem2);
                if (!flag2)
                {
                    this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    this.m_ParticleSystemCurveEditor.Init();
                    ParticleSystem[] array3;
                    int num = array3.Length;
                    if (num > 0)
                    {
                        this.m_Emitters = new ParticleSystemUI[num];
                        for (int j = 0; j < num; j++)
                        {
                            this.m_Emitters[j] = new ParticleSystemUI();
                            this.m_Emitters[j].Init(this, new ParticleSystem[]
                            {
                                array3[j]
                            });
                        }
                        this.m_EmittersActiveInHierarchy = particleSystem2.gameObject.activeInHierarchy;
                    }
                }
                goto IL_1E6;
            }
            if (flag3)
            {
                if (flag2)
                {
                    this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    this.m_ParticleSystemCurveEditor.Init();
                    int count = this.m_SelectedParticleSystems.Count;
                    if (count > 0)
                    {
                        this.m_Emitters    = new ParticleSystemUI[1];
                        this.m_Emitters[0] = new ParticleSystemUI();
                        this.m_Emitters[0].Init(this, this.m_SelectedParticleSystems.ToArray());
                        this.m_EmittersActiveInHierarchy = this.m_SelectedParticleSystems[0].gameObject.activeInHierarchy;
                    }
                }
                ParticleSystemUI[] emitters = this.m_Emitters;
                for (int k = 0; k < emitters.Length; k++)
                {
                    ParticleSystemUI particleSystemUI = emitters[k];
                    ModuleUI[]       modules          = particleSystemUI.m_Modules;
                    for (int l = 0; l < modules.Length; l++)
                    {
                        ModuleUI moduleUI = modules[l];
                        if (moduleUI != null)
                        {
                            moduleUI.Validate();
                        }
                    }
                }
                if (ParticleEffectUI.GetAllModulesVisible())
                {
                    this.SetAllModulesVisible(true);
                }
                this.m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", ParticleEffectUI.k_MinEmitterAreaSize.x);
                this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y);
                this.SetShowOnlySelectedMode(this.m_Owner is ParticleSystemWindow && SessionState.GetBool("ShowSelected" + particleSystem.GetInstanceID(), false));
                this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f);
                if (this.ShouldManagePlaybackState(particleSystem))
                {
                    Vector3 vector = SessionState.GetVector3("SimulationState" + particleSystem.GetInstanceID(), Vector3.zero);
                    if (particleSystem.GetInstanceID() == (int)vector.x)
                    {
                        float z = vector.z;
                        if (z > 0f)
                        {
                            ParticleSystemEditorUtils.playbackTime = z;
                            ParticleSystemEditorUtils.PerformCompleteResimulation();
                        }
                    }
                    if (ParticleEffectUI.m_MainPlaybackSystem != particleSystem)
                    {
                        this.Play();
                    }
                }
            }
            ParticleEffectUI.m_MainPlaybackSystem = particleSystem;
            return(flag3);
        }
예제 #14
0
        private void DrawMainToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            // Graph types
            Rect popupRect = GUILayoutUtility.GetRect(Styles.addArea, EditorStyles.toolbarDropDown, GUILayout.Width(Chart.kSideWidth));

            if (EditorGUI.DropdownButton(popupRect, Styles.addArea, FocusType.Passive, EditorStyles.toolbarDropDown))
            {
                int length   = m_Charts.Length;
                var names    = new string[length];
                var enabled  = new bool[length];
                var selected = new int[length];
                for (int c = 0; c < length; ++c)
                {
                    names[c]    = L10n.Tr(((ProfilerArea)c).ToString());
                    enabled[c]  = true;
                    selected[c] = m_Charts[c].active ? c : -1;
                }
                EditorUtility.DisplayCustomMenu(popupRect, names, enabled, selected, AddAreaClick, null);
            }

            // Engine attach
            ConnectionGUILayout.AttachToPlayerDropdown(m_AttachProfilerState, EditorStyles.toolbarDropDown);

            // Record
            var profilerEnabled = GUILayout.Toggle(m_Recording, m_Recording ? Styles.profilerRecordOn : Styles.profilerRecordOff, EditorStyles.toolbarButton);

            if (profilerEnabled != m_Recording)
            {
                ProfilerDriver.enabled = profilerEnabled;
                m_Recording            = profilerEnabled;
                SessionState.SetBool(kProfilerEnabledSessionKey, profilerEnabled);
            }

            FrameNavigationControls();

            using (new EditorGUI.DisabledScope(ProfilerDriver.lastFrameIndex == -1))
            {
                // Clear
                if (GUILayout.Button(Styles.clearData, EditorStyles.toolbarButton))
                {
                    Clear();
                }
            }

            // Separate File/Stream control elements from toggles
            GUILayout.FlexibleSpace();

            // Clear on Play
            SetClearOnPlay(GUILayout.Toggle(GetClearOnPlay(), Styles.clearOnPlay, EditorStyles.toolbarButton));

            using (new EditorGUI.DisabledScope(m_AttachProfilerState.connectedToTarget != ConnectionTarget.Editor))
            {
                // Deep profiling
                SetProfileDeepScripts(GUILayout.Toggle(ProfilerDriver.deepProfiling, Styles.deepProfile, EditorStyles.toolbarButton));
            }

            // Allocation callstacks
            AllocationCallstacksToolbarItem();

            // keep more space between the toggles and the overflow/help icon buttons on the far right, keep deep profiling closer to the other controls
            GUILayout.FlexibleSpace();
            GUILayout.FlexibleSpace();
            GUILayout.FlexibleSpace();

            // Load profile
            if (GUILayout.Button(Styles.loadProfilingData, EditorStyles.toolbarButton, GUILayout.MaxWidth(25)))
            {
                LoadProfilingData(Event.current.shift);
            }

            // Save profile
            using (new EditorGUI.DisabledScope(ProfilerDriver.lastFrameIndex == -1))
            {
                if (GUILayout.Button(Styles.saveProfilingData, EditorStyles.toolbarButton))
                {
                    SaveProfilingData();
                }
            }

            // Open Manual
            if (GUILayout.Button(Styles.helpButtonContent, EditorStyles.toolbarButton))
            {
                Application.OpenURL(Styles.linkToManual);
            }

            // Overflow Menu
            var overflowMenuRect = GUILayoutUtility.GetRect(Styles.optionsButtonContent, EditorStyles.toolbarButton);

            if (GUI.Button(overflowMenuRect, Styles.optionsButtonContent, EditorStyles.toolbarButton))
            {
                GenericMenu menu = new GenericMenu();
                menu.AddItem(Styles.accessibilityModeLabel, UserAccessiblitySettings.colorBlindCondition != ColorBlindCondition.Default, OnToggleColorBlindMode);
                menu.AddSeparator("");
                menu.AddItem(Styles.preferencesButtonContent, false, OpenProfilerPreferences);
                menu.DropDown(overflowMenuRect);
            }

            GUILayout.EndHorizontal();
        }
예제 #15
0
 public virtual void OnDisable()
 {
     SessionState.SetBool("ShowLightingEditor", this.m_ShowEditor);
 }
예제 #16
0
        // Should be called often to ensure we catch if selected Particle System is dragged in/out of root hierarchy
        public bool InitializeIfNeeded(IEnumerable <ParticleSystem> systems)
        {
            bool anyAdded = false;

            ParticleSystem[] allSystems     = systems.ToArray();
            bool             usingMultiEdit = (allSystems.Count() > 1);

            bool           initializeRequired = false;
            ParticleSystem mainSystem         = null;

            foreach (ParticleSystem shuriken in allSystems)
            {
                ParticleSystem[] shurikens;
                if (!usingMultiEdit)
                {
                    ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);
                    if (root == null)
                    {
                        continue;
                    }

                    shurikens  = GetParticleSystems(root);
                    mainSystem = root;

                    // Check if we need to re-initialize?
                    if (m_SelectedParticleSystems != null && m_SelectedParticleSystems.Count > 0)
                    {
                        if (root == ParticleSystemEditorUtils.GetRoot(m_SelectedParticleSystems[0]))
                        {
                            if (m_ParticleSystemCurveEditor != null && m_Emitters != null && shurikens.Length == m_Emitters.Length && shuriken.gameObject.activeInHierarchy == m_EmittersActiveInHierarchy)
                            {
                                m_SelectedParticleSystems = new List <ParticleSystem>();
                                m_SelectedParticleSystems.Add(shuriken);

                                if (IsShowOnlySelectedMode())
                                {
                                    RefreshShowOnlySelected(); // always refresh
                                }
                                continue;
                            }
                        }
                    }
                }
                else
                {
                    // in multi-edit mode, we explicitly choose the systems to edit, so don't automatically add child systems or search for the root
                    shurikens  = new ParticleSystem[] { shuriken };
                    mainSystem = shuriken;
                }

                // Cleanup before initializing
                if (m_ParticleSystemCurveEditor != null)
                {
                    Clear();
                }

                // Now initialize
                initializeRequired = true;
                if (!anyAdded)
                {
                    m_SelectedParticleSystems = new List <ParticleSystem>();
                    anyAdded = true;
                }
                m_SelectedParticleSystems.Add(shuriken);

                // Single edit emitter setup
                if (!usingMultiEdit)
                {
                    // Init CurveEditor before modules (they may add curves during construction)
                    m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    m_ParticleSystemCurveEditor.Init();

                    int numEmitters = shurikens.Length;
                    if (numEmitters > 0)
                    {
                        m_Emitters = new ParticleSystemUI[numEmitters];

                        for (int i = 0; i < numEmitters; ++i)
                        {
                            m_Emitters[i] = new ParticleSystemUI();
                            m_Emitters[i].Init(this, new ParticleSystem[] { shurikens[i] });
                        }

                        m_EmittersActiveInHierarchy = shuriken.gameObject.activeInHierarchy;
                    }
                }
            }

            if (initializeRequired)
            {
                // Multi-edit emitter setup
                if (usingMultiEdit)
                {
                    // Init CurveEditor before modules (they may add curves during construction)
                    m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    m_ParticleSystemCurveEditor.Init();

                    int numEmitters = m_SelectedParticleSystems.Count;
                    if (numEmitters > 0)
                    {
                        m_Emitters    = new ParticleSystemUI[1];
                        m_Emitters[0] = new ParticleSystemUI();
                        m_Emitters[0].Init(this, m_SelectedParticleSystems.ToArray());
                        m_EmittersActiveInHierarchy = m_SelectedParticleSystems[0].gameObject.activeInHierarchy;
                    }
                }

                // Allow modules to validate their state (the user can have moved emitters around in the hierarchy)
                foreach (ParticleSystemUI e in m_Emitters)
                {
                    foreach (ModuleUI m in e.m_Modules)
                    {
                        if (m != null)
                        {
                            m.Validate();
                        }
                    }
                }

                // Sync to state
                if (GetAllModulesVisible())
                {
                    SetAllModulesVisible(true);
                }

                m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", k_MinEmitterAreaSize.x);
                m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", k_MinCurveAreaSize.y);

                // For now only allow ShowOnlySelectedMode for ParticleSystemWindow
                SetShowOnlySelectedMode((m_Owner is ParticleSystemWindow) ? SessionState.GetBool(k_ShowSelectedId + mainSystem.GetInstanceID(), false) : false);

                m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0.0f);

                if (ShouldManagePlaybackState(mainSystem))
                {
                    // Restore lastPlayBackTime if available in session cache
                    Vector3 simulationState = SessionState.GetVector3(k_SimulationStateId + mainSystem.GetInstanceID(), Vector3.zero);
                    if (mainSystem.GetInstanceID() == (int)simulationState.x)
                    {
                        float lastPlayBackTime = simulationState.z;
                        if (lastPlayBackTime > 0f)
                        {
                            ParticleSystemEditorUtils.playbackTime = lastPlayBackTime;
                            ParticleSystemEditorUtils.PerformCompleteResimulation();
                        }
                    }

                    // Play when selecting a new particle effect
                    if (m_MainPlaybackSystem != mainSystem)
                    {
                        Play();
                    }
                }
            }

            m_MainPlaybackSystem = mainSystem;

            return(initializeRequired);
        }