public override void OnInspectorGUI() { HumanMuscle script = target as HumanMuscle; if (!EditorApplication.isPlaying) { script.animator = (Animator)EditorGUILayout.ObjectField("Animator", script.animator, typeof(Animator), true); script.scriptableObject = (HumanMuscleScriptableObject)EditorGUILayout.ObjectField("ScriptableObject", script.scriptableObject, typeof(HumanMuscleScriptableObject), true); } else { menuName = (MenuName)EditorGUILayout.EnumPopup("MenuName", menuName); switch (menuName) { case MenuName.All: ViewAllMenu(script); break; case MenuName.Body: ViewBodyMenu(script); break; case MenuName.Finger: ViewFingerMenu(script); break; } if (menuName == MenuName.All || boneName == RootBone.GetInstance()) { // 位置と角度 script.Position = transGUI.Position(script.Position); script.Angle = transGUI.Angle(); } else { if (boneName != null) { foreach (var key in boneName.Muscles) { var id = (HumanMuscleKey)key.Id; script[id] = EditorGUILayout.Slider((id).ToString(), script[id], -1, 1); } // 反転コピー if (GUILayout.Button("Mirror")) { boneName.Mirror(script.Muscles); } } } } EditorUtility.SetDirty(target); }
private void ViewBodyMenu(HumanMuscle script) { GUILayout.BeginHorizontal(); EditorGUILayout.Space(); BoneNameButton(HeadBone.GetInstance(), 100); EditorGUILayout.Space(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); BoneNameButton(ShoulderLeftBone.GetInstance()); BoneNameButton(NeckBone.GetInstance(), 80); BoneNameButton(ShoulderRightBone.GetInstance()); EditorGUILayout.Space(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BoneNameButton(UpperArmLeftBone.GetInstance()); EditorGUILayout.Space(); BoneNameButton(UpperChestBone.GetInstance(), 100); EditorGUILayout.Space(); BoneNameButton(UpperArmRightBone.GetInstance()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BoneNameButton(LowerArmLeftBone.GetInstance()); EditorGUILayout.Space(); BoneNameButton(ChestBone.GetInstance(), 100); EditorGUILayout.Space(); BoneNameButton(LowerArmRightBone.GetInstance()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BoneNameButton(HandLeftBone.GetInstance(), 100); EditorGUILayout.Space(); BoneNameButton(SpineBone.GetInstance(), 100); EditorGUILayout.Space(); BoneNameButton(HandRightBone.GetInstance(), 100); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); BoneNameButton(RootBone.GetInstance(), 100); EditorGUILayout.Space(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); BoneNameButton(UpperLegLeftBone.GetInstance(), 150); BoneNameButton(UpperLegRightBone.GetInstance(), 150); EditorGUILayout.Space(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); BoneNameButton(LowerLegLeftBone.GetInstance(), 150); EditorGUILayout.Space(); BoneNameButton(LowerLegRightBone.GetInstance(), 150); EditorGUILayout.Space(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BoneNameButton(FootLeftBone.GetInstance(), 150); EditorGUILayout.Space(); BoneNameButton(FootRightBone.GetInstance(), 150); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BoneNameButton(ToesLeftBone.GetInstance(), 150); EditorGUILayout.Space(); BoneNameButton(ToesRightBone.GetInstance(), 150); GUILayout.EndHorizontal(); }