public static void DrawBodyParts(Rect rect, int shownBodyView, BodyPartFeedback bodyPartCallback) { GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f); if (styles.Silhouettes[shownBodyView] != null) { GUI.DrawTexture(rect, styles.Silhouettes[shownBodyView].image); } for (int i = 1; i < 9; i++) { DrawBodyPart(shownBodyView, i, rect, bodyPartCallback((BodyPart) i)); } }
public static void DrawBodyParts(Rect rect, int shownBodyView, BodyPartFeedback bodyPartCallback) { GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f); if (styles.Silhouettes[shownBodyView] != null) { GUI.DrawTexture(rect, styles.Silhouettes[shownBodyView].image); } for (int i = 1; i < 9; i++) { DrawBodyPart(shownBodyView, i, rect, bodyPartCallback((BodyPart)i)); } }
static public int ShowBoneMapping(int shownBodyView, BodyPartFeedback bodyPartCallback, AvatarSetupTool.BoneWrapper[] bones, SerializedObject serializedObject, AvatarMappingEditor editor) { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (styles.Silhouettes[shownBodyView].image) { Rect rect = GUILayoutUtility.GetRect(styles.Silhouettes[shownBodyView], GUIStyle.none, GUILayout.MaxWidth(styles.Silhouettes[shownBodyView].image.width)); DrawBodyParts(rect, shownBodyView, bodyPartCallback); for (int i = 0; i < bones.Length; i++) { DrawBone(shownBodyView, i, rect, bones[i], serializedObject, editor); } } else { GUILayout.Label("texture missing,\nfix me!"); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); // Body view buttons Rect buttonsRect = GUILayoutUtility.GetLastRect(); const float buttonHeight = 18; string[] labels = new string[] { "Body", "Head", "Left Hand", "Right Hand" }; buttonsRect.x += 5; buttonsRect.width = 80; buttonsRect.yMin = buttonsRect.yMax - (buttonHeight * 4 + 5); buttonsRect.height = buttonHeight; for (int i = 0; i < labels.Length; i++) { if (GUI.Toggle(buttonsRect, shownBodyView == i, labels[i], EditorStyles.miniButton)) { shownBodyView = i; } buttonsRect.y += buttonHeight; } return(shownBodyView); }
public static int ShowBoneMapping(int shownBodyView, BodyPartFeedback bodyPartCallback, AvatarSetupTool.BoneWrapper[] bones, SerializedObject serializedObject, AvatarMappingEditor editor) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (styles.Silhouettes[shownBodyView].image != null) { GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth((float)styles.Silhouettes[shownBodyView].image.width) }; Rect rect = GUILayoutUtility.GetRect(styles.Silhouettes[shownBodyView], GUIStyle.none, options); DrawBodyParts(rect, shownBodyView, bodyPartCallback); for (int j = 0; j < bones.Length; j++) { DrawBone(shownBodyView, j, rect, bones[j], serializedObject, editor); } } else { GUILayout.Label("texture missing,\nfix me!", new GUILayoutOption[0]); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); Rect lastRect = GUILayoutUtility.GetLastRect(); string[] strArray = new string[] { "Body", "Head", "Left Hand", "Right Hand" }; lastRect.x += 5f; lastRect.width = 70f; lastRect.yMin = lastRect.yMax - 69f; lastRect.height = 16f; for (int i = 0; i < strArray.Length; i++) { if (GUI.Toggle(lastRect, shownBodyView == i, strArray[i], EditorStyles.miniButton)) { shownBodyView = i; } lastRect.y += 16f; } return(shownBodyView); }
public static int ShowBoneMapping(int shownBodyView, BodyPartFeedback bodyPartCallback, AvatarSetupTool.BoneWrapper[] bones, SerializedObject serializedObject, AvatarMappingEditor editor) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (styles.Silhouettes[shownBodyView].image != null) { GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth((float) styles.Silhouettes[shownBodyView].image.width) }; Rect rect = GUILayoutUtility.GetRect(styles.Silhouettes[shownBodyView], GUIStyle.none, options); DrawBodyParts(rect, shownBodyView, bodyPartCallback); for (int j = 0; j < bones.Length; j++) { DrawBone(shownBodyView, j, rect, bones[j], serializedObject, editor); } } else { GUILayout.Label("texture missing,\nfix me!", new GUILayoutOption[0]); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); Rect lastRect = GUILayoutUtility.GetLastRect(); string[] strArray = new string[] { "Body", "Head", "Left Hand", "Right Hand" }; lastRect.x += 5f; lastRect.width = 70f; lastRect.yMin = lastRect.yMax - 69f; lastRect.height = 16f; for (int i = 0; i < strArray.Length; i++) { if (GUI.Toggle(lastRect, shownBodyView == i, strArray[i], EditorStyles.miniButton)) { shownBodyView = i; } lastRect.y += 16f; } return shownBodyView; }