From f76d3d8fcd2681750116ef2fc1888b1797ed65a6 Mon Sep 17 00:00:00 2001 From: Perfare Date: Thu, 18 Apr 2019 12:31:16 +0800 Subject: [PATCH] fixed bugs --- AssetStudioFBX/AssetStudioFBXExporter.cpp | 4 ++++ AssetStudioGUI/Studio.cs | 2 ++ AssetStudioUtility/ModelConverter.cs | 25 ++++++++++++++--------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/AssetStudioFBX/AssetStudioFBXExporter.cpp b/AssetStudioFBX/AssetStudioFBXExporter.cpp index c3708b7..6242c58 100644 --- a/AssetStudioFBX/AssetStudioFBXExporter.cpp +++ b/AssetStudioFBX/AssetStudioFBXExporter.cpp @@ -757,6 +757,10 @@ namespace AssetStudio for (int j = 0; j < pAnimationList->Count; j++) { ImportedAnimationKeyframedTrack^ keyframeList = pAnimationList[j]; + if (keyframeList->Path == nullptr) + { + continue; + } FbxNode* pNode = FindNodeByPath(keyframeList->Path); if (pNode != nullptr) { diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index c0f385e..6e97a4a 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -538,6 +538,7 @@ namespace AssetStudioGUI { ThreadPool.QueueUserWorkItem(state => { + Progress.Reset(); Logger.Info($"Exporting {animator.Text}"); try { @@ -546,6 +547,7 @@ namespace AssetStudioGUI { Process.Start(exportPath); } + Progress.Report(1, 1); Logger.Info($"Finished exporting {animator.Text}"); } catch (Exception ex) diff --git a/AssetStudioUtility/ModelConverter.cs b/AssetStudioUtility/ModelConverter.cs index a858d77..e579df9 100644 --- a/AssetStudioUtility/ModelConverter.cs +++ b/AssetStudioUtility/ModelConverter.cs @@ -677,9 +677,22 @@ namespace AssetStudio foreach (var animationClip in animationClipHashSet) { var iAnim = new ImportedKeyframedAnimation(); - AnimationList.Add(iAnim); - iAnim.Name = animationClip.m_Name; + var name = animationClip.m_Name; + if (AnimationList.Exists(x => x.Name == name)) + { + for (int i = 1; ; i++) + { + var fixName = name + $"_{i}"; + if (!AnimationList.Exists(x => x.Name == fixName)) + { + name = fixName; + break; + } + } + } + iAnim.Name = name; iAnim.TrackList = new List(); + AnimationList.Add(iAnim); if (animationClip.m_Legacy) { foreach (var m_CompressedRotationCurve in animationClip.m_CompressedRotationCurves) @@ -740,14 +753,6 @@ namespace AssetStudio } } } - /*foreach (var m_FloatCurve in animationClip.m_FloatCurves) - { - var track = iAnim.FindTrack(m_FloatCurve.path); - foreach (var m_Curve in m_FloatCurve.curve.m_Curve) - { - track.Curve.Add(new ImportedKeyframe(m_Curve.time, m_Curve.value)); - } - }*/ } else {