IsAdded() public method

public IsAdded ( UnityEditor.SerializedProperty max ) : bool
max UnityEditor.SerializedProperty
return bool
Esempio n. 1
0
 protected virtual void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
     if (newState != this.m_VisibilityState)
     {
         if (newState == ModuleUI.VisibilityState.VisibleAndFolded)
         {
             ParticleSystemCurveEditor particleSystemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
             foreach (SerializedProperty current in this.m_ModuleCurves)
             {
                 if (particleSystemCurveEditor.IsAdded(current))
                 {
                     this.m_CurvesRemovedWhenFolded.Add(current);
                     particleSystemCurveEditor.SetVisible(current, false);
                 }
             }
             particleSystemCurveEditor.Refresh();
         }
         else if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
         {
             ParticleSystemCurveEditor particleSystemCurveEditor2 = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
             foreach (SerializedProperty current2 in this.m_CurvesRemovedWhenFolded)
             {
                 particleSystemCurveEditor2.SetVisible(current2, true);
             }
             this.m_CurvesRemovedWhenFolded.Clear();
             particleSystemCurveEditor2.Refresh();
         }
         this.m_VisibilityState = newState;
         SessionState.SetInt(base.GetUniqueModuleName(), (int)this.m_VisibilityState);
         if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
         {
             this.Init();
         }
     }
 }
Esempio n. 2
0
        public void RemoveCurveFromEditor()
        {
            ParticleSystemCurveEditor sce = m_Module.GetParticleSystemCurveEditor();

            if (sce.IsAdded(GetMinCurve(), maxCurve))
            {
                sce.RemoveCurve(GetMinCurve(), maxCurve);
            }
        }
        public void RemoveCurveFromEditor()
        {
            ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
        }
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor = true)
        {
            if (!this.stateHasMultipleDifferentValues)
            {
                if (newState == this.state)
                {
                    return;
                }
            }
            MinMaxCurveState          state = this.state;
            ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
                this.InitSingleScalar(state);
                break;

            case MinMaxCurveState.k_Curve:
                this.InitSingleCurve(state);
                break;

            case MinMaxCurveState.k_TwoCurves:
                this.InitDoubleCurves(state);
                break;

            case MinMaxCurveState.k_TwoScalars:
                this.InitDoubleScalars(state);
                break;
            }
            this.minMaxState.intValue = (int)newState;
            if (addToCurveEditor)
            {
                switch (newState)
                {
                case MinMaxCurveState.k_Scalar:
                case MinMaxCurveState.k_TwoScalars:
                    break;

                case MinMaxCurveState.k_Curve:
                case MinMaxCurveState.k_TwoCurves:
                    particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
                    break;

                default:
                    Debug.LogError("Unhandled enum value");
                    break;
                }
            }
            AnimationCurvePreviewCache.ClearCache();
        }
Esempio n. 5
0
        protected virtual void OnModuleDisable()
        {
            ParticleSystemCurveEditor particleSystemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();

            foreach (SerializedProperty current in this.m_ModuleCurves)
            {
                if (particleSystemCurveEditor.IsAdded(current))
                {
                    particleSystemCurveEditor.RemoveCurve(current);
                }
            }
        }
Esempio n. 6
0
        protected virtual void OnModuleDisable()
        {
            Undo.undoRedoPerformed -= UndoRedoPerformed;
            ParticleSystemCurveEditor psce = m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();

            foreach (SerializedProperty curveProp in m_ModuleCurves)
            {
                if (psce.IsAdded(curveProp))
                {
                    psce.RemoveCurve(curveProp);
                }
            }
        }
        public void ToggleCurveInEditor()
        {
            ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
            else
            {
                particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
            }
        }
Esempio n. 8
0
        public void ToggleCurveInEditor()
        {
            ParticleSystemCurveEditor sce = m_Module.GetParticleSystemCurveEditor();

            if (sce.IsAdded(GetMinCurve(), maxCurve))
            {
                sce.RemoveCurve(GetMinCurve(), maxCurve);
            }
            else
            {
                sce.AddCurve(CreateCurveData(sce.GetAvailableColor()));
            }
        }
Esempio n. 9
0
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor)
        {
            if (newState == state)
            {
                return;
            }

            MinMaxCurveState          oldState = state;
            ParticleSystemCurveEditor sce      = m_Module.GetParticleSystemCurveEditor();

            if (sce.IsAdded(GetMinCurve(), maxCurve))
            {
                sce.RemoveCurve(GetMinCurve(), maxCurve);
            }

            switch (newState)
            {
            case MinMaxCurveState.k_Curve: SetCurveRequirements(); break;

            case MinMaxCurveState.k_TwoCurves: SetCurveRequirements(); break;
            }

            // Assign state AFTER matching data to new state AND removing curve from curveEditor since it uses current 'state'
            minMaxState.intValue = (int)newState;

            if (addToCurveEditor)
            {
                // Add curve to CurveEditor if needed
                // Keep added to the editor if it was added before
                switch (newState)
                {
                case MinMaxCurveState.k_TwoCurves:
                case MinMaxCurveState.k_Curve:
                    sce.AddCurve(CreateCurveData(sce.GetAvailableColor()));
                    break;

                case MinMaxCurveState.k_Scalar:
                case MinMaxCurveState.k_TwoScalars:
                    // Scalar do not add anything to the curve editor
                    break;

                default:
                    Debug.LogError("Unhandled enum value");
                    break;
                }
            }

            // Ensure we draw new icons for properties
            UnityEditorInternal.AnimationCurvePreviewCache.ClearCache();
        }
        private void SetMinMaxState(MinMaxCurveState newState)
        {
            if (newState == this.state)
            {
                return;
            }
            MinMaxCurveState          state             = this.state;
            ParticleSystemCurveEditor systemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (systemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                systemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
                this.InitSingleScalar(state);
                break;

            case MinMaxCurveState.k_Curve:
                this.InitSingleCurve(state);
                break;

            case MinMaxCurveState.k_TwoCurves:
                this.InitDoubleCurves(state);
                break;

            case MinMaxCurveState.k_TwoScalars:
                this.InitDoubleScalars(state);
                break;
            }
            this.minMaxState.intValue = (int)newState;
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
            case MinMaxCurveState.k_TwoScalars:
                AnimationCurvePreviewCache.ClearCache();
                break;

            case MinMaxCurveState.k_Curve:
            case MinMaxCurveState.k_TwoCurves:
                systemCurveEditor.AddCurve(this.CreateCurveData(systemCurveEditor.GetAvailableColor()));
                goto case MinMaxCurveState.k_Scalar;

            default:
                Debug.LogError((object)"Unhandled enum value");
                goto case MinMaxCurveState.k_Scalar;
            }
        }
