Exemple #1
0
        public override void OnInspectorGUI()
        {
            bindingDefinition?.serializedObject.Update();

            DrawBindingsField();

            ExtraNaughtyEditorGUILayout.Header("Animation Parameters");
            DrawProfileField();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("_profileTransitionLength"),
                                           new GUIContent("Profile Transition Length",
                                                          "When changing profile, a blend transition will be done. This is the length of that transition."),
                                           0, Mathf.Infinity);

            ExtraNaughtyEditorGUILayout.Header("Master controls");
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("_masterAlpha"), 0, 1, QuadraticSliderDrawer.GetQuadraticFunction(2),
                                              new GUIContent("Master Alpha", "The profile's alpha values will be multiplied by this amount. \n" +
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target pose, while low values will treat the target pose more like a suggestion."));

            EditorGUILayout.Slider(serializedObject.FindProperty("_masterDampingRatio"), 0, 1,
                                   new GUIContent("Master Damping Ratio", "The profile's damping ratio values will be multiplied by this amount. \n" +
                                                  "A damping ratio of 1 will get to the target pose perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target pose."));

            EditorGUILayout.PropertyField(serializedObject.FindProperty("forceTargetPose"));
            ExtraNaughtyEditorGUILayout.Header("Debug Features (Editor Only)");
            if (serializedObject.isEditingMultipleObjects)
            {
                NaughtyEditorGUI.HelpBox_Layout("Multiple object editing isn't supported for debug features.", MessageType.Info, logToConsole: false);
            }
            else
            {
                using (new GUILayout.VerticalScope(GUI.skin.box))
                {
                    DoHideMeshField();
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (!currentDefinition)
            {
                throw new System.InvalidOperationException("BoneProfileOverrideDrawer.currentDefinition must be set before drawing an override.");
            }

            Rect controlRect = new Rect(position.position, new Vector2(position.width, EditorGUIUtility.singleLineHeight));

            BoneNamePopupDrawer.Draw(controlRect, property.FindPropertyRelative("bone.name"), currentDefinition, GUIContent.none);
            AdvanceOneLine();

            NonLinearSliderDrawer.Draw(controlRect, property.FindPropertyRelative("alpha"), 0, 1, NonLinearSliderDrawer.Function.Quadratic(2));
            AdvanceOneLine();

            EditorGUI.Slider(controlRect, property.FindPropertyRelative("dampingRatio"), 0, 1);


            void AdvanceOneLine()
            {
                controlRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            }
        }
Exemple #3
0
        protected override void DrawInspector()
        {
            mustRebuildOverrides = false;

            DrawDefinitionField();
            if (HasDefinition)
            {
                BoneProfileOverrideDrawer.SetCurrentRagdollDefinition(Definition);
            }
            else
            {
                NaughtyEditorGUI.HelpBox_Layout("You can assign a definition to be able to override individual bones.", MessageType.Info);
            }

            NaughtyEditorGUI.DrawHeader("Position Matching");
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("globalPositionAlpha"), 0, 1, NonLinearSliderDrawer.Function.Quadratic(2),
                                              new GUIContent("Global Alpha",
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target position, while low values will treat the target position more like a suggestion."));
            EditorGUILayout.Slider(serializedObject.FindProperty("globalPositionDampingRatio"), 0, 1,
                                   new GUIContent("Global Position Damping Ratio", "A damping ratio of 1 will get to the target position perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target position."));

            EditorGUI.BeginChangeCheck();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("globalMaxLinearAcceleration"), 0, Mathf.Infinity);
            if (EditorGUI.EndChangeCheck())
            {
                mustRebuildOverrides = true;
            }

            EditorGUILayout.Space();

            if (HasValidDefinition)
            {
                DrawOverrideList(positionMatchingOverridesList);
            }
            WarnAgainstUnstablePositionMatchingParameters();


            NaughtyEditorGUI.DrawHeader("Rotation Matching");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("matchRootRotation"));
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("globalRotationAlpha"), 0, 1, NonLinearSliderDrawer.Function.Quadratic(2),
                                              new GUIContent("Global Rotation Alpha",
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target rotation, while low values will treat the target rotation more like a suggestion."));

            EditorGUILayout.Slider(serializedObject.FindProperty("globalRotationDampingRatio"), 0, 1,
                                   new GUIContent("Global Rotation Damping Ratio", "A damping ratio of 1 will get to the target rotation perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target rotation."));

            EditorGUI.BeginChangeCheck();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("globalMaxAngularAcceleration"), 0, Mathf.Infinity);
            if (EditorGUI.EndChangeCheck())
            {
                mustRebuildOverrides = true;
            }

            EditorGUILayout.Space();

            if (HasValidDefinition)
            {
                DrawOverrideList(rotationMatchingOverridesList);
            }
            WarnAgainstPositionWithoutRotation();

            BoneProfileOverrideDrawer.SetCurrentRagdollDefinition(null);
        }