コード例 #1
0
        public void AddFromClips(GameObject obj, IEnumerable <AnimationClip> clips)
        {
            if (Application.isPlaying)
            {
                return;
            }

            // Add RootMotion TR property in animation mode snapshot as well if animator bindings didn't do it.
            var  animator = obj.GetComponent <Animator>();
            bool addRoot  = (animator != null && !animator.isHuman && !animator.applyRootMotion);

            m_CurveBindingSet.Clear();
            foreach (var c in clips)
            {
                addRoot |= c.hasRootCurves | c.hasMotionCurves | c.hasRootMotion;

                m_CurveBindingSet.UnionWith(AnimationClipCurveCache.Instance.GetCurveInfo(c).rawBindings);
                m_CurveBindingSet.UnionWith(AnimationClipCurveCache.Instance.GetCurveInfo(c).objectBindings);
            }
            m_CurveBindingSet.UnionWith(m_AnimatorCache.GetAnimatorBindings(obj));

            foreach (var binding in m_CurveBindingSet)
            {
                if (binding.type != typeof(Animator) && !IsEulerHint(binding))
                {
                    AnimationMode.AddEditorCurveBinding(obj, binding);
                }
            }

            if (addRoot)
            {
                AnimationMode.AddTransformTR(obj, string.Empty);
            }
        }
コード例 #2
0
        void AddPropertiesFromClip(GameObject go, AnimationClip clip)
        {
            if (go != null && clip != null)
            {
                AnimationMode.InitializePropertyModificationForGameObject(go, clip);

                // Add RootMotion TR property in animation mode snapshot as well.
                AnimationMode.AddTransformTR(go, "");
            }
        }