Esempio n. 1
0
        private void _GenMatchMap()
        {
            SkinnedMeshRenderer smr = SMREditor.GetSMR();

            Dbg.Assert(smr != null, "MirrorCtrl.__GenMatchMap: failed to get SMR");

            Transform[] bones = smr.bones;

            // build trPath map
            Dictionary <string, bool> trPathMap = new Dictionary <string, bool>();

            for (int idx = 0; idx < bones.Length; ++idx)
            {
                Transform thisBone = bones[idx];
                string    thisPath = AnimationUtility.CalculateTransformPath(thisBone, m_AnimRoot);
                trPathMap[thisPath] = true;
            }

            // gen match map
            for (int idx = 0; idx < bones.Length; ++idx)
            {
                Transform thisBone = bones[idx];
                string    thisPath = AnimationUtility.CalculateTransformPath(thisBone, m_AnimRoot);

                int matchREIdx = IsMatchRE(thisPath);
                if (matchREIdx >= 0)
                {
                    string thatPath = GetMatchPath(thisPath, matchREIdx);
                    bool   bFound   = trPathMap.ContainsKey(thatPath);

                    m_MatchMap[thisPath] = new MatchBone(thatPath, bFound);
                }
            }
        }
Esempio n. 2
0
        // public method

        #endregion "public method"

        #region "private method"

        private void _GenMatchMap()
        {
            EditorCurveBinding[] allBindings = AnimationUtility.GetCurveBindings(m_Clip);
            for (int idx = 0; idx < allBindings.Length; ++idx)
            {
                string thisPath   = allBindings[idx].path;
                int    matchREIdx = _IsMatchRE(thisPath);
                if (matchREIdx < 0)
                {
                    continue;
                }
                else
                {
                    --idx;
                }

                string thatPath = _GetMatchPath(thisPath, matchREIdx);
                bool   bFound   = _FindByPath(thatPath, allBindings);
                m_MatchMap[thisPath] = new MatchBone(thatPath, bFound);

                _ClearEntries(ref allBindings, thisPath, thatPath);
            }
        }