Beispiel #1
0
        internal static void BipedPose(GameObject go, AvatarSetupTool.BoneWrapper[] bones)
        {
            AvatarBipedMapper.BipedPose(go.transform, true);
            Quaternion rotation = AvatarSetupTool.AvatarComputeOrientation(bones);

            go.transform.rotation = Quaternion.Inverse(rotation) * go.transform.rotation;
            AvatarSetupTool.MakeCharacterPositionValid(bones);
        }
        public static void DrawSkeleton(Transform reference, Dictionary <Transform, bool> actualBones, AvatarSetupTool.BoneWrapper[] bones, Handles.BoneRenderer boneRenderer)
        {
            // it can happen when the avatar tool is in edit mode and the user exit the tool in an unsual way
            //  new scene
            //  delete GO
            //  press play
            if (reference == null || actualBones == null)
            {
                return;
            }

            sPoseError = false;

            Bounds meshBounds = new Bounds();

            Renderer[] renderers = reference.root.GetComponentsInChildren <Renderer>();
            if (renderers != null)
            {
                foreach (Renderer renderer in renderers)
                {
                    meshBounds.Encapsulate(renderer.bounds.min);
                    meshBounds.Encapsulate(renderer.bounds.max);
                }
            }

            Quaternion orientation = Quaternion.identity;

            if (bones != null)
            {
                orientation = AvatarSetupTool.AvatarComputeOrientation(bones);
            }

            boneRenderer.ClearInstances();
            DrawSkeletonSubTree(actualBones, bones, orientation, reference, meshBounds, boneRenderer);
            boneRenderer.Render();

            Camera camera = Camera.current;

            if (sPoseError && camera != null)
            {
                GUIStyle style = new GUIStyle(GUI.skin.label);
                style.normal.textColor = Color.red;
                style.wordWrap         = false;
                style.alignment        = TextAnchor.MiddleLeft;
                style.fontSize         = 20;

                GUIContent content = EditorGUIUtility.TrTextContent("Character is not in T pose");

                Rect rect = GUILayoutUtility.GetRect(content, style);

                rect.x = 30;
                rect.y = 30; //camera.pixelHeight;

                Handles.BeginGUI();
                GUI.Label(rect, content, style);
                Handles.EndGUI();
            }
        }
Beispiel #3
0
        internal static void BipedPose(GameObject go, AvatarSetupTool.BoneWrapper[] bones)
        {
            BipedPose(go.transform, true);

            // Orient Biped
            Quaternion rot = AvatarSetupTool.AvatarComputeOrientation(bones);

            go.transform.rotation = Quaternion.Inverse(rot) * go.transform.rotation;

            // Move Biped feet to ground plane
            AvatarSetupTool.MakeCharacterPositionValid(bones);
        }
