mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
fixed some bug
This commit is contained in:
parent
0df3b54499
commit
4b8b8fb8ea
@ -191,7 +191,7 @@ namespace Unity_Studio
|
||||
dwRBitMask = 0x0;
|
||||
dwGBitMask = 0x0;
|
||||
dwBBitMask = 0x0;
|
||||
dwABitMask = 0x0; *///透明通道丢失?
|
||||
dwABitMask = 0xFF; *///透明通道丢失?
|
||||
//转ARGB32
|
||||
var bytes = Enumerable.Repeat<byte>(0xFF, image_data_size * 4).ToArray();
|
||||
for (int i = 0; i < image_data_size; i++)
|
||||
@ -281,7 +281,7 @@ namespace Unity_Studio
|
||||
}
|
||||
case TextureFormat.R16:
|
||||
break;
|
||||
case TextureFormat.DXT1: //DXT1
|
||||
case TextureFormat.DXT1: //test pass
|
||||
{
|
||||
if (sourceFile.platform == 11) //X360 only, PS3 not
|
||||
{
|
||||
@ -303,7 +303,7 @@ namespace Unity_Studio
|
||||
dwABitMask = 0x0;
|
||||
break;
|
||||
}
|
||||
case TextureFormat.DXT5: //DXT5
|
||||
case TextureFormat.DXT5: //test pass
|
||||
{
|
||||
if (sourceFile.platform == 11) //X360, PS3 not
|
||||
{
|
||||
@ -687,14 +687,4 @@ public class KTXHeader
|
||||
public static int GL_RGB = 0x1907;
|
||||
public static int GL_RGBA = 0x1908;
|
||||
public static int GL_RG = 0x8227;
|
||||
|
||||
public static int getMipMapCount(int width, int height)
|
||||
{
|
||||
int mipMapCount = 1;
|
||||
for (int dim = Math.Max(width, height); dim > 1; dim /= 2)
|
||||
{
|
||||
mipMapCount++;
|
||||
}
|
||||
return mipMapCount;
|
||||
}
|
||||
}
|
@ -768,7 +768,7 @@ namespace Unity_Studio
|
||||
}
|
||||
if (exportable)
|
||||
{
|
||||
if (!exportableAssetsHash.Add(asset.TypeString + asset.Text))
|
||||
if (!exportableAssetsHash.Add((asset.TypeString + asset.Text).ToUpper()))
|
||||
{
|
||||
asset.Text += " #" + asset.uniqueID;
|
||||
}
|
||||
@ -3127,8 +3127,9 @@ namespace Unity_Studio
|
||||
private bool ExportTexture(AssetPreloadData asset, string exportFilename, string exportFileextension, bool flip)
|
||||
{
|
||||
ImageFormat format = null;
|
||||
var convert = (bool)Properties.Settings.Default["convertTexture"];
|
||||
var oldextension = exportFileextension;
|
||||
if ((bool)Properties.Settings.Default["convertTexture"])
|
||||
if (convert && (exportFileextension == ".dds" || exportFileextension == ".pvr" || exportFileextension == ".astc"))
|
||||
{
|
||||
string str = Properties.Settings.Default["convertType"] as string;
|
||||
exportFileextension = "." + str.ToLower();
|
||||
@ -3140,18 +3141,13 @@ namespace Unity_Studio
|
||||
format = ImageFormat.Jpeg;
|
||||
}
|
||||
var exportFullname = exportFilename + exportFileextension;
|
||||
if (File.Exists(exportFullname))
|
||||
{
|
||||
StatusStripUpdate("Texture2D file " + Path.GetFileName(exportFullname) + " already exists");
|
||||
if (ExportFileExists(exportFullname, "Texture2D"))
|
||||
return false;
|
||||
}
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(exportFullname));
|
||||
StatusStripUpdate("Exporting Texture2D: " + Path.GetFileName(exportFullname));
|
||||
var m_Texture2D = new Texture2D(asset, true);
|
||||
if (oldextension == ".dds")
|
||||
{
|
||||
byte[] imageBuffer = Texture2DToDDS(m_Texture2D);
|
||||
if ((bool)Properties.Settings.Default["convertTexture"])
|
||||
if (convert)
|
||||
{
|
||||
var bitmap = DDSToBMP(imageBuffer);
|
||||
if (flip)
|
||||
@ -3166,7 +3162,7 @@ namespace Unity_Studio
|
||||
else if (oldextension == ".pvr")
|
||||
{
|
||||
var pvrdata = Texture2DToPVR(m_Texture2D);
|
||||
if ((bool)Properties.Settings.Default["convertTexture"])
|
||||
if (convert)
|
||||
{
|
||||
var bitmap = new Bitmap(m_Texture2D.m_Width, m_Texture2D.m_Height);
|
||||
Rectangle rect = new Rectangle(0, 0, m_Texture2D.m_Width, m_Texture2D.m_Height);
|
||||
@ -3186,7 +3182,7 @@ namespace Unity_Studio
|
||||
else if (oldextension == ".astc")
|
||||
{
|
||||
var astcdata = Texture2DToASTC(m_Texture2D);
|
||||
if ((bool)Properties.Settings.Default["convertTexture"])
|
||||
if (convert)
|
||||
{
|
||||
string tempastcfilepath = Path.GetTempFileName();
|
||||
string temptgafilepath = tempastcfilepath.Replace(".tmp", ".tga");
|
||||
@ -3228,13 +3224,8 @@ namespace Unity_Studio
|
||||
exportFileextension = ".wav";
|
||||
}
|
||||
var exportFullname = exportFilename + exportFileextension;
|
||||
if (File.Exists(exportFullname))
|
||||
{
|
||||
StatusStripUpdate("AudioClip file " + Path.GetFileName(exportFullname) + " already exists");
|
||||
if (ExportFileExists(exportFullname, "AudioClip"))
|
||||
return false;
|
||||
}
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(exportFullname));
|
||||
StatusStripUpdate("Exporting AudioClip: " + Path.GetFileName(exportFullname));
|
||||
var m_AudioClip = new AudioClip(asset, true);
|
||||
if ((bool)Properties.Settings.Default["convertfsb"] && oldextension == ".fsb")
|
||||
{
|
||||
@ -3301,7 +3292,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllBytes(exportFilename, m_AudioClip.m_AudioData);
|
||||
File.WriteAllBytes(exportFullname, m_AudioClip.m_AudioData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -3329,7 +3320,6 @@ namespace Unity_Studio
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||
|
||||
StatusStripUpdate("Exporting " + assetType + ": " + Path.GetFileName(filename));
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user