Example #1
0
        void OnGUI()
        {
            if (!EUtil.IsUnityAnimationWindowOpen())
            {
                EditorGUILayout.LabelField("Animation Window is not open...");
                return;
            }

            // mode switch
            EditorGUILayout.BeginHorizontal();
            {
                EUtil.PushGUIEnable(m_OpMode != OpMode.AddPathPrefixOnMultiCurveBinding);
                if (EUtil.Button("Batch AddPrefix", Color.green))
                {
                    _OnOpModeChange(m_OpMode, OpMode.AddPathPrefixOnMultiCurveBinding);
                    m_OpMode = OpMode.AddPathPrefixOnMultiCurveBinding;
                }
                EUtil.PopGUIEnable();

                EUtil.PushGUIEnable(m_OpMode != OpMode.ChangePath);
                if (EUtil.Button("Change Path", Color.green))
                {
                    _OnOpModeChange(m_OpMode, OpMode.ChangePath);
                    m_OpMode = OpMode.ChangePath;
                }
                EUtil.PopGUIEnable();

                EUtil.PushGUIEnable(m_OpMode != OpMode.EditSingleCurveBinding);
                if (EUtil.Button("Edit Single Curve", Color.green))
                {
                    _OnOpModeChange(m_OpMode, OpMode.EditSingleCurveBinding);
                    m_OpMode = OpMode.EditSingleCurveBinding;
                }
                EUtil.PopGUIEnable();

                EUtil.PushGUIEnable(m_OpMode != OpMode.AddNewCurve);
                if (EUtil.Button("Add New Curve", Color.green))
                {
                    _OnOpModeChange(m_OpMode, OpMode.AddNewCurve);
                    m_OpMode = OpMode.AddNewCurve;
                }
                EUtil.PopGUIEnable();
            }
            EditorGUILayout.EndHorizontal();

            // specific GUI

            switch (m_OpMode)
            {
            case OpMode.AddPathPrefixOnMultiCurveBinding:
            {
                _GUI_BatchAddPrefix();
            }
            break;

            case OpMode.ChangePath:
            {
                _GUI_ChangePath();
            }
            break;

            case OpMode.EditSingleCurveBinding:
            {
                _GUI_EditSingleCurve();
            }
            break;

            case OpMode.AddNewCurve:
            {
                _GUI_AddNewCurve();
            }
            break;

            default:
                Dbg.LogErr("AnimCurvePropEditor.OnGUI: unexpected OpMode: {0}", m_OpMode);
                break;
            }
        }