private static bool DrawSkeletonSubTree(Dictionary <Transform, bool> actualBones, AvatarSetupTool.BoneWrapper[] bones, Quaternion orientation, Transform tr, Bounds bounds) { if (!actualBones.ContainsKey(tr)) { return(false); } int num = 0; foreach (Transform tr1 in tr) { if (AvatarSkeletonDrawer.DrawSkeletonSubTree(actualBones, bones, orientation, tr1, bounds)) { ++num; } } if (!actualBones[tr] && num <= 1) { return(false); } int boneIndex = -1; if (bones != null) { for (int index = 0; index < bones.Length; ++index) { if ((Object)bones[index].bone == (Object)tr) { boneIndex = index; break; } } } bool flag = (double)AvatarSetupTool.GetBoneAlignmentError(bones, orientation, boneIndex) > 0.0; AvatarSkeletonDrawer.sPoseError |= flag; if (flag) { AvatarSkeletonDrawer.DrawPoseError(tr, bounds); Handles.color = AvatarSkeletonDrawer.kErrorColor; } else { Handles.color = boneIndex == -1 ? (actualBones[tr] ? AvatarSkeletonDrawer.kSkeletonColor : AvatarSkeletonDrawer.kDummyColor) : AvatarSkeletonDrawer.kHumanColor; } Handles.DoBoneHandle(tr, actualBones); if (Selection.activeObject == (Object)tr) { Handles.color = AvatarSkeletonDrawer.kSelectedColor; Handles.DoBoneHandle(tr, actualBones); } return(true); }
public static void DrawSkeleton(Transform reference, Dictionary <Transform, bool> actualBones, AvatarSetupTool.BoneWrapper[] bones) { if ((Object)reference == (Object)null || actualBones == null) { return; } AvatarSkeletonDrawer.sPoseError = false; Bounds bounds = new Bounds(); Renderer[] componentsInChildren = reference.root.GetComponentsInChildren <Renderer>(); if (componentsInChildren != null) { foreach (Renderer renderer in componentsInChildren) { bounds.Encapsulate(renderer.bounds.min); bounds.Encapsulate(renderer.bounds.max); } } Quaternion orientation = Quaternion.identity; if (bones != null) { orientation = AvatarSetupTool.AvatarComputeOrientation(bones); } AvatarSkeletonDrawer.DrawSkeletonSubTree(actualBones, bones, orientation, reference, bounds); Camera current = Camera.current; if (!AvatarSkeletonDrawer.sPoseError || !((Object)current != (Object)null)) { return; } GUIStyle style = new GUIStyle(GUI.skin.label); style.normal.textColor = Color.red; style.wordWrap = false; style.alignment = TextAnchor.MiddleLeft; style.fontSize = 20; GUIContent content = new GUIContent("Character is not in T pose"); Rect rect = GUILayoutUtility.GetRect(content, style); rect.x = 30f; rect.y = 30f; Handles.BeginGUI(); GUI.Label(rect, content, style); Handles.EndGUI(); }
public static void DrawSkeleton(Transform reference, Dictionary <Transform, bool> actualBones) { AvatarSkeletonDrawer.DrawSkeleton(reference, actualBones, (AvatarSetupTool.BoneWrapper[])null); }