fixed bug

This commit is contained in:
Perfare 2017-11-29 03:57:32 +08:00
parent e75b9858da
commit 40153f6f19
3 changed files with 26 additions and 12 deletions

View File

@ -738,6 +738,8 @@ namespace Unity_Studio
case TextureFormat.EAC_RG: case TextureFormat.EAC_RG:
case TextureFormat.EAC_RG_SIGNED: case TextureFormat.EAC_RG_SIGNED:
preloadData.extension = ".ktx"; break; preloadData.extension = ".ktx"; break;
default:
preloadData.extension = ".dat"; break;
} }
switch (m_FilterMode) switch (m_FilterMode)

View File

@ -1595,7 +1595,7 @@ namespace Unity_Studio
if (m_Texture2D.image_data == null) if (m_Texture2D.image_data == null)
return false; return false;
var convert = (bool)Properties.Settings.Default["convertTexture"]; var convert = (bool)Properties.Settings.Default["convertTexture"];
if (convert) if (convert && asset.extension != ".dat")
{ {
ImageFormat format = null; ImageFormat format = null;
var ext = (string)Properties.Settings.Default["convertType"]; var ext = (string)Properties.Settings.Default["convertType"];
@ -1863,7 +1863,7 @@ namespace Unity_Studio
return false; return false;
} }
private static string FixFileName(string str) public static string FixFileName(string str)
{ {
if (str.Length >= 260) return Path.GetRandomFileName(); if (str.Length >= 260) return Path.GetRandomFileName();
return Path.GetInvalidFileNameChars().Aggregate(str, (current, c) => current.Replace(c, '_')); return Path.GetInvalidFileNameChars().Aggregate(str, (current, c) => current.Replace(c, '_'));

View File

@ -84,20 +84,32 @@ namespace Unity_Studio
if (openFileDialog1.ShowDialog() == DialogResult.OK) if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ {
resetForm(); resetForm();
mainPath = Path.GetDirectoryName(openFileDialog1.FileNames[0]);
ThreadPool.QueueUserWorkItem(state => ThreadPool.QueueUserWorkItem(state =>
{ {
mainPath = Path.GetDirectoryName(openFileDialog1.FileNames[0]);
var bundle = false;
if (openFileDialog1.FilterIndex == 1 || openFileDialog1.FilterIndex == 3) if (openFileDialog1.FilterIndex == 1 || openFileDialog1.FilterIndex == 3)
{ {
MergeSplitAssets(mainPath);
//Only verify whether the first file is bundle file
if (CheckBundleFile(openFileDialog1.FileNames[0])) if (CheckBundleFile(openFileDialog1.FileNames[0]))
{ {
MessageBox.Show($"{Path.GetFileName(openFileDialog1.FileNames[0])} is bundle file, please select bundle file type to load this file"); if (openFileDialog1.FileNames.Length > 1)
return; {
MessageBox.Show($"{Path.GetFileName(openFileDialog1.FileNames[0])} is bundle file, please select bundle file type to load this file");
return;
}
else
{
bundle = true;
}
} }
}
else
{
bundle = true;
}
if (!bundle)
{
MergeSplitAssets(mainPath);
foreach (var i in openFileDialog1.FileNames) foreach (var i in openFileDialog1.FileNames)
{ {
unityFiles.Add(i); unityFiles.Add(i);
@ -1463,8 +1475,10 @@ namespace Unity_Studio
var filename = j.Text + DateTime.Now.ToString("_mm_ss_ffff"); var filename = j.Text + DateTime.Now.ToString("_mm_ss_ffff");
//选中它和它的子节点 //选中它和它的子节点
sceneTreeView.Invoke(new Action(() => j.Checked = true)); sceneTreeView.Invoke(new Action(() => j.Checked = true));
//处理非法文件名
var name = FixFileName(savePath + filename + ".fbx");
//导出FBX //导出FBX
WriteFBX(savePath + filename + ".fbx", false); WriteFBX(name, false);
//取消选中 //取消选中
sceneTreeView.Invoke(new Action(() => j.Checked = false)); sceneTreeView.Invoke(new Action(() => j.Checked = false));
} }
@ -1916,9 +1930,7 @@ namespace Unity_Studio
reverseSort = false; reverseSort = false;
enableFiltering = false; enableFiltering = false;
//FMODinit();
FMODreset(); FMODreset();
} }
private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e) private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e)