DrawPoseError() private static méthode

private static DrawPoseError ( Transform node, Bounds bounds ) : void
node UnityEngine.Transform
bounds UnityEngine.Bounds
Résultat void
Exemple #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);
        }
Exemple #2
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 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);
        }
        private static bool DrawSkeletonSubTree(Dictionary <Transform, bool> actualBones, AvatarSetupTool.BoneWrapper[] bones, Quaternion orientation, Transform tr, Bounds bounds)
        {
            bool result;

            if (!actualBones.ContainsKey(tr))
            {
                result = false;
            }
            else
            {
                int         num        = 0;
                IEnumerator enumerator = tr.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Transform tr2 = (Transform)enumerator.Current;
                        if (AvatarSkeletonDrawer.DrawSkeletonSubTree(actualBones, bones, orientation, tr2, bounds))
                        {
                            num++;
                        }
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                if (!actualBones[tr] && num <= 1)
                {
                    result = false;
                }
                else
                {
                    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);
                    }
                    result = true;
                }
            }
            return(result);
        }