Example #1
0
 private void SetupPoseTransition(MusclePose pose)
 {
     ClearSavedMuscles();
     for (int i = 0; i < pose.Pose.Count; i++)
     {
         var muscle      = _musclePool.New();
         var savedMuscle = pose.Pose[i];
         muscle.Set(savedMuscle, Animator.HumanPose.muscles[savedMuscle.MuscleIndex]);
         _currentMuscles.Add(muscle);
     }
 }
Example #2
0
        public override bool DrawGui(GUIStyle textStyle, GUIStyle buttonStyle)
        {
#if UNITY_EDITOR
            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            TargetPose = UnityEditor.EditorGUILayout.ObjectField(TargetPose, typeof(MusclePose), false) as MusclePose;
            Curve      = UnityEditor.EditorGUILayout.CurveField(Curve);
            GUILayout.Space(20);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            Duration = UnityEditor.EditorGUILayout.Slider(Duration, 0, 2);
            GUILayout.Space(20);
            GUILayout.EndHorizontal();
#endif
            return(false);
        }
Example #3
0
        public override bool DrawGui(GUIStyle textStyle, GUIStyle buttonStyle)
        {
#if UNITY_EDITOR
            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            GUILayout.Label("Default: ");
            Default = UnityEditor.EditorGUILayout.ObjectField(Default, typeof(MusclePose), false) as MusclePose;
            Curve   = UnityEditor.EditorGUILayout.CurveField(Curve);
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            Duration = UnityEditor.EditorGUILayout.Slider(Duration, 0, 2);
            GUILayout.Label("Variable: ");
            var graphLabels = GraphVariables.GetValues();
            var index       = System.Array.IndexOf(graphLabels, VariableName);
            var newVar      = UnityEditor.EditorGUILayout.Popup(
                index, graphLabels, buttonStyle, new[] {
                GUILayout.MaxWidth
                    (StateGraphNode.DefaultNodeSize.x * 0.5f)
            });
            if (newVar != index)
            {
                VariableName = graphLabels[newVar];
            }
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            for (int i = 0; i < TargetPoses.Count; i++)
            {
                if (Values.Count <= i)
                {
                    Values.Add("");
                    Rect.size = GetNodeSize;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(20);
                GUILayout.Label("Case:");
                Values[i]      = GUILayout.TextField(Values[i], textStyle);
                TargetPoses[i] = UnityEditor.EditorGUILayout.ObjectField(TargetPoses[i], typeof(MusclePose), false) as MusclePose;
                if (GUILayout.Button("X"))
                {
                    TargetPoses.RemoveAt(i);
                    Values.RemoveAt(i);
                    CheckSize();
                    GUILayout.Space(20);
                    GUILayout.EndHorizontal();
                    break;
                }
                GUILayout.Space(20);
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            if (GUILayout.Button("Add Pose"))
            {
                TargetPoses.Add(null);
                CheckSize();
            }
            GUILayout.Space(20);
            GUILayout.EndHorizontal();
#endif
            return(false);
        }