Esempio n. 1
0
        /************************************************************************************************************************/

        private AnimationClip GetTargetClip(out AnimationType type)
        {
            var clip = (AnimationClip)target;

            type = AnimationBindings.GetAnimationType(clip);
            return(clip);
        }
            /************************************************************************************************************************/

            /// <summary>
            /// Tries to choose the most appropriate model to use based on the properties animated by the target
            /// <see cref="Transition"/>.
            /// </summary>
            public static Transform TrySelectBestModel()
            {
                var transition = Transition;
                if (transition == null)
                    return null;

                using (ObjectPool.Disposable.AcquireSet<AnimationClip>(out var clips))
                {
                    clips.GatherFromSource(transition);
                    if (clips.Count == 0)
                        return null;

                    var model = TrySelectBestModel(clips, TemporarySettings.PreviewModels);
                    if (model != null)
                        return model;

                    model = TrySelectBestModel(clips, Models);
                    if (model != null)
                        return model;

                    foreach (var clip in clips)
                    {
                        var type = AnimationBindings.GetAnimationType(clip);
                        switch (type)
                        {
                            case AnimationType.Humanoid:
                                return DefaultHumanoid.transform;

                            case AnimationType.Sprite:
                                return DefaultSprite.transform;
                        }
                    }

                    return null;
                }
            }