Esempio n. 11
0
        protected virtual void OnModuleDisable()
        {
            ParticleSystemCurveEditor systemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();

            using (List <SerializedProperty> .Enumerator enumerator = this.m_ModuleCurves.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SerializedProperty current = enumerator.Current;
                    if (systemCurveEditor.IsAdded(current))
                    {
                        systemCurveEditor.RemoveCurve(current);
                    }
                }
            }
        }
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor)
        {
            if (this.stateHasMultipleDifferentValues)
            {
                Debug.LogError("SetMinMaxState is not allowed with multiple different values");
            }
            else if (newState != this.state)
            {
                MinMaxCurveState          state = this.state;
                ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();
                if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
                {
                    particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
                }
                if (newState != MinMaxCurveState.k_Curve)
                {
                    if (newState == MinMaxCurveState.k_TwoCurves)
                    {
                        this.SetCurveRequirements();
                    }
                }
                else
                {
                    this.SetCurveRequirements();
                }
                this.minMaxState.intValue = (int)newState;
                if (addToCurveEditor)
                {
                    switch (newState)
                    {
                    case MinMaxCurveState.k_Scalar:
                    case MinMaxCurveState.k_TwoScalars:
                        break;

                    case MinMaxCurveState.k_Curve:
                    case MinMaxCurveState.k_TwoCurves:
                        particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
                        break;

                    default:
                        Debug.LogError("Unhandled enum value");
                        break;
                    }
                }
                AnimationCurvePreviewCache.ClearCache();
            }
        }
Esempio n. 13
0
 protected virtual void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
     if (newState == this.m_VisibilityState)
     {
         return;
     }
     if (newState == ModuleUI.VisibilityState.VisibleAndFolded)
     {
         ParticleSystemCurveEditor systemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
         using (List <SerializedProperty> .Enumerator enumerator = this.m_ModuleCurves.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 SerializedProperty current = enumerator.Current;
                 if (systemCurveEditor.IsAdded(current))
                 {
                     this.m_CurvesRemovedWhenFolded.Add(current);
                     systemCurveEditor.SetVisible(current, false);
                 }
             }
         }
         systemCurveEditor.Refresh();
     }
     else if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
     {
         ParticleSystemCurveEditor systemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
         using (List <SerializedProperty> .Enumerator enumerator = this.m_CurvesRemovedWhenFolded.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 SerializedProperty current = enumerator.Current;
                 systemCurveEditor.SetVisible(current, true);
             }
         }
         this.m_CurvesRemovedWhenFolded.Clear();
         systemCurveEditor.Refresh();
     }
     this.m_VisibilityState = newState;
     SessionState.SetInt(this.GetUniqueModuleName(), (int)this.m_VisibilityState);
     if (newState != ModuleUI.VisibilityState.VisibleAndFoldedOut)
     {
         return;
     }
     this.Init();
 }
Esempio n. 14
0
        protected virtual void SetVisibilityState(VisibilityState newState)
        {
            if (newState != m_VisibilityState)
            {
                if (newState == VisibilityState.VisibleAndFolded)
                {
                    // Remove curves from the curveeditor when closing modules (and put them back when folding out again)
                    ParticleSystemCurveEditor psce = m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
                    foreach (SerializedProperty curveProp in m_ModuleCurves)
                    {
                        if (psce.IsAdded(curveProp))
                        {
                            m_CurvesRemovedWhenFolded.Add(curveProp);
                            psce.SetVisible(curveProp, false);
                        }
                    }
                    psce.Refresh();
                }
                else if (newState == VisibilityState.VisibleAndFoldedOut)
                {
                    ParticleSystemCurveEditor psce = m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
                    foreach (SerializedProperty curveProp in m_CurvesRemovedWhenFolded)
                    {
                        psce.SetVisible(curveProp, true);
                    }
                    m_CurvesRemovedWhenFolded.Clear();
                    psce.Refresh();
                }

                m_VisibilityState = newState;
                foreach (Object obj in serializedObject.targetObjects)
                {
                    SessionState.SetInt(GetUniqueModuleName(obj), (int)m_VisibilityState);
                }

                if (newState == VisibilityState.VisibleAndFoldedOut)
                {
                    Init();
                }
            }
        }