// Draw the scene view handles
        void OnSceneGUI()
        {
            // Draw the scene veiw helpers
            if (!script.references.isValid)
            {
                return;
            }

            IKSolverFullBodyBipedInspector.AddScene(script.solver, color, true, ref selectedEffector, script.transform);
        }
        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();
        }
Beispiel #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();
        }
        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();
        }
        protected override SerializedContent[] FindContent()
        {
            references = serializedObject.FindProperty("references");

            return(IKSolverFullBodyBipedInspector.FindContent(solver));
        }