fixed bug

This commit is contained in:
Perfare 2017-10-23 22:22:24 +08:00
parent 4666b378b3
commit 7ddbf3ce3e
3 changed files with 9 additions and 2 deletions

View File

@ -777,6 +777,8 @@ namespace Unity_Studio
public byte[] ConvertToContainer() public byte[] ConvertToContainer()
{ {
if (image_data == null || image_data.Length == 0)
return null;
switch (m_TextureFormat) switch (m_TextureFormat)
{ {
case TextureFormat.Alpha8: case TextureFormat.Alpha8:

View File

@ -1610,6 +1610,8 @@ namespace Unity_Studio
public static bool ExportTexture(AssetPreloadData asset, string exportPathName, bool flip) public static bool ExportTexture(AssetPreloadData asset, string exportPathName, bool flip)
{ {
var m_Texture2D = new Texture2D(asset, true); var m_Texture2D = new Texture2D(asset, true);
if (m_Texture2D.image_data == null)
return false;
var convert = (bool)Properties.Settings.Default["convertTexture"]; var convert = (bool)Properties.Settings.Default["convertTexture"];
if (convert) if (convert)
{ {
@ -1631,6 +1633,7 @@ namespace Unity_Studio
bitmap.Dispose(); bitmap.Dispose();
return true; return true;
} }
return false;
} }
var exportFullName2 = exportPathName + asset.Text + asset.extension; var exportFullName2 = exportPathName + asset.Text + asset.extension;
if (ExportFileExists(exportFullName2)) if (ExportFileExists(exportFullName2))
@ -1641,6 +1644,9 @@ namespace Unity_Studio
public static bool ExportAudioClip(AssetPreloadData asset, string exportFilename, string exportFileextension) public static bool ExportAudioClip(AssetPreloadData asset, string exportFilename, string exportFileextension)
{ {
var m_AudioClip = new AudioClip(asset, true);
if (m_AudioClip.m_AudioData == null)
return false;
var oldextension = exportFileextension; var oldextension = exportFileextension;
var convertfsb = (bool)Properties.Settings.Default["convertfsb"]; var convertfsb = (bool)Properties.Settings.Default["convertfsb"];
if (convertfsb && exportFileextension == ".fsb") if (convertfsb && exportFileextension == ".fsb")
@ -1650,7 +1656,6 @@ namespace Unity_Studio
var exportFullname = exportFilename + exportFileextension; var exportFullname = exportFilename + exportFileextension;
if (ExportFileExists(exportFullname)) if (ExportFileExists(exportFullname))
return false; return false;
var m_AudioClip = new AudioClip(asset, true);
if (convertfsb && oldextension == ".fsb") if (convertfsb && oldextension == ".fsb")
{ {
FMOD.System system; FMOD.System system;

View File

@ -821,7 +821,7 @@ namespace Unity_Studio
} }
else else
{ {
StatusStripUpdate("Unsupported image for preview. Can only export the texture file."); StatusStripUpdate("Unsupported image for preview");
} }
break; break;
} }