private SetMinMaxState ( MinMaxCurveState newState ) : void | ||
newState | MinMaxCurveState | |
return | void |
private void SetMinMaxState(MinMaxCurveState newState)
{
if (newState != this.state)
{
MinMaxCurveState oldState = 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(oldState);
break;
case MinMaxCurveState.k_Curve:
this.InitSingleCurve(oldState);
break;
case MinMaxCurveState.k_TwoCurves:
this.InitDoubleCurves(oldState);
break;
case MinMaxCurveState.k_TwoScalars:
this.InitDoubleScalars(oldState);
break;
}
this.minMaxState.intValue = (int) newState;
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();
}
}
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); } }