Exemplo n.º 1
0
        /// <summary>
        /// Called by the Timeline Editor to gather properties requiring preview.
        /// </summary>
        /// <param name="director">The PlayableDirector invoking the preview</param>
        /// <param name="driver">PropertyCollector used to gather previewable properties</param>
        public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
#if UNITY_EDITOR
            m_SceneOffsetPosition = Vector3.zero;
            m_SceneOffsetRotation = Vector3.zero;

            var animator = GetBinding(director);
            if (animator == null)
            {
                return;
            }

            List <AnimationClip> animClips = new List <AnimationClip>(this.clips.Length + 2);
            GetAnimationClips(animClips);

            m_SceneOffsetPosition = animator.transform.localPosition;
            m_SceneOffsetRotation = animator.transform.localEulerAngles;

            if (animator.isHuman)
            {
                animClips.Add(GetDefaultHumanoidClip());
            }

            driver.AddFromClips(animator.gameObject, animClips);
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called by the Timeline Editor to gather properties requiring preview.
        /// </summary>
        /// <param name="director">The PlayableDirector invoking the preview</param>
        /// <param name="driver">PropertyCollector used to gather previewable properties</param>
        public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
#if UNITY_EDITOR
            m_SceneOffsetPosition = Vector3.zero;
            m_SceneOffsetRotation = Vector3.zero;

            var animator = GetBinding(director);
            if (animator == null)
            {
                return;
            }

            List <AnimationClip> animClips = new List <AnimationClip>(this.clips.Length + 2);
            GetAnimationClips(animClips);

            bool hasHumanMotion = animClips.Exists(clip => clip.humanMotion);

            m_SceneOffsetPosition = animator.transform.localPosition;
            m_SceneOffsetRotation = animator.transform.localEulerAngles;

            if (hasHumanMotion)
            {
                animClips.Add(GetDefaultHumanoidClip());
            }

            driver.AddFromClips(animator.gameObject, animClips);

            // Create default pose clip from collected properties
            if (hasHumanMotion)
            {
                m_DefaultPoseClip = GetDefaultHumanoidClip();
            }
            else
            {
                m_DefaultPoseClip = driver.CreateDefaultClipFromProperties(animator.gameObject);
            }
#endif
        }