Exemplo n.º 1
0
        internal static AnimationClip[] GetAllAnimationClips([NotNull] TinyAnimationAuthoring animationComponent)
        {
            if (!k_ClipsCache.ContainsKey(animationComponent))
            {
                animationComponent.UpdateAdditionalAnimatorClips();

                var clips = new List <AnimationClip>(animationComponent.animationClips.Count + animationComponent.additionalAnimatorClips.Count);
                animationComponent.GetAnimationClips(clips);
                clips.AddRange(animationComponent.additionalAnimatorClips);
                k_ClipsCache.Add(animationComponent, FilterAnimationClips(clips));
            }

            return(k_ClipsCache[animationComponent]);
        }
        void OnEnable()
        {
            m_TinyAnimationAuthoring = (TinyAnimationAuthoring)target;
            m_Animator          = m_TinyAnimationAuthoring.GetComponent <Animator>();
            m_CurrentController = TinyAnimationEditorBridge.GetEffectiveAnimatorController(m_Animator);

            // Ensures an update during first pass
            m_TargetDirtyCount   = -1;
            m_AnimatorDirtyCount = -1;

            m_AnimationClipsProp          = serializedObject.FindProperty(nameof(TinyAnimationAuthoring.animationClips));
            m_PlayAutomaticallyProp       = serializedObject.FindProperty(nameof(TinyAnimationAuthoring.playAutomatically));
            m_PatchScaleProp              = serializedObject.FindProperty(nameof(TinyAnimationAuthoring.patchMissingScaleIfNeeded));
            m_AdditionalAnimatorClipsProp = serializedObject.FindProperty(nameof(TinyAnimationAuthoring.additionalAnimatorClips));
        }
        void OnDisable()
        {
            if (m_CurrentController != null)
            {
                TinyAnimationEditorBridge.UnregisterDirtyCallbackFromAnimatorController(m_CurrentController, OnControllerDirty);
                m_CurrentController = null;
            }

            m_TinyAnimationAuthoring = null;
            m_Animator = null;

            m_AnimationClipsProp          = null;
            m_PlayAutomaticallyProp       = null;
            m_PatchScaleProp              = null;
            m_AdditionalAnimatorClipsProp = null;
        }