public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();

            Inspector.AddContent(fixTransforms);

            // Editing References
            if (BipedReferencesInspector.AddModifiedInspector(references))
            {
                if (!Application.isPlaying)
                {
                    Warning.logged = false;
                    BipedReferences.CheckSetup(script.references);
                    script.InitiateBipedIK();
                }
            }

            // Editing Solvers
            BipedIKSolversInspector.AddInspector(solvers, solversProps, solverContents);

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
        protected override void AddInspector()
        {
            // While in editor
            if (!Application.isPlaying)
            {
                // Editing References, if they have changed, reinitiate.
                if (BipedReferencesInspector.AddModifiedInspector(references))
                {
                    Initiate();
                }

                // Root Node
                IKSolverFullBodyBipedInspector.AddReferences(true, content);

                // Reinitiate if rootNode has changed
                if (serializedObject.ApplyModifiedProperties())
                {
                    Initiate();
                }
            }
            else
            {
                // While in play mode

                // Draw the references and the root node for UMA
                BipedReferencesInspector.AddModifiedInspector(references);
                IKSolverFullBodyBipedInspector.AddReferences(true, content);
            }

            if (IsValidAndInitiated())
            {
                // Draw the inspector for IKSolverFullBody
                IKSolverFullBodyBipedInspector.AddInspector(solver, !Application.isPlaying, false, content);
            }
            else
            {
                // Warning box
                EditorGUILayout.Space();
                EditorGUILayout.BeginHorizontal("Box");

                EditorGUILayout.LabelField("Invalid references, can't initiate solver.");

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();
        }
Exemple #3
0
        protected override void AddInspector()
        {
            // While in editor
            if (!Application.isPlaying)
            {
                // Editing References, if they have changed, reinitiate.
                if (BipedReferencesInspector.AddModifiedInspector(references))
                {
                    Initiate();
                    return;                     // Don't draw immediatelly to avoid errors
                }
                // Root Node
                IKSolverFullBodyBipedInspector.AddReferences(true, solver);

                // Reinitiate if rootNode has changed
                if (serializedObject.ApplyModifiedProperties())
                {
                    Initiate();
                    return;                     // Don't draw immediatelly to avoid errors
                }
            }
            else
            {
                // While in play mode

                // Draw the references and the root node for UMA
                BipedReferencesInspector.AddModifiedInspector(references);
                IKSolverFullBodyBipedInspector.AddReferences(true, solver);
            }

            string errorMessage = string.Empty;

            if (script.ReferencesError(ref errorMessage) || !script.solver.IsValid(ref errorMessage))
            {
                AddWarningBox(errorMessage);
                Warning.Log(errorMessage, script.transform, false);
            }
            else
            {
                // Draw the inspector for IKSolverFullBody
                IKSolverFullBodyBipedInspector.AddInspector(solver, false);
            }

            EditorGUILayout.Space();
        }
Exemple #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();

            Inspector.AddContent(fixTransforms);

            // Editing References
            if (BipedReferencesInspector.AddModifiedInspector(references))
            {
                if (!Application.isPlaying)
                {
                    Warning.logged = false;

                    if (ReferencesValid(false))
                    {
                        BipedReferences.CheckSetupWarning(script.references, true);

                        // Initiate only when inspector changed
                        script.InitiateBipedIK();
                    }
                }
            }

            if (ReferencesValid(Application.isPlaying))
            {
                // Editing Solvers
                BipedIKSolversInspector.AddInspector(solvers, solversProps);
            }
            else
            {
                // Warning box
                WarningBox();
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
        protected override void AddInspector()
        {
            if (!Application.isPlaying)
            {
                // Editing References, if they have changed, reinitiate.
                if (BipedReferencesInspector.AddModifiedInspector(references))
                {
                    Initiate();
                }

                if (script.references.isValid)
                {
                    IKSolverFullBodyBipedInspector.AddReferences(true, content);

                    // Draw the inspector for IKSolverFullBody
                    if (script.solver.IsValid(false))
                    {
                        IKSolverFullBodyBipedInspector.AddInspector(solver, !Application.isPlaying, false, content);
                    }
                }

                // Reinitiate if rootNode has changed
                if (serializedObject.ApplyModifiedProperties())
                {
                    Initiate();
                }
            }
            else
            {
                BipedReferencesInspector.AddModifiedInspector(references);
                IKSolverFullBodyBipedInspector.AddReferences(true, content);

                if (script.solver.initiated)
                {
                    IKSolverFullBodyBipedInspector.AddInspector(solver, !Application.isPlaying, false, content);
                }
            }

            EditorGUILayout.Space();
        }
Exemple #6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();

            Inspector.AddContent(fixTransforms);
            string message = string.Empty;

            // Editing References
            if (BipedReferencesInspector.AddModifiedInspector(references))
            {
                if (!Application.isPlaying)
                {
                    Warning.logged = false;

                    if (!BipedReferences.SetupError(script.references, ref message))
                    {
                        script.InitiateBipedIK();
                    }
                }
            }

            if (BipedReferences.SetupError(script.references, ref message))
            {
                // Warning box
                AddWarningBox(message);
                Warning.Log(message, script.transform, false);
            }
            else
            {
                // Editing Solvers
                BipedIKSolversInspector.AddInspector(solvers, solversProps);
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }