public static void RenameTextures(TextureSet textures, TextureDatabase textureDatabase = null)
 {
     foreach (var texture in textures.Textures)
     {
         RenameTexture(texture, textures, textureDatabase);
     }
 }
Esempio n. 2
0
        public static void SaveTextures(TextureSet textures, string outputDirectory)
        {
            Directory.CreateDirectory(outputDirectory);

            foreach (var texture in textures.Textures)
            {
                if (!TextureFormatUtilities.IsCompressed(texture.Format) || texture.IsYCbCr)
                {
                    TextureDecoder.DecodeToPNG(texture, Path.Combine(outputDirectory, texture.Name + ".png"));
                }
                else
                {
                    TextureDecoder.DecodeToDDS(texture, Path.Combine(outputDirectory, texture.Name + ".dds"));
                }
            }
        }
Esempio n. 3
0
        public static void RenameTexture(Texture texture, TextureSet textures, TextureDatabase textureDatabase = null)
        {
            bool empty = string.IsNullOrEmpty(texture.Name);

            if (textureDatabase == null)
            {
                if (empty)
                {
                    texture.Name = string.Format("Texture_{0}", textures.Textures.IndexOf(texture));
                }
            }
            else
            {
                var info = textureDatabase.Textures.FirstOrDefault(x => x.Id == texture.Id);
                if (info != null)
                {
                    texture.Name = info.Name;
                }
                else if (empty)
                {
                    texture.Name = string.Format("Texture_{0}", textures.Textures.IndexOf(texture));
                }
            }
        }