Skip to content

Commit

Permalink
修复贴图资源导出bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjgameer committed Aug 21, 2023
1 parent a4b01da commit 38f6e90
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Export/filter/TextureFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ override protected string getOutFilePath(string origpath)
{
savePath += convertIndex == -1 ? ".hdr" : ext;
}
else if (this._format == 0)
else if (this._format == 0||this._format == 3)
{
savePath += convertIndex == -1 ? ".jpg" : ext;
}
Expand Down Expand Up @@ -375,6 +375,30 @@ public override void SaveFile(Dictionary<string, FileData> exportFiles)
import.SetPlatformTextureSettings(pc);
AssetDatabase.ImportAsset(path);

byte[] bytes = this._texture.EncodeToJPG();
File.WriteAllBytes(this.outPath, bytes);
}
}
else if (this._format == 5)
{
string path = this.filePath;
TextureImporter import = AssetImporter.GetAtPath(path) as TextureImporter;
if (import == null)
{
Debug.LogError(LOGHEAD + path + " can't export You should check the texture file format");
return;
}
else
{
import.textureType = TextureImporterType.Default;
import.isReadable = true;
import.textureCompression = TextureImporterCompression.Uncompressed;
TextureImporterPlatformSettings pc = import.GetPlatformTextureSettings("Standalone");
pc.overridden = true;
pc.format = TextureImporterFormat.RGBA32;
import.SetPlatformTextureSettings(pc);
AssetDatabase.ImportAsset(path);

byte[] bytes = this._texture.EncodeToPNG();
File.WriteAllBytes(this.outPath, bytes);
}
Expand Down

0 comments on commit 38f6e90

Please sign in to comment.