コード例 #1
0
        /*
         * Returns all solver SeiralizedProperties
         * */
        public static SerializedContent[] FindContent(SerializedProperty prop)
        {
            SerializedContent[] c = IKSolverHeuristicInspector.FindContent(prop);

            Array.Resize(ref c, c.Length + 4);
            c[c.Length - 4] = new SerializedContent(prop.FindPropertyRelative("transform"), new GUIContent("Aim Transform", "The transform that's you want to be aimed at IKPosition. Needs to be a lineal descendant of the bone hierarchy."));
            c[c.Length - 3] = new SerializedContent(prop.FindPropertyRelative("axis"), new GUIContent("Axis", "The local axis of the Transform that you want to be aimed at IKPosition."));
            c[c.Length - 2] = new SerializedContent(prop.FindPropertyRelative("clampWeight"), new GUIContent("Clamp Weight", "Clamping rotation of the solver. 0 is free rotation, 1 is completely clamped to transform axis."));
            c[c.Length - 1] = new SerializedContent(prop.FindPropertyRelative("clampSmoothing"), new GUIContent("Clamp Smoothing", "Number of sine smoothing iterations applied on clamping to make the clamping point smoother."));

            return(c);
        }
コード例 #2
0
ファイル: FABRIKInspector.cs プロジェクト: group8CA/AssignB5
 protected override SerializedContent[] FindContent()
 {
     return(IKSolverHeuristicInspector.FindContent(solver));
 }
コード例 #3
0
        public void OnEnable()
        {
            // Store the MonoScript for changing script execution order
            if (!Application.isPlaying)
            {
                MonoScript monoScript = MonoScript.FromMonoBehaviour(script);

                // Changing the script execution order to make sure BipedIK always executes after any other script except FullBodyBipedIK
                int executionOrder = MonoImporter.GetExecutionOrder(monoScript);
                if (executionOrder != 9998)
                {
                    MonoImporter.SetExecutionOrder(monoScript, 9998);
                }
            }

            references   = serializedObject.FindProperty("references");
            solvers      = serializedObject.FindProperty("solvers");
            solversProps = BipedIKSolversInspector.FindProperties(solvers);

            // Caching Solver Contents
            leftFootContent  = IKSolverLimbInspector.FindContent(solversProps[0]);
            rightFootContent = IKSolverLimbInspector.FindContent(solversProps[1]);
            leftHandContent  = IKSolverLimbInspector.FindContent(solversProps[2]);
            rightHandContent = IKSolverLimbInspector.FindContent(solversProps[3]);
            spineContent     = IKSolverHeuristicInspector.FindContent(solversProps[4]);
            aimContent       = IKSolverAimInspector.FindContent(solversProps[5]);
            lookAtContent    = IKSolverLookAtInspector.FindContent(solversProps[6]);
            pelvisContent    = ConstraintsInspector.FindContent(solversProps[7]);

            solverContents = new SerializedContent[8][] {
                leftFootContent, rightFootContent, leftHandContent, rightHandContent, spineContent, aimContent, lookAtContent, pelvisContent
            };

            // Automatically detecting references
            if (!Application.isPlaying)
            {
                if (script.references.isEmpty)
                {
                    BipedReferences.AutoDetectReferences(ref script.references, script.transform, new BipedReferences.AutoDetectParams(false, true));

                    references.isExpanded = true;
                    solvers.isExpanded    = false;
                    for (int i = 0; i < solversProps.Length; i++)
                    {
                        solversProps[i].isExpanded = false;
                    }

                    // Setting default values and initiating
                    script.InitiateBipedIK();
                    script.SetToDefaults();
                    EditorUtility.SetDirty(script);
                }
                else
                {
                    script.InitiateBipedIK();
                }

                Warning.logged = false;
                BipedReferences.CheckSetup(script.references);
            }
        }