public override void OnInspectorGUI()
    {
        if (!lc)
        {
            return;
        }

        //serializedObject.Update();

        // EditorGUIUtility.LookLikeControls(100);

        GUI.changed          = false;
        lc.groundPlaneHeight = EditorGUILayout.FloatField("Ground Height", lc.groundPlaneHeight);
        lc.groundedPose      = EditorGUILayout.ObjectField("Grounded Pose", lc.groundedPose, typeof(AnimationClip), false) as AnimationClip;
        lc.rootBone          = EditorGUILayout.ObjectField("Root Bone", lc.rootBone, typeof(Transform), false) as Transform;
        if (GUI.changed)
        {
            lc.initialized = false;
        }

        EditorGUILayout.Space();

        LegSectionGUI();

        AnimationSectionGUI();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Status: " + (lc.initialized ? "Initialized" : "Not initialized"), GUILayout.ExpandWidth(true));
        if (GUILayout.Button("Initialize"))
        {
            lc.Init();

            bool success = true;
            foreach (MotionAnalyzer analyzer in lc.sourceAnimations)
            {
                if (!SanityCheckAnimationCurves(lc, analyzer.animation))
                {
                    success = false;
                }
            }
            if (success)
            {
                lc.Init2();
            }
        }
        EditorGUILayout.EndHorizontal();
        if (GUI.changed)
        {
            EditorUtility.SetDirty(lc);
        }
        //  serializedObject.ApplyModifiedProperties();
    }
예제 #2
0
    static void DoToggle()
    {
        Debug.Log("Menu item selected");
        GameObject    activeGO = Selection.activeGameObject;
        LegController legC     = activeGO.GetComponent(typeof(LegController)) as LegController;

        legC.Init();

        bool success = true;

        foreach (MotionAnalyzer analyzer in legC.sourceAnimations)
        {
            if (!SanityCheckAnimationCurves(legC, analyzer.animation))
            {
                success = false;
            }
        }
        if (!success)
        {
            return;
        }

        legC.Init2();
    }