UI improvements

This commit is contained in:
Perfare
2018-04-18 07:11:10 +08:00
parent 592bfb64e7
commit ed569bfaf8
9 changed files with 170 additions and 213 deletions
+5 -13
View File
@@ -298,7 +298,7 @@ namespace AssetStudio
public static bool ExportRawFile(AssetPreloadData asset, string exportPath)
{
var exportFullName = exportPath + asset.Text + asset.extension;
var exportFullName = exportPath + asset.Text + ".dat";
if (ExportFileExists(exportFullName))
return false;
var bytes = asset.InitReader().ReadBytes(asset.Size);
@@ -316,25 +316,17 @@ namespace AssetStudio
return false;
}
public static bool ExportAnimator(AssetPreloadData animator, string exportPath)
public static bool ExportAnimator(AssetPreloadData animator, string exportPath, List<AssetPreloadData> animationList = null)
{
var m_Animator = new Animator(animator);
var convert = new ModelConverter(m_Animator);
var convert = animationList != null ? new ModelConverter(m_Animator, animationList) : new ModelConverter(m_Animator);
exportPath = exportPath + Studio.FixFileName(animator.Text) + ".fbx";
return ModelConverter(convert, exportPath);
}
public static bool ExportAnimator(AssetPreloadData animator, List<AssetPreloadData> animationList, string exportPath)
public static bool ExportGameObject(GameObject gameObject, string exportPath, List<AssetPreloadData> animationList = null)
{
var m_Animator = new Animator(animator);
var convert = new ModelConverter(m_Animator, animationList);
exportPath = exportPath + Studio.FixFileName(animator.Text) + ".fbx";
return ModelConverter(convert, exportPath);
}
public static bool ExportGameObject(GameObject gameObject, List<AssetPreloadData> animationList, string exportPath)
{
var convert = new ModelConverter(gameObject, animationList);
var convert = animationList != null ? new ModelConverter(gameObject, animationList) : new ModelConverter(gameObject);
exportPath = exportPath + Studio.FixFileName(gameObject.Text) + ".fbx";
return ModelConverter(convert, exportPath);
}
+25 -11
View File
@@ -205,9 +205,8 @@ namespace AssetStudio
break;
}
}
if (!exportable && displayAll)
if (displayAll)
{
asset.extension = ".dat";
exportable = true;
}
if (exportable)
@@ -556,34 +555,49 @@ namespace AssetStudio
{
ThreadPool.QueueUserWorkItem(state =>
{
bool result;
StatusStripUpdate($"Exporting {animator.Text}");
try
{
result = ExportAnimator(animator, animationList, exportPath);
ExportAnimator(animator, exportPath, animationList);
StatusStripUpdate($"Finished exporting {animator.Text}");
}
catch (Exception ex)
{
result = false;
MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}");
StatusStripUpdate("Error in export");
}
StatusStripUpdate(result ? "Successfully exported" : "Nothing exported.");
ProgressBarPerformStep();
});
}
public static void ExportObjectsWithAnimationClip(GameObject gameObject, List<AssetPreloadData> animationList, string exportPath)
public static void ExportObjectsWithAnimationClip(GameObject gameObject, string exportPath, List<AssetPreloadData> animationList = null)
{
bool result;
StatusStripUpdate($"Exporting {gameObject.Text}");
try
{
result = ExportGameObject(gameObject, animationList, exportPath);
ExportGameObject(gameObject, exportPath, animationList);
StatusStripUpdate($"Finished exporting {gameObject.Text}");
}
catch (Exception ex)
{
result = false;
MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}");
StatusStripUpdate("Error in export");
}
}
public static void ForeachTreeNodes(TreeNodeCollection nodes, string exportPath, Action<GameObject> action)
{
foreach (TreeNode i in nodes)
{
if (i.Checked)
{
action((GameObject)i);
}
else
{
ForeachTreeNodes(i.Nodes, exportPath, action);
}
}
StatusStripUpdate(result ? "Successfully exported" : "Nothing exported.");
}
}
}