Beispiel #1
0
        /// <summary>
        /// Gets the animation data associated with the specified model.
        /// Works with models that are processed by Nine.Pipeline.Processors.ExtendedModelProcessor.
        /// </summary>
        public static BoneAnimationClip GetAnimation(this Microsoft.Xna.Framework.Graphics.Model model, string name)
        {
            ModelTag extensions = model.Tag as ModelTag;

            if (extensions != null && extensions.Animations != null)
            {
                BoneAnimationClip clip = null;
                extensions.Animations.TryGetValue(name, out clip);
                return(clip);
            }

            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the animation data associated with the specified model.
        /// Works with models that are processed by Nine.Pipeline.Processors.ExtendedModelProcessor.
        /// </summary>
        public static BoneAnimationClip GetAnimation(this Microsoft.Xna.Framework.Graphics.Model model, int index)
        {
            BoneAnimationClip clip = null;

            ModelTag extensions = model.Tag as ModelTag;

            if (extensions != null && extensions.Animations != null &&
                extensions.Animations.Count > 0)
            {
                foreach (string key in extensions.Animations.Keys)
                {
                    if (index-- == 0)
                    {
                        extensions.Animations.TryGetValue(key, out clip);
                        break;
                    }
                }
            }

            return(clip);
        }