RemoveCurveFromEditor() public method

public RemoveCurveFromEditor ( ) : void
return void
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.BeginChangeCheck();
            bool separateAxes = GUIToggle(s_Texts.separateAxes, m_SeparateAxes);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (!separateAxes)
                {
                    m_Y.RemoveCurveFromEditor();
                    m_Z.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_X.stateHasMultipleDifferentValues)
            {
                m_Z.SetMinMaxState(m_X.state, separateAxes);
                m_Y.SetMinMaxState(m_X.state, separateAxes);
            }

            if (separateAxes)
            {
                m_X.m_DisplayName = s_Texts.x;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_X, s_Texts.y, m_Y, s_Texts.z, m_Z, null);
            }
            else
            {
                m_X.m_DisplayName = s_Texts.size;
                GUIMinMaxCurve(s_Texts.size, m_X);
            }
        }
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.BeginChangeCheck();
            bool separateAxes = GUIToggle(s_Texts.separateAxes, m_SeparateAxes);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (separateAxes)
                {
                    m_Magnitude.RemoveCurveFromEditor();
                }
                else
                {
                    m_X.RemoveCurveFromEditor();
                    m_Y.RemoveCurveFromEditor();
                    m_Z.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_X.stateHasMultipleDifferentValues)
            {
                m_Y.SetMinMaxState(m_X.state, separateAxes);
                m_Z.SetMinMaxState(m_X.state, separateAxes);
            }

            if (separateAxes)
            {
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_X, s_Texts.y, m_Y, s_Texts.z, m_Z, null);
                EditorGUI.indentLevel++;
                GUIBoolAsPopup(s_Texts.space, m_InWorldSpace, s_Texts.spaces);
                EditorGUI.indentLevel--;
            }
            else
            {
                GUIMinMaxCurve(s_Texts.magnitude, m_Magnitude);
            }

            EditorGUI.indentLevel++;
            GUIFloat(s_Texts.dampen, m_Dampen);
            EditorGUI.indentLevel--;

            GUIMinMaxCurve(s_Texts.drag, m_Drag);
            EditorGUI.indentLevel++;
            GUIToggle(s_Texts.multiplyDragByParticleSize, m_MultiplyDragByParticleSize);
            GUIToggle(s_Texts.multiplyDragByParticleVelocity, m_MultiplyDragByParticleVelocity);
            EditorGUI.indentLevel--;
        }
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.BeginChangeCheck();
            bool separateAxes = GUIToggle(s_Texts.separateAxes, m_SeparateAxes);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (!separateAxes)
                {
                    m_Y.RemoveCurveFromEditor();
                    m_Z.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_X.stateHasMultipleDifferentValues)
            {
                m_Z.SetMinMaxState(m_X.state, separateAxes);
                m_Y.SetMinMaxState(m_X.state, separateAxes);
            }

            MinMaxCurveState state = m_Z.state;

            if (separateAxes)
            {
                m_X.m_DisplayName = s_Texts.x;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_X, s_Texts.y, m_Y, s_Texts.z, m_Z, null);
            }
            else
            {
                m_X.m_DisplayName = s_Texts.size;
                GUIMinMaxCurve(s_Texts.size, m_X);
            }

            using (new EditorGUI.DisabledScope((state == MinMaxCurveState.k_Scalar) || (state == MinMaxCurveState.k_TwoScalars)))
            {
                GUIMinMaxRange(s_Texts.velocityRange, m_Range);
            }
        }
