From 906149a58aa725ad8117f2ba4aea9dfcffa48e28 Mon Sep 17 00:00:00 2001 From: Perfare Date: Fri, 13 Apr 2018 03:16:09 +0800 Subject: [PATCH] Fixed #177 --- AssetStudio/AssetStudioForm.cs | 5 ++--- AssetStudio/Classes/Mesh.cs | 10 ++-------- AssetStudio/StudioClasses/Studio.cs | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/AssetStudio/AssetStudioForm.cs b/AssetStudio/AssetStudioForm.cs index cce258e..64be1b3 100644 --- a/AssetStudio/AssetStudioForm.cs +++ b/AssetStudio/AssetStudioForm.cs @@ -1744,7 +1744,7 @@ namespace AssetStudio selectedAssets.Add((AssetPreloadData)assetListView.Items[assetListView.SelectedIndices[0]]); showOriginalFileToolStripMenuItem.Visible = true; } - else if (assetListView.SelectedIndices.Count >= 1) + if (assetListView.SelectedIndices.Count >= 1) { selectedAssets.Clear(); foreach (int index in assetListView.SelectedIndices) @@ -1755,7 +1755,6 @@ namespace AssetStudio if (selectedAssets.Any(x => x.Type == ClassIDReference.Animator) && selectedAssets.Any(x => x.Type == ClassIDReference.AnimationClip)) { exportAnimatorwithAnimationClipMenuItem.Visible = true; - } else if (selectedAssets.All(x => x.Type == ClassIDReference.AnimationClip)) { @@ -1819,7 +1818,7 @@ namespace AssetStudio var saveFolderDialog1 = new OpenFolderDialog(); if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK) { - var exportPath = saveFolderDialog1.Folder + "\\Animator\\"; + var exportPath = saveFolderDialog1.Folder + "\\GameObject\\"; ThreadPool.QueueUserWorkItem(state => ForeachTreeNodes(sceneTreeView.Nodes, exportPath)); } } diff --git a/AssetStudio/Classes/Mesh.cs b/AssetStudio/Classes/Mesh.cs index dae4449..dd0a911 100644 --- a/AssetStudio/Classes/Mesh.cs +++ b/AssetStudio/Classes/Mesh.cs @@ -178,8 +178,6 @@ namespace AssetStudio public Vector3 tangent { get; set; } public uint index { get; set; } - public BlendShapeVertex() { } - public BlendShapeVertex(EndianBinaryReader reader) { vertex = reader.ReadVector3(); @@ -196,15 +194,13 @@ namespace AssetStudio public bool hasNormals { get; set; } public bool hasTangents { get; set; } - public MeshBlendShape() { } - public MeshBlendShape(EndianBinaryReader reader) { firstVertex = reader.ReadUInt32(); vertexCount = reader.ReadUInt32(); hasNormals = reader.ReadBoolean(); hasTangents = reader.ReadBoolean(); - reader.ReadBytes(2); + reader.AlignStream(4); } } @@ -215,11 +211,9 @@ namespace AssetStudio public int frameIndex { get; set; } public int frameCount { get; set; } - public MeshBlendShapeChannel() { } - public MeshBlendShapeChannel(EndianBinaryReader reader) { - name = reader.ReadStringToNull(); + name = reader.ReadAlignedString(); nameHash = reader.ReadUInt32(); frameIndex = reader.ReadInt32(); frameCount = reader.ReadInt32(); diff --git a/AssetStudio/StudioClasses/Studio.cs b/AssetStudio/StudioClasses/Studio.cs index 9240100..a96fe78 100644 --- a/AssetStudio/StudioClasses/Studio.cs +++ b/AssetStudio/StudioClasses/Studio.cs @@ -510,13 +510,14 @@ namespace AssetStudio { ThreadPool.QueueUserWorkItem(state => { - var result = false; + bool result; try { result = ExportAnimator(animator, animationList, exportPath); } catch (Exception ex) { + result = false; MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}"); } StatusStripUpdate(result ? "Successfully exported" : "Nothing exported."); @@ -526,7 +527,16 @@ namespace AssetStudio public static void ExportObjectsWithAnimationClip(GameObject gameObject, List animationList, string exportPath) { - var result = ExportGameObject(gameObject, animationList, exportPath); + bool result; + try + { + result = ExportGameObject(gameObject, animationList, exportPath); + } + catch (Exception ex) + { + result = false; + MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}"); + } StatusStripUpdate(result ? "Successfully exported" : "Nothing exported."); } }