Exemplo n.º 1
0
        public static void WriteAnimationChainSave(ContentWriter output, AnimationChainSaveContent value)
        {
            if (value.Name != null)
            {
                output.Write(value.Name);
            }
            else
            {
                output.Write("");
            }

            if (value.ParentFile != null)
            {
                output.Write(value.ParentFile);
            }
            else
            {
                output.Write("");
            }
            output.Write(value.Frames.Count);
            for (int i = 0; i < value.Frames.Count; i++)
            {
                ObjectWriter.WriteObject(output, value.Frames[i]);
            }
        }
        /// <summary>
        /// look at all of the textures in each frame and convert them into external references
        /// </summary>
        public override AnimationChainListSaveContent Process(AnimationChainListSaveContent input, ContentProcessorContext context)
        {
            string directory = System.IO.Path.GetDirectoryName(input.FileName) + @"\";

            BitmapTextureProcessor.ResizeToPowerOfTwo           = ResizeToPowerOfTwo;
            BitmapTextureProcessor.TextureProcessorOutputFormat = TextureProcessorOutputFormat;
            BitmapTextureProcessor.GenerateMipmaps = GenerateMipmaps;             // This doesn't seem to be working......why?

            #region Loop through all AnimationChains and process them.

            for (int i = 0; i < input.AnimationChains.Count; i++)
            {
                AnimationChainSaveContent        ach       = input.AnimationChains[i];
                List <AnimationFrameSaveContent> newFrames = new List <AnimationFrameSaveContent>(ach.Frames.Count);

                for (int j = 0; j < ach.Frames.Count; j++)
                {
                    AnimationFrameSaveContent frameSave = ach.Frames[j];// new AnimationFrameSaveContent(ach.Frames[j]);

                    frameSave.TextureReference = BitmapTextureProcessor.BuildTexture(
                        directory + frameSave.TextureName,
                        context);

                    newFrames.Add(frameSave);
                }
                ach.Frames = newFrames;
            }

            #endregion

            return(input);
        }