public static void ExportTexture([DefaultVar] UnityParser parser, string name, string path) { string folder = Path.GetDirectoryName(path); if (folder.Length > 0) { folder += "\\"; } folder += Path.GetFileNameWithoutExtension(path); ImageFileFormat preferredUncompressedFormat = (string)Properties.Settings.Default["ExportUncompressedAs"] == "BMP" ? ImageFileFormat.Bmp : (ImageFileFormat)(-1); if (name != "*") { Texture2D tex = parser.GetTexture(name); if (tex != null) { tex.Export(folder, preferredUncompressedFormat); } } else { for (int i = 0; i < parser.Textures.Count; i++) { Texture2D tex = parser.GetTexture(i); tex.Export(folder, preferredUncompressedFormat); } } }
public static void ExportTexture([DefaultVar] UnityParser parser, string name, string path) { string folder = Path.GetDirectoryName(path); if (folder.Length > 0) { folder += "\\"; } folder += Path.GetFileNameWithoutExtension(path); if (name != "*") { Texture2D tex = parser.GetTexture(name); if (tex != null) { tex.Export(folder); } } else { for (int i = 0; i < parser.Textures.Count; i++) { Texture2D tex = parser.GetTexture(i); tex.Export(folder); } } }
public static void ReplaceTexture(UnityParser parser, ImportedTexture texture) { Texture2D tex = parser.GetTexture(Path.GetFileNameWithoutExtension(texture.Name)); if (tex == null) { parser.AddTexture(texture); return; } ReplaceTexture(tex, texture); }