Beispiel #4
0
        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, AvatarSetupTool.BoneWrapper[] bones)
 {
     if (!(reference == null) && actualBones != null)
     {
         AvatarSkeletonDrawer.sPoseError = false;
         Bounds     bounds = default(Bounds);
         Renderer[] componentsInChildren = reference.root.GetComponentsInChildren <Renderer>();
         if (componentsInChildren != null)
         {
             Renderer[] array = componentsInChildren;
             for (int i = 0; i < array.Length; i++)
             {
                 Renderer renderer = array[i];
                 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 && current != null)
         {
             GUIStyle gUIStyle = new GUIStyle(GUI.skin.label);
             gUIStyle.normal.textColor = Color.red;
             gUIStyle.wordWrap         = false;
             gUIStyle.alignment        = TextAnchor.MiddleLeft;
             gUIStyle.fontSize         = 20;
             GUIContent content = new GUIContent("Character is not in T pose");
             Rect       rect    = GUILayoutUtility.GetRect(content, gUIStyle);
             rect.x = 30f;
             rect.y = 30f;
             Handles.BeginGUI();
             GUI.Label(rect, content, gUIStyle);
             Handles.EndGUI();
         }
     }
 }
 public static void DrawSkeleton(Transform reference, Dictionary <Transform, bool> actualBones, AvatarSetupTool.BoneWrapper[] bones)
 {
     if ((reference != null) && (actualBones != null))
     {
         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 identity = Quaternion.identity;
         if (bones != null)
         {
             identity = AvatarSetupTool.AvatarComputeOrientation(bones);
         }
         DrawSkeletonSubTree(actualBones, bones, identity, reference, bounds);
         Camera current = Camera.current;
         if (sPoseError && (current != null))
         {
             GUIStyle style = new GUIStyle(GUI.skin.label)
             {
                 normal    = { textColor = Color.red },
                 wordWrap  = false,
                 alignment = TextAnchor.MiddleLeft,
                 fontSize  = 20
             };
             GUIContent content  = new GUIContent("Character is not in T pose");
             Rect       position = GUILayoutUtility.GetRect(content, style);
             position.x = 30f;
             position.y = 30f;
             Handles.BeginGUI();
             GUI.Label(position, content, style);
             Handles.EndGUI();
         }
     }
 }
        public Dictionary <int, Transform> MapBones(Transform root)
        {
            InitGlobalMappingData();

            Dictionary <int, Transform> mapping = new Dictionary <int, Transform>();

            // Perform body mapping
            {
                m_Orientation        = Quaternion.identity;
                m_MappingData        = s_MappingDataBody;
                m_MappingIndexOffset = 0;
                m_BoneMatchDict.Clear();
                BoneMatch rootMatch = new BoneMatch(null, root, m_MappingData[0]);

                m_TreatDummyBonesAsReal = false;
                MapBonesFromRootDown(rootMatch, mapping);
                // There are 15 required bones. If we mapped less than that, check if we can do better.
                if (mapping.Count < 15)
                {
                    m_TreatDummyBonesAsReal = true;
                    MapBonesFromRootDown(rootMatch, mapping);
                }

                // Check if character has correct alignment
                if (mapping.ContainsKey((int)HumanBodyBones.LeftUpperLeg) && mapping.ContainsKey((int)HumanBodyBones.RightUpperLeg) &&
                    mapping.ContainsKey((int)HumanBodyBones.LeftUpperArm) && mapping.ContainsKey((int)HumanBodyBones.RightUpperArm))
                {
                    m_Orientation = AvatarSetupTool.AvatarComputeOrientation(
                        mapping[(int)HumanBodyBones.LeftUpperLeg].position, mapping[(int)HumanBodyBones.RightUpperLeg].position,
                        mapping[(int)HumanBodyBones.LeftUpperArm].position, mapping[(int)HumanBodyBones.RightUpperArm].position);

                    // If not standard aligned, try to map again with correct alignment assumptions
                    if (Vector3.Angle(m_Orientation * Vector3.up, Vector3.up) > 20 || Vector3.Angle(m_Orientation * Vector3.forward, Vector3.forward) > 20)
                    {
                        if (kDebug)
                        {
                            Debug.Log("*** Mapping with new computed orientation");
                        }
                        mapping.Clear();
                        m_BoneMatchDict.Clear();
                        MapBonesFromRootDown(rootMatch, mapping);
                    }
                }

                // For models that don't have meshes, all bones are marked valid; even the root.
                // So we use this to check if this model has meshes or not.
                bool modelHasMeshes = !(m_ValidBones.ContainsKey(root) && m_ValidBones[root] == true);

                // Fix up hips to be valid bone closest to the root
                // For models with meshes, valid bones further up are mapped to part of the mesh (otherwise they wouldn't be valid).
                // For models with no meshes we don't know which transforms are valid bones and which aren't
                // so we skip this step and use the found hips bone as-is.
                if (modelHasMeshes && mapping.Count > 0 && mapping.ContainsKey((int)HumanBodyBones.Hips))
                {
                    while (true)
                    {
                        Transform parent = mapping[(int)HumanBodyBones.Hips].parent;
                        if (parent != null && parent != rootMatch.bone && m_ValidBones.ContainsKey(parent) && m_ValidBones[parent] == true)
                        {
                            mapping[(int)HumanBodyBones.Hips] = parent;
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                // Move upper chest to chest if no chest was found
                if (!mapping.ContainsKey((int)HumanBodyBones.Chest) &&
                    mapping.ContainsKey((int)HumanBodyBones.UpperChest))
                {
                    mapping.Add((int)HumanBodyBones.Chest, mapping[(int)HumanBodyBones.UpperChest]);
                    mapping.Remove((int)HumanBodyBones.UpperChest);
                }
            }

            int kMinFingerBones = 3;

            Quaternion bodyOrientation = m_Orientation;

            // Perform left hand mapping
            if (mapping.ContainsKey((int)HumanBodyBones.LeftHand))
            {
                Transform lowerArm = mapping[(int)HumanBodyBones.LeftLowerArm];
                Transform hand     = mapping[(int)HumanBodyBones.LeftHand];

                // Use reference orientation based on lower arm for mapping hand
                m_Orientation = Quaternion.FromToRotation(bodyOrientation * -Vector3.right, hand.position - lowerArm.position) * bodyOrientation;

                m_MappingData        = s_LeftMappingDataHand;
                m_MappingIndexOffset = (int)HumanBodyBones.LeftThumbProximal;
                m_BoneMatchDict.Clear();
                BoneMatch rootMatch = new BoneMatch(null, lowerArm, m_MappingData[0]);
                m_TreatDummyBonesAsReal = true;

                int mappingCountBefore = mapping.Count;
                MapBonesFromRootDown(rootMatch, mapping);

                // If we only mapped 2 finger bones or less, then cancel mapping of fingers
                if (mapping.Count < mappingCountBefore + kMinFingerBones)
                {
                    for (int i = (int)HumanBodyBones.LeftThumbProximal; i <= (int)HumanBodyBones.LeftLittleDistal; i++)
                    {
                        mapping.Remove(i);
                    }
                }
            }

            // Perform right hand mapping
            if (mapping.ContainsKey((int)HumanBodyBones.RightHand))
            {
                Transform lowerArm = mapping[(int)HumanBodyBones.RightLowerArm];
                Transform hand     = mapping[(int)HumanBodyBones.RightHand];

                // Use reference orientation based on lower arm for mapping hand
                m_Orientation = Quaternion.FromToRotation(bodyOrientation * Vector3.right, hand.position - lowerArm.position) * bodyOrientation;

                m_MappingData        = s_RightMappingDataHand;
                m_MappingIndexOffset = (int)HumanBodyBones.RightThumbProximal;
                m_BoneMatchDict.Clear();
                BoneMatch rootMatch = new BoneMatch(null, lowerArm, m_MappingData[0]);
                m_TreatDummyBonesAsReal = true;

                int mappingCountBefore = mapping.Count;
                MapBonesFromRootDown(rootMatch, mapping);

                // If we only mapped 2 finger bones or less, then cancel mapping of fingers
                if (mapping.Count < mappingCountBefore + kMinFingerBones)
                {
                    for (int i = (int)HumanBodyBones.RightThumbProximal; i <= (int)HumanBodyBones.RightLittleDistal; i++)
                    {
                        mapping.Remove(i);
                    }
                }
            }

            return(mapping);
        }
Beispiel #8
0
        public Dictionary <int, Transform> MapBones(Transform root)
        {
            AvatarAutoMapper.InitGlobalMappingData();
            Dictionary <int, Transform> mapping = new Dictionary <int, Transform>();

            this.m_Orientation        = Quaternion.identity;
            this.m_MappingData        = AvatarAutoMapper.s_MappingDataBody;
            this.m_MappingIndexOffset = 0;
            this.m_BoneMatchDict.Clear();
            AvatarAutoMapper.BoneMatch rootMatch1 = new AvatarAutoMapper.BoneMatch((AvatarAutoMapper.BoneMatch)null, root, this.m_MappingData[0]);
            this.m_TreatDummyBonesAsReal = false;
            this.MapBonesFromRootDown(rootMatch1, mapping);
            if (mapping.Count < 15)
            {
                this.m_TreatDummyBonesAsReal = true;
                this.MapBonesFromRootDown(rootMatch1, mapping);
            }
            if (mapping.ContainsKey(1) && mapping.ContainsKey(2) && (mapping.ContainsKey(13) && mapping.ContainsKey(14)))
            {
                this.m_Orientation = AvatarSetupTool.AvatarComputeOrientation(mapping[1].position, mapping[2].position, mapping[13].position, mapping[14].position);
                if ((double)Vector3.Angle(this.m_Orientation * Vector3.up, Vector3.up) > 20.0 || (double)Vector3.Angle(this.m_Orientation * Vector3.forward, Vector3.forward) > 20.0)
                {
                    if (AvatarAutoMapper.kDebug)
                    {
                        Debug.Log((object)"*** Mapping with new computed orientation");
                    }
                    mapping.Clear();
                    this.m_BoneMatchDict.Clear();
                    this.MapBonesFromRootDown(rootMatch1, mapping);
                }
            }
            if ((!this.m_ValidBones.ContainsKey(root) ? 0 : (this.m_ValidBones[root] ? 1 : 0)) == 0 && mapping.Count > 0 && mapping.ContainsKey(0))
            {
                while (true)
                {
                    Transform parent = mapping[0].parent;
                    if ((UnityEngine.Object)parent != (UnityEngine.Object)null && (UnityEngine.Object)parent != (UnityEngine.Object)rootMatch1.bone && (this.m_ValidBones.ContainsKey(parent) && this.m_ValidBones[parent]))
                    {
                        mapping[0] = parent;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            int        num         = 3;
            Quaternion orientation = this.m_Orientation;

            if (mapping.ContainsKey(17))
            {
                Transform bone      = mapping[15];
                Transform transform = mapping[17];
                this.m_Orientation        = Quaternion.FromToRotation(orientation * -Vector3.right, transform.position - bone.position) * orientation;
                this.m_MappingData        = AvatarAutoMapper.s_LeftMappingDataHand;
                this.m_MappingIndexOffset = 24;
                this.m_BoneMatchDict.Clear();
                AvatarAutoMapper.BoneMatch rootMatch2 = new AvatarAutoMapper.BoneMatch((AvatarAutoMapper.BoneMatch)null, bone, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int count = mapping.Count;
                this.MapBonesFromRootDown(rootMatch2, mapping);
                if (mapping.Count < count + num)
                {
                    for (int key = 24; key <= 38; ++key)
                    {
                        mapping.Remove(key);
                    }
                }
            }
            if (mapping.ContainsKey(18))
            {
                Transform bone      = mapping[16];
                Transform transform = mapping[18];
                this.m_Orientation        = Quaternion.FromToRotation(orientation * Vector3.right, transform.position - bone.position) * orientation;
                this.m_MappingData        = AvatarAutoMapper.s_RightMappingDataHand;
                this.m_MappingIndexOffset = 39;
                this.m_BoneMatchDict.Clear();
                AvatarAutoMapper.BoneMatch rootMatch2 = new AvatarAutoMapper.BoneMatch((AvatarAutoMapper.BoneMatch)null, bone, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int count = mapping.Count;
                this.MapBonesFromRootDown(rootMatch2, mapping);
                if (mapping.Count < count + num)
                {
                    for (int key = 39; key <= 53; ++key)
                    {
                        mapping.Remove(key);
                    }
                }
            }
            return(mapping);
        }
Beispiel #9
0
        public Dictionary <int, Transform> MapBones(Transform root)
        {
            AvatarAutoMapper.InitGlobalMappingData();
            Dictionary <int, Transform> dictionary = new Dictionary <int, Transform>();

            this.m_Orientation        = Quaternion.identity;
            this.m_MappingData        = AvatarAutoMapper.s_MappingDataBody;
            this.m_MappingIndexOffset = 0;
            this.m_BoneMatchDict.Clear();
            AvatarAutoMapper.BoneMatch boneMatch = new AvatarAutoMapper.BoneMatch(null, root, this.m_MappingData[0]);
            this.m_TreatDummyBonesAsReal = false;
            this.MapBonesFromRootDown(boneMatch, dictionary);
            if (dictionary.Count < 15)
            {
                this.m_TreatDummyBonesAsReal = true;
                this.MapBonesFromRootDown(boneMatch, dictionary);
            }
            if (dictionary.ContainsKey(1) && dictionary.ContainsKey(2) && dictionary.ContainsKey(13) && dictionary.ContainsKey(14))
            {
                this.m_Orientation = AvatarSetupTool.AvatarComputeOrientation(dictionary[1].position, dictionary[2].position, dictionary[13].position, dictionary[14].position);
                if (Vector3.Angle(this.m_Orientation * Vector3.up, Vector3.up) > 20f || Vector3.Angle(this.m_Orientation * Vector3.forward, Vector3.forward) > 20f)
                {
                    if (AvatarAutoMapper.kDebug)
                    {
                        Debug.Log("*** Mapping with new computed orientation");
                    }
                    dictionary.Clear();
                    this.m_BoneMatchDict.Clear();
                    this.MapBonesFromRootDown(boneMatch, dictionary);
                }
            }
            bool flag = !this.m_ValidBones.ContainsKey(root) || !this.m_ValidBones[root];

            if (flag && dictionary.Count > 0 && dictionary.ContainsKey(0))
            {
                while (true)
                {
                    Transform parent = dictionary[0].parent;
                    if (!(parent != null) || !(parent != boneMatch.bone) || !this.m_ValidBones.ContainsKey(parent) || !this.m_ValidBones[parent])
                    {
                        break;
                    }
                    dictionary[0] = parent;
                }
            }
            int        num         = 3;
            Quaternion orientation = this.m_Orientation;

            if (dictionary.ContainsKey(17))
            {
                Transform transform  = dictionary[15];
                Transform transform2 = dictionary[17];
                this.m_Orientation        = Quaternion.FromToRotation(orientation * -Vector3.right, transform2.position - transform.position) * orientation;
                this.m_MappingData        = AvatarAutoMapper.s_LeftMappingDataHand;
                this.m_MappingIndexOffset = 24;
                this.m_BoneMatchDict.Clear();
                AvatarAutoMapper.BoneMatch rootMatch = new AvatarAutoMapper.BoneMatch(null, transform, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int count = dictionary.Count;
                this.MapBonesFromRootDown(rootMatch, dictionary);
                if (dictionary.Count < count + num)
                {
                    for (int i = 24; i <= 38; i++)
                    {
                        dictionary.Remove(i);
                    }
                }
            }
            if (dictionary.ContainsKey(18))
            {
                Transform transform3 = dictionary[16];
                Transform transform4 = dictionary[18];
                this.m_Orientation        = Quaternion.FromToRotation(orientation * Vector3.right, transform4.position - transform3.position) * orientation;
                this.m_MappingData        = AvatarAutoMapper.s_RightMappingDataHand;
                this.m_MappingIndexOffset = 39;
                this.m_BoneMatchDict.Clear();
                AvatarAutoMapper.BoneMatch rootMatch2 = new AvatarAutoMapper.BoneMatch(null, transform3, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int count2 = dictionary.Count;
                this.MapBonesFromRootDown(rootMatch2, dictionary);
                if (dictionary.Count < count2 + num)
                {
                    for (int j = 39; j <= 53; j++)
                    {
                        dictionary.Remove(j);
                    }
                }
            }
            return(dictionary);
        }
Beispiel #10
0
        public Dictionary <int, Transform> MapBones(Transform root)
        {
            InitGlobalMappingData();
            Dictionary <int, Transform> mapping = new Dictionary <int, Transform>();

            this.m_Orientation        = Quaternion.identity;
            this.m_MappingData        = s_MappingDataBody;
            this.m_MappingIndexOffset = 0;
            this.m_BoneMatchDict.Clear();
            BoneMatch rootMatch = new BoneMatch(null, root, this.m_MappingData[0]);

            this.m_TreatDummyBonesAsReal = false;
            this.MapBonesFromRootDown(rootMatch, mapping);
            if (mapping.Count < 15)
            {
                this.m_TreatDummyBonesAsReal = true;
                this.MapBonesFromRootDown(rootMatch, mapping);
            }
            if ((mapping.ContainsKey(1) && mapping.ContainsKey(2)) && (mapping.ContainsKey(13) && mapping.ContainsKey(14)))
            {
                this.m_Orientation = AvatarSetupTool.AvatarComputeOrientation(mapping[1].position, mapping[2].position, mapping[13].position, mapping[14].position);
                if ((Vector3.Angle((Vector3)(this.m_Orientation * Vector3.up), Vector3.up) > 20f) || (Vector3.Angle((Vector3)(this.m_Orientation * Vector3.forward), Vector3.forward) > 20f))
                {
                    if (kDebug)
                    {
                        Debug.Log("*** Mapping with new computed orientation");
                    }
                    mapping.Clear();
                    this.m_BoneMatchDict.Clear();
                    this.MapBonesFromRootDown(rootMatch, mapping);
                }
            }
            if ((!(!this.m_ValidBones.ContainsKey(root) ? false : this.m_ValidBones[root]) && (mapping.Count > 0)) && mapping.ContainsKey(0))
            {
                while (true)
                {
                    Transform parent = mapping[0].parent;
                    if (((parent == null) || (parent == rootMatch.bone)) || (!this.m_ValidBones.ContainsKey(parent) || !this.m_ValidBones[parent]))
                    {
                        break;
                    }
                    mapping[0] = parent;
                }
            }
            int        num         = 3;
            Quaternion orientation = this.m_Orientation;

            if (mapping.ContainsKey(0x11))
            {
                Transform bone       = mapping[15];
                Transform transform3 = mapping[0x11];
                this.m_Orientation        = Quaternion.FromToRotation((Vector3)(orientation * -Vector3.right), transform3.position - bone.position) * orientation;
                this.m_MappingData        = s_LeftMappingDataHand;
                this.m_MappingIndexOffset = 0x18;
                this.m_BoneMatchDict.Clear();
                BoneMatch match2 = new BoneMatch(null, bone, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int count = mapping.Count;
                this.MapBonesFromRootDown(match2, mapping);
                if (mapping.Count < (count + num))
                {
                    for (int i = 0x18; i <= 0x26; i++)
                    {
                        mapping.Remove(i);
                    }
                }
            }
            if (mapping.ContainsKey(0x12))
            {
                Transform transform4 = mapping[0x10];
                Transform transform5 = mapping[0x12];
                this.m_Orientation        = Quaternion.FromToRotation((Vector3)(orientation * Vector3.right), transform5.position - transform4.position) * orientation;
                this.m_MappingData        = s_RightMappingDataHand;
                this.m_MappingIndexOffset = 0x27;
                this.m_BoneMatchDict.Clear();
                BoneMatch match3 = new BoneMatch(null, transform4, this.m_MappingData[0]);
                this.m_TreatDummyBonesAsReal = true;
                int num4 = mapping.Count;
                this.MapBonesFromRootDown(match3, mapping);
                if (mapping.Count >= (num4 + num))
                {
                    return(mapping);
                }
                for (int j = 0x27; j <= 0x35; j++)
                {
                    mapping.Remove(j);
                }
            }
            return(mapping);
        }