UnityEditor.AvatarSkeletonDrawer.DrawSkeletonSubTree C# (CSharp) Method

DrawSkeletonSubTree() private static method

private static DrawSkeletonSubTree ( bool>.Dictionary actualBones, AvatarSetupTool bones, Quaternion orientation, Transform tr, Bounds bounds ) : bool
actualBones bool>.Dictionary
bones AvatarSetupTool
orientation UnityEngine.Quaternion
tr UnityEngine.Transform
bounds UnityEngine.Bounds
return bool
        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;
            IEnumerator enumerator = tr.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Transform current = (Transform) enumerator.Current;
                    if (DrawSkeletonSubTree(actualBones, bones, orientation, current, bounds))
                    {
                        num++;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (!actualBones[tr] && (num <= 1))
            {
                return false;
            }
            int boneIndex = -1;
            if (bones != null)
            {
                for (int i = 0; i < bones.Length; i++)
                {
                    if (bones[i].bone == tr)
                    {
                        boneIndex = i;
                        break;
                    }
                }
            }
            bool flag2 = AvatarSetupTool.GetBoneAlignmentError(bones, orientation, boneIndex) > 0f;
            sPoseError |= flag2;
            if (flag2)
            {
                DrawPoseError(tr, bounds);
                Handles.color = kErrorColor;
            }
            else if (boneIndex != -1)
            {
                Handles.color = kHumanColor;
            }
            else if (!actualBones[tr])
            {
                Handles.color = kDummyColor;
            }
            else
            {
                Handles.color = kSkeletonColor;
            }
            Handles.DoBoneHandle(tr, actualBones);
            if (Selection.activeObject == tr)
            {
                Handles.color = kSelectedColor;
                Handles.DoBoneHandle(tr, actualBones);
            }
            return true;
        }
    }

Usage Example

示例#1
0
        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 tr2 in tr)
            {
                if (AvatarSkeletonDrawer.DrawSkeletonSubTree(actualBones, bones, orientation, tr2, bounds))
                {
                    num++;
                }
            }
            if (!actualBones[tr] && num <= 1)
            {
                return(false);
            }
            int num2 = -1;

            if (bones != null)
            {
                for (int i = 0; i < bones.Length; i++)
                {
                    if (bones[i].bone == tr)
                    {
                        num2 = i;
                        break;
                    }
                }
            }
            bool flag = AvatarSetupTool.GetBoneAlignmentError(bones, orientation, num2) > 0f;

            AvatarSkeletonDrawer.sPoseError |= flag;
            if (flag)
            {
                AvatarSkeletonDrawer.DrawPoseError(tr, bounds);
                Handles.color = AvatarSkeletonDrawer.kErrorColor;
            }
            else if (num2 != -1)
            {
                Handles.color = AvatarSkeletonDrawer.kHumanColor;
            }
            else if (!actualBones[tr])
            {
                Handles.color = AvatarSkeletonDrawer.kDummyColor;
            }
            else
            {
                Handles.color = AvatarSkeletonDrawer.kSkeletonColor;
            }
            Handles.DoBoneHandle(tr, actualBones);
            if (Selection.activeObject == tr)
            {
                Handles.color = AvatarSkeletonDrawer.kSelectedColor;
                Handles.DoBoneHandle(tr, actualBones);
            }
            return(true);
        }
All Usage Examples Of UnityEditor.AvatarSkeletonDrawer::DrawSkeletonSubTree