public static void DrawProfile(SerializedObject profile) { EditorGUI.BeginChangeCheck(); EditorGUILayout.Space(); EditorGUILayout.LabelField("<b>Controller Profile Values:</b>", RagdollEditor.labelStyle); RagdollEditor.StartBox(); EditorGUI.indentLevel++; SerializedProperty boneProfiles = profile.FindProperty("bones"); RagdollEditor.StartBox(); for (int i = 0; i < boneProfiles.arraySize; i++) { if (i == 3 || i == 7) { EditorGUILayout.EndVertical(); EditorGUILayout.Space(); RagdollEditor.StartBox(); } SerializedProperty boneProfile = boneProfiles.GetArrayElementAtIndex(i); SerializedProperty bone = boneProfile.FindPropertyRelative("bone"); showBones[i] = EditorGUILayout.Foldout(showBones[i], "<b>" + bone.enumDisplayNames[bone.enumValueIndex] + ":</b>", RagdollEditor.foldoutStyle); if (showBones[i]) { DrawPropertiesBlock(boneProfile, i == 0 ? new string[] { "fallForceDecay" } : new string[] { "fallForceDecay", "fallTorqueDecay" }); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); DrawBoneProfileNeighbors(boneProfile.FindPropertyRelative("neighbors"), (HumanBodyBones)bone.enumValueIndex); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); DrawPropertiesBlock(profile, "Falling", new string[] { "maxTorque", "fallDecaySpeed", "maxGravityAddVelocity", "loseFollowDot" }); DrawPropertiesBlock(profile, "Get Up", new string[] { "ragdollMinTime", "settledSpeed", "orientateDelay", "checkGroundMask", "blendTime" }); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); EditorGUI.indentLevel--; EditorGUILayout.Space(); if (EditorGUI.EndChangeCheck()) { profile.ApplyModifiedProperties(); EditorUtility.SetDirty(profile.targetObject); } }
public static void DrawProfile(SerializedObject profile) { EditorGUI.BeginChangeCheck(); EditorGUILayout.Space(); EditorGUILayout.LabelField("<b>Profile Values:</b>", RagdollEditor.labelStyle); RagdollEditor.StartBox(); EditorGUI.indentLevel++; RagdollEditor.StartBox(); SerializedProperty boneProfiles = profile.FindProperty("bones"); for (int i = 0; i < boneProfiles.arraySize; i++) { if (i == 3 || i == 7) { EditorGUILayout.EndVertical(); EditorGUILayout.Space(); RagdollEditor.StartBox(); } SerializedProperty boneProfile = boneProfiles.GetArrayElementAtIndex(i); SerializedProperty bone = boneProfile.FindPropertyRelative("bone"); showBones[i] = EditorGUILayout.Foldout(showBones[i], "<b>" + bone.enumDisplayNames[bone.enumValueIndex] + ":</b>", RagdollEditor.foldoutStyle); if (showBones[i]) { EditorGUI.indentLevel++; //joints if (i != 0) { DrawPropertiesBlock(boneProfile, "Joints", new string[] { "angularXLimit", "angularYLimit", "angularZLimit", "forceOff", "axis1", "axis2" }, ref showJointOptions); } //rigidbody DrawPropertiesBlock(boneProfile, "Rigidbody", new string[] { "mass", "angularDrag", "drag", "maxAngularVelocity", "interpolation", "collisionDetection", "maxDepenetrationVelocity" }, ref showRBOptions); //collider bool isBox = i < 2; DrawPropertiesBlock(boneProfile, "Collider", isBox ? new string[] { "boxZOffset", "boxZSize", "colliderMaterial" } : new string[] { "colliderRadius", "colliderMaterial" }, ref showColliderOptions); EditorGUI.indentLevel--; } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(profile.FindProperty("headOffset")); EditorGUILayout.Space(); EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); EditorGUILayout.Space(); if (EditorGUI.EndChangeCheck()) { profile.ApplyModifiedProperties(); EditorUtility.SetDirty(profile.targetObject); } }