This commit is contained in:
Perfare 2018-11-14 16:01:52 +08:00
parent a89fd049f1
commit 6d68f2bde5
3 changed files with 10 additions and 7 deletions

View File

@ -538,7 +538,7 @@ namespace AssetStudio
if (combine) if (combine)
{ {
meshR.m_GameObject.TryGetGameObject(out var m_GameObject); meshR.m_GameObject.TryGetGameObject(out var m_GameObject);
var frame = ImportedHelpers.FindChild(m_GameObject.m_Name, FrameList[0]); var frame = ImportedHelpers.FindChildOrRoot(m_GameObject.m_Name, FrameList[0]);
if (frame?.Parent != null) if (frame?.Parent != null)
{ {
var parent = frame; var parent = frame;
@ -596,7 +596,7 @@ namespace AssetStudio
private string GetMeshPath(Transform meshTransform) private string GetMeshPath(Transform meshTransform)
{ {
meshTransform.m_GameObject.TryGetGameObject(out var m_GameObject); meshTransform.m_GameObject.TryGetGameObject(out var m_GameObject);
var curFrame = ImportedHelpers.FindChild(m_GameObject.m_Name, FrameList[0]) ?? ImportedHelpers.FindFrame(m_GameObject.m_Name, FrameList[0]); var curFrame = ImportedHelpers.FindChildOrRoot(m_GameObject.m_Name, FrameList[0]);
var path = curFrame.Name; var path = curFrame.Name;
while (curFrame.Parent != null) while (curFrame.Parent != null)
{ {
@ -1031,7 +1031,7 @@ namespace AssetStudio
{ {
transformName = strs.Last(); transformName = strs.Last();
var parentFrameName = strs[strs.Length - 2]; var parentFrameName = strs[strs.Length - 2];
parentFrame = ImportedHelpers.FindChild(parentFrameName, rootFrame); parentFrame = ImportedHelpers.FindChildOrRoot(parentFrameName, rootFrame);
} }
var skeletonPose = avatar.m_Avatar.m_DefaultPose; var skeletonPose = avatar.m_Avatar.m_DefaultPose;

View File

@ -230,7 +230,7 @@ namespace AssetStudio
{ {
if (!exportFrames->Contains(boneList[i]->Name)) if (!exportFrames->Contains(boneList[i]->Name))
{ {
ImportedFrame^ boneParent = ImportedHelpers::FindFrame(boneList[i]->Name, imported->FrameList[0]); ImportedFrame^ boneParent = ImportedHelpers::FindChildOrRoot(boneList[i]->Name, imported->FrameList[0]);
while (boneParent != nullptr) while (boneParent != nullptr)
{ {
exportFrames->Add(boneParent->Name); exportFrames->Add(boneParent->Name);
@ -754,7 +754,7 @@ namespace AssetStudio
ImportedAnimationKeyframedTrack^ keyframeList = pAnimationList[j]; ImportedAnimationKeyframedTrack^ keyframeList = pAnimationList[j];
String^ name = keyframeList->Name; String^ name = keyframeList->Name;
int dotPos = name->IndexOf('.'); int dotPos = name->IndexOf('.');
if (dotPos >= 0 && !ImportedHelpers::FindFrame(name, imported->FrameList[0])) if (dotPos >= 0 && !ImportedHelpers::FindChildOrRoot(name, imported->FrameList[0]))
{ {
name = name->Substring(0, dotPos); name = name->Substring(0, dotPos);
} }

View File

@ -200,7 +200,7 @@ namespace AssetStudio
return null; return null;
} }
public static ImportedFrame FindChild(string name, ImportedFrame root) public static ImportedFrame FindChildOrRoot(string name, ImportedFrame root)
{ {
foreach (var child in root) foreach (var child in root)
{ {
@ -210,7 +210,10 @@ namespace AssetStudio
return frame; return frame;
} }
} }
if (root.Name == name)
{
return root;
}
return null; return null;
} }