Esempio n. 4
0
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            GUIFloat(s_Texts.duration, m_LengthInSec, "f2");

            EditorGUI.BeginChangeCheck();
            bool looping = GUIToggle(s_Texts.looping, m_Looping);

            if (EditorGUI.EndChangeCheck() && looping)
            {
                foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems)
                {
                    if (ps.time >= ps.main.duration)
                    {
                        ps.time = 0.0f;
                    }
                }
            }

            using (new EditorGUI.DisabledScope(!m_Looping.boolValue))
            {
                GUIToggle(s_Texts.prewarm, m_Prewarm);
            }

            using (new EditorGUI.DisabledScope(m_Prewarm.boolValue && m_Looping.boolValue))
            {
                GUIMinMaxCurve(s_Texts.startDelay, m_StartDelay);
            }

            GUIMinMaxCurve(s_Texts.lifetime, m_LifeTime);
            GUIMinMaxCurve(s_Texts.speed, m_Speed);

            // Size
            EditorGUI.BeginChangeCheck();
            bool size3D = GUIToggle(s_Texts.size3D, m_Size3D);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (!size3D)
                {
                    m_SizeY.RemoveCurveFromEditor();
                    m_SizeZ.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_SizeX.stateHasMultipleDifferentValues)
            {
                m_SizeZ.SetMinMaxState(m_SizeX.state, size3D);
                m_SizeY.SetMinMaxState(m_SizeX.state, size3D);
            }

            if (size3D)
            {
                m_SizeX.m_DisplayName = s_Texts.x;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_SizeX, s_Texts.y, m_SizeY, s_Texts.z, m_SizeZ, null);
            }
            else
            {
                m_SizeX.m_DisplayName = s_Texts.size;
                GUIMinMaxCurve(s_Texts.size, m_SizeX);
            }

            // Rotation
            EditorGUI.BeginChangeCheck();
            bool rotation3D = GUIToggle(s_Texts.rotation3D, m_Rotation3D);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (!rotation3D)
                {
                    m_RotationX.RemoveCurveFromEditor();
                    m_RotationY.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_RotationZ.stateHasMultipleDifferentValues)
            {
                m_RotationX.SetMinMaxState(m_RotationZ.state, rotation3D);
                m_RotationY.SetMinMaxState(m_RotationZ.state, rotation3D);
            }

            if (rotation3D)
            {
                m_RotationZ.m_DisplayName = s_Texts.z;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_RotationX, s_Texts.y, m_RotationY, s_Texts.z, m_RotationZ, null);
            }
            else
            {
                m_RotationZ.m_DisplayName = s_Texts.rotation;
                GUIMinMaxCurve(s_Texts.rotation, m_RotationZ);
            }

            GUIFloat(s_Texts.randomizeRotationDirection, m_RandomizeRotationDirection);
            GUIMinMaxGradient(s_Texts.color, m_Color, false);

            GUIMinMaxCurve(s_Texts.gravity, m_GravityModifier);
            int space = GUIPopup(s_Texts.simulationSpace, m_SimulationSpace, s_Texts.simulationSpaces);

            if (space == 2 && m_CustomSimulationSpace != null)
            {
                GUIObject(s_Texts.customSimulationSpace, m_CustomSimulationSpace);
            }
            GUIFloat(s_Texts.simulationSpeed, m_SimulationSpeed);
            GUIBoolAsPopup(s_Texts.deltaTime, m_UseUnscaledTime, new string[] { "Scaled", "Unscaled" });

            bool anyNonMesh = m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault(o => !o.shape.enabled || (o.shape.shapeType != ParticleSystemShapeType.SkinnedMeshRenderer && o.shape.shapeType != ParticleSystemShapeType.MeshRenderer)) != null;

            if (anyNonMesh)
            {
                GUIPopup(s_Texts.scalingMode, m_ScalingMode, s_Texts.scalingModes);
            }

            bool oldPlayOnAwake = m_PlayOnAwake.boolValue;
            bool newPlayOnAwake = GUIToggle(s_Texts.autoplay, m_PlayOnAwake);

            if (oldPlayOnAwake != newPlayOnAwake)
            {
                m_ParticleSystemUI.m_ParticleEffectUI.PlayOnAwakeChanged(newPlayOnAwake);
            }

            GUIBoolAsPopup(s_Texts.emitterVelocity, m_EmitterVelocity, new string[] { "Transform", "Rigidbody" });

            GUIInt(s_Texts.maxParticles, m_MaxNumParticles);

            bool autoRandomSeed = GUIToggle(s_Texts.autoRandomSeed, m_AutoRandomSeed);

            if (!autoRandomSeed)
            {
                bool isInspectorView = m_ParticleSystemUI.m_ParticleEffectUI.m_Owner is ParticleSystemInspector;
                if (isInspectorView)
                {
                    GUILayout.BeginHorizontal();
                    GUIInt(s_Texts.randomSeed, m_RandomSeed);
                    if (!m_ParticleSystemUI.multiEdit && GUILayout.Button("Reseed", EditorStyles.miniButton, GUILayout.Width(60)))
                    {
                        m_RandomSeed.intValue = (int)m_ParticleSystemUI.m_ParticleSystems[0].GenerateRandomSeed();
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    GUIInt(s_Texts.randomSeed, m_RandomSeed);
                    if (!m_ParticleSystemUI.multiEdit && GUILayout.Button("Reseed", EditorStyles.miniButton))
                    {
                        m_RandomSeed.intValue = (int)m_ParticleSystemUI.m_ParticleSystems[0].GenerateRandomSeed();
                    }
                }
            }

            GUIPopup(s_Texts.stopAction, m_StopAction, s_Texts.stopActions);
            GUIPopup(s_Texts.cullingMode, m_CullingMode, s_Texts.cullingModes);

            ParticleSystemRingBufferMode ringBufferMode = (ParticleSystemRingBufferMode)GUIPopup(s_Texts.ringBufferMode, m_RingBufferMode, s_Texts.ringBufferModes);

            if (!m_RingBufferMode.hasMultipleDifferentValues && ringBufferMode == ParticleSystemRingBufferMode.LoopUntilReplaced)
            {
                EditorGUI.indentLevel++;
                GUIMinMaxRange(s_Texts.ringBufferLoopRange, m_RingBufferLoopRange);
                EditorGUI.indentLevel--;
            }
        }
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            // values take 1 frame to appear in the module, so delay our generation of the preview texture using this bool
            if (s_PreviewTextureDirty)
            {
                if (m_ParticleSystemUI.multiEdit)
                {
                    Color32[] pixels = new Color32[s_PreviewTexture.width * s_PreviewTexture.height];
                    for (int i = 0; i < pixels.Length; i++)
                    {
                        pixels[i] = new Color32(120, 120, 120, 255);
                    }
                    s_PreviewTexture.SetPixels32(pixels);
                    s_PreviewTexture.Apply(false);
                }
                else
                {
                    m_ParticleSystemUI.m_ParticleSystems[0].GenerateNoisePreviewTexture(s_PreviewTexture);
                }
                s_PreviewTextureDirty = false;
            }

            bool singleLine = !isWindowView && EditorGUIUtility.wideMode;

            if (singleLine)
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical();
            }

            EditorGUI.BeginChangeCheck();
            bool separateAxes        = GUIToggle(s_Texts.separateAxes, m_SeparateAxes);
            bool separateAxesChanged = EditorGUI.EndChangeCheck();

            EditorGUI.BeginChangeCheck();

            // Remove old curves from curve editor
            if (separateAxesChanged && !separateAxes)
            {
                m_StrengthY.RemoveCurveFromEditor();
                m_StrengthZ.RemoveCurveFromEditor();
                m_RemapY.RemoveCurveFromEditor();
                m_RemapZ.RemoveCurveFromEditor();
            }

            // Keep states in sync
            if (!m_StrengthX.stateHasMultipleDifferentValues)
            {
                m_StrengthZ.SetMinMaxState(m_StrengthX.state, separateAxes);
                m_StrengthY.SetMinMaxState(m_StrengthX.state, separateAxes);
            }
            if (!m_RemapX.stateHasMultipleDifferentValues)
            {
                m_RemapZ.SetMinMaxState(m_RemapX.state, separateAxes);
                m_RemapY.SetMinMaxState(m_RemapX.state, separateAxes);
            }

            if (separateAxes)
            {
                m_StrengthX.m_DisplayName = s_Texts.x;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_StrengthX, s_Texts.y, m_StrengthY, s_Texts.z, m_StrengthZ, null);
            }
            else
            {
                m_StrengthX.m_DisplayName = s_Texts.strength;
                GUIMinMaxCurve(s_Texts.strength, m_StrengthX);
            }

            GUIFloat(s_Texts.frequency, m_Frequency);
            GUIMinMaxCurve(s_Texts.scrollSpeed, m_ScrollSpeed);
            GUIToggle(s_Texts.damping, m_Damping);

            int numOctaves = GUIInt(s_Texts.octaves, m_Octaves);

            using (new EditorGUI.DisabledScope(numOctaves == 1))
            {
                GUIFloat(s_Texts.octaveMultiplier, m_OctaveMultiplier);
                GUIFloat(s_Texts.octaveScale, m_OctaveScale);
            }

            GUIPopup(s_Texts.quality, m_Quality, s_Texts.qualityDropdown);

            EditorGUI.BeginChangeCheck();
            bool remapEnabled        = GUIToggle(s_Texts.remap, m_RemapEnabled);
            bool remapEnabledChanged = EditorGUI.EndChangeCheck();

            // Remove old curves from curve editor
            if (remapEnabledChanged && !remapEnabled)
            {
                m_RemapX.RemoveCurveFromEditor();
                m_RemapY.RemoveCurveFromEditor();
                m_RemapZ.RemoveCurveFromEditor();
            }

            using (new EditorGUI.DisabledScope(remapEnabled == false))
            {
                if (separateAxes)
                {
                    m_RemapX.m_DisplayName = s_Texts.x;
                    GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_RemapX, s_Texts.y, m_RemapY, s_Texts.z, m_RemapZ, null);
                }
                else
                {
                    m_RemapX.m_DisplayName = s_Texts.remap;
                    GUIMinMaxCurve(s_Texts.remapCurve, m_RemapX);
                }
            }

            GUIMinMaxCurve(s_Texts.positionAmount, m_PositionAmount);
            GUIMinMaxCurve(s_Texts.rotationAmount, m_RotationAmount);
            GUIMinMaxCurve(s_Texts.sizeAmount, m_SizeAmount);

            if (singleLine)
            {
                GUILayout.EndVertical();
            }

            if (EditorGUI.EndChangeCheck() || m_ScrollSpeed.scalar.floatValue != 0.0f || remapEnabled || separateAxesChanged)
            {
                s_PreviewTextureDirty = true;
                m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
            }

            if (m_ParticleSystemUI.multiEdit)
            {
                GUILayout.Label(s_Texts.previewTextureMultiEdit, previewTextureStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
            }
            else
            {
                GUILayout.Label(s_Texts.previewTexture, previewTextureStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
            }

            if (singleLine)
            {
                GUILayout.EndHorizontal();
            }
        }