protected override void OnUpdate()
        {
            Entities.ForEach((UnityEngine.Animation animationComponent) =>
            {
                if (!TinyAnimationConversionState.ValidateGameObjectAndWarn(animationComponent.gameObject))
                {
                    return;
                }

                var animationClips = TinyAnimationConversionState.GetAllAnimationClips(animationComponent);
                if (animationClips.Length == 0)
                {
                    return;
                }

                ConversionUtils.WarnAboutUnsupportedFeatures(animationComponent);

                foreach (var clip in animationClips)
                {
                    Convert(clip);
                }
            });

            Entities.ForEach((TinyAnimationAuthoring animationComponent) =>
            {
                if (!TinyAnimationConversionState.ValidateGameObjectAndWarn(animationComponent.gameObject))
                {
                    return;
                }

                var animationClips = TinyAnimationConversionState.GetAllAnimationClips(animationComponent);
                if (animationClips.Length == 0)
                {
                    return;
                }

                ConversionUtils.WarnAboutUnsupportedFeatures(animationComponent.GetComponent <Animator>());

                foreach (var clip in animationClips)
                {
                    Convert(clip);
                }
            });
        }
Exemple #2
0
        protected override void OnUpdate()
        {
            Entities.ForEach((UnityEngine.Animation animationComponent) =>
            {
                if (!TinyAnimationConversionState.ValidateGameObjectAndWarn(animationComponent.gameObject))
                {
                    return;
                }

                var animationClips = TinyAnimationConversionState.GetAllAnimationClips(animationComponent);
                if (animationClips.Length == 0)
                {
                    return;
                }

                foreach (var clip in animationClips)
                {
                    DeclareAnimationClipReferencedAssets(clip);
                }
            });

            Entities.ForEach((TinyAnimationAuthoring animationComponent) =>
            {
                if (!TinyAnimationConversionState.ValidateGameObjectAndWarn(animationComponent.gameObject))
                {
                    return;
                }

                var animationClips = TinyAnimationConversionState.GetAllAnimationClips(animationComponent);
                if (animationClips.Length == 0)
                {
                    return;
                }

                foreach (var clip in animationClips)
                {
                    DeclareAnimationClipReferencedAssets(clip);
                }
            });

            UserBindingsRemapper.FillMap();
        }
        void Convert(Component animationComponent)
        {
            var animationClips = TinyAnimationConversionState.GetAllAnimationClips(animationComponent);

            if (animationClips.Length == 0)
            {
                return;
            }

            var rootGameObject   = animationComponent.gameObject;
            var gameObjectEntity = TryGetPrimaryEntity(rootGameObject);

            if (gameObjectEntity == Entity.Null)
            {
                throw new Exception($"Could not get a conversion entity for {animationComponent.GetType().Name} on {rootGameObject}.");
            }

            DstEntityManager.AddBuffer <TinyAnimationClipRef>(gameObjectEntity);

            foreach (var clip in animationClips)
            {
                Convert(rootGameObject, clip, gameObjectEntity);
            }

            var clipReferences    = DstEntityManager.GetBuffer <TinyAnimationClipRef>(gameObjectEntity);
            var currentClipEntity = clipReferences[0].Value;

            DstEntityManager.AddComponentData(gameObjectEntity, new TinyAnimationPlayer {
                CurrentClip = currentClipEntity, CurrentIndex = 0
            });

            if (PlaysAutomatically(animationComponent))
            {
                DstEntityManager.AddComponent <UpdateAnimationTimeTag>(currentClipEntity);
                DstEntityManager.AddComponent <ApplyAnimationResultTag>(currentClipEntity);
            }
        }