コード例 #1
0
        /*
         * Draws the scene view helpers for IKSolverLimb
         * */
        public static void AddScene(IKSolverLimb solver, Color color, bool modifiable)
        {
            if (Application.isPlaying && !solver.initiated)
            {
                return;
            }
            if (!Application.isPlaying && !solver.IsValid())
            {
                return;
            }

            if (solver.bendGoal != null && solver.bendModifierWeight > 0f)
            {
                Color c = color;
                c.a           = solver.bendModifierWeight;
                Handles.color = c;

                Handles.DrawLine(solver.bone2.transform.position, solver.bendGoal.position);
                Inspector.SphereCap(0, solver.bendGoal.position, Quaternion.identity, GetHandleSize(solver.bendGoal.position) * 0.5f);

                Handles.color = Color.white;
            }

            IKSolverTrigonometricInspector.AddScene(solver as IKSolverTrigonometric, color, modifiable);
        }
コード例 #2
0
        /*
         * Draws the custom inspector for IKSolverLimb
         * */
        public static void AddInspector(SerializedProperty prop, bool editHierarchy, bool showReferences)
        {
            // Draw the trigonometric IK inspector
            IKSolverTrigonometricInspector.AddInspector(prop, editHierarchy, showReferences);

            EditorGUILayout.Space();

            if (showReferences && editHierarchy)
            {
                EditorGUILayout.PropertyField(prop.FindPropertyRelative("goal"), new GUIContent("Avatar IK Goal", "Avatar IK Goal here is only used by the 'Arm' bend modifier."));
            }

            EditorGUILayout.PropertyField(prop.FindPropertyRelative("maintainRotationWeight"), new GUIContent("Maintain Rotation", "Weight of rotating the last bone back to the rotation it had before solving IK."));

            // Bend normal modifier.
            EditorGUILayout.PropertyField(prop.FindPropertyRelative("bendModifier"), new GUIContent("Bend Modifier", "Bend normal modifier."));
            EditorGUILayout.PropertyField(prop.FindPropertyRelative("bendModifierWeight"), new GUIContent("Bend Modifier Weight", "Weight of the bend modifier."));

            if (prop.FindPropertyRelative("bendModifier").enumValueIndex == 4)
            {
                EditorGUILayout.PropertyField(prop.FindPropertyRelative("bendGoal"), new GUIContent("Bend Goal", "The bend goal Transform (optional, you can also use IKSolverTrigonometric.SetBendGoalPosition(Vector position, float weight)."));
            }

            EditorGUILayout.Space();
        }
コード例 #3
0
        /*
         * Draws the scene view helpers for IKSolverLimb
         * */
        public static void AddScene(IKSolverLimb solver, Color color, bool modifiable)
        {
            if (Application.isPlaying && !solver.initiated)
            {
                return;
            }

            IKSolverTrigonometricInspector.AddScene(solver as IKSolverTrigonometric, color, modifiable);
        }
コード例 #4
0
        protected override void AddInspector()
        {
            // Draw the inspector for IKSolverTrigonometric
            IKSolverTrigonometricInspector.AddInspector(solver, !Application.isPlaying, true);

            // Warning box
            if (!script.solver.IsValid(false))
            {
                AddWarningBox(script.solver);
            }
        }
コード例 #5
0
        /*
         * Returns all solver SeiralizedProperties
         * */
        public static SerializedContent[] FindContent(SerializedProperty prop)
        {
            SerializedContent[] c = IKSolverTrigonometricInspector.FindContent(prop);
            Array.Resize(ref c, c.Length + 4);

            c[c.Length - 1] = new SerializedContent(prop.FindPropertyRelative("goal"), new GUIContent("Avatar IK Goal", "Avatar IK Goal here is only used by the 'Arm' bend modifier."));
            c[c.Length - 2] = new SerializedContent(prop.FindPropertyRelative("maintainRotationWeight"), new GUIContent("Maintain Rotation Weight", "Weight of rotating the last bone back to the rotation it had before solving IK."));
            c[c.Length - 3] = new SerializedContent(prop.FindPropertyRelative("bendModifier"), new GUIContent("Bend Modifier", "Bend normal modifier."));
            c[c.Length - 4] = new SerializedContent(prop.FindPropertyRelative("bendModifierWeight"), new GUIContent("Bend Modifier Weight", "Weight of the bend modifier."));

            return(c);
        }
コード例 #6
0
        protected override void AddInspector()
        {
            // Draw the inspector for IKSolverTrigonometric
            IKSolverTrigonometricInspector.AddInspector(solver, !Application.isPlaying, true);

            // Warning box
            string message = string.Empty;

            if (!script.solver.IsValid(ref message))
            {
                AddWarningBox(message);
            }
        }
コード例 #7
0
        /*
         * Draws the custom inspector for IKSolverLimb
         * */
        public static void AddInspector(SerializedProperty prop, bool editHierarchy, bool showReferences, SerializedContent[] content)
        {
            // Draw the trigonometric IK inspector
            IKSolverTrigonometricInspector.AddInspector(prop, editHierarchy, showReferences, content);

            EditorGUILayout.Space();

            if (showReferences && editHierarchy)
            {
                AddContent(content[content.Length - 1]);
            }
            AddClampedFloat(content[content.Length - 2]);

            // Bend normal modifier.
            AddContent(content[content.Length - 3]);
            AddClampedFloat(content[content.Length - 4]);

            EditorGUILayout.Space();
        }
コード例 #8
0
 void OnSceneGUI()
 {
     // Draw the scene veiw helpers
     IKSolverTrigonometricInspector.AddScene(script.solver, new Color(0f, 1f, 1f, 1f), true);
 }
コード例 #9
0
 protected override void AddInspector()
 {
     // Draw the inspector for IKSolverTrigonometric
     IKSolverTrigonometricInspector.AddInspector(solver, !Application.isPlaying, true, content);
 }
コード例 #10
0
 protected override SerializedContent[] FindContent()
 {
     return(IKSolverTrigonometricInspector.FindContent(solver));
 }
コード例 #11
0
 /*
  * Draws the scene view helpers for IKSolverLimb
  * */
 public static void AddScene(IKSolverLimb solver, Color color, bool modifiable)
 {
     IKSolverTrigonometricInspector.AddScene(solver as IKSolverTrigonometric, color, modifiable);
 }