Пример #1
0
        /// <summary>
        /// The main Process method converts an intermediate format content pipeline NodeContent tree to an animation data format.
        /// </summary>
        public override RootAnimationClip Process(NodeContent input, ContentProcessorContext context)
        {
            SimplifiedModelProcessor modelProcessor = new SimplifiedModelProcessor();
            ModelContent             model          = modelProcessor.Process(input, context);

            Dictionary <string, RootAnimationClip> rootClips = new Dictionary <string, RootAnimationClip>();

            foreach (KeyValuePair <string, AnimationContent> animation in input.Animations)
            {
                RootAnimationClip processed = RigidModelProcessor.ProcessRootAnimation(animation.Value, model.Bones[0].Name);
                rootClips.Add(animation.Key, processed);
            }

            if (string.IsNullOrEmpty(AnimationName)) // If no name was set then take the first animation
            {
                foreach (var animation in rootClips)
                {
                    return(animation.Value);
                }
                throw new InvalidContentException("There is no root animation present in this model.");
            }
            if (rootClips.ContainsKey(AnimationName))
            {
                return(rootClips[AnimationName]);
            }
            throw new InvalidContentException("There is no root animation present with this name.");
        } // Process
        /// <summary>
        /// The main Process method converts an intermediate format content pipeline NodeContent tree to an animation data format.
        /// </summary>
        public override ModelAnimationClip Process(NodeContent input, ContentProcessorContext context)
        {
            RigidModelProcessor rigidModelProcessor = new RigidModelProcessor();
            ModelContent        model = rigidModelProcessor.Process(input, context);

            if (string.IsNullOrEmpty(AnimationName)) // If no name was set then take the first animation
            {
                foreach (var animation in ((ModelAnimationData)model.Tag).ModelAnimationClips)
                {
                    return(animation.Value);
                }
                throw new InvalidContentException("There is no rigid animation present in this model.");
            }
            if (((ModelAnimationData)model.Tag).ModelAnimationClips.ContainsKey(AnimationName))
            {
                return(((ModelAnimationData)model.Tag).ModelAnimationClips[AnimationName]);
            }
            throw new InvalidContentException("There is no rigid animation present with this name.");
        } // Process