Revert GetActiveSkeleton() as it causes animation export issues.

Since bfres has no real way to actively tell what animation uses which skeleton, I will need to do a UI in another update to select which model to export with.
This commit is contained in:
KillzXGaming 2021-06-12 11:12:16 -04:00
parent 06e835fd3d
commit a425bd6a6e

View file

@ -227,23 +227,20 @@ namespace Bfres.Structs
private STSkeleton GetActiveSkeleton() private STSkeleton GetActiveSkeleton()
{ {
var viewport = LibraryGUI.GetActiveViewport(); var viewport = LibraryGUI.GetActiveViewport();
foreach (var drawable in viewport.scene.objects) if (viewport != null)
{ {
if (drawable is STSkeleton) foreach (var drawable in viewport.scene.objects)
{ {
bool hasMatchingBoneset = true; if (drawable is STSkeleton)
foreach (var bone in Bones)
{ {
var animBone = ((STSkeleton)drawable).GetBone(bone.Text); foreach (var bone in Bones)
if (animBone == null) { {
hasMatchingBoneset = false; var animBone = ((STSkeleton)drawable).GetBone(bone.Text);
continue;
if (animBone != null)
return (STSkeleton)drawable;
} }
} }
//Animation has all bones present in skeleton
if (hasMatchingBoneset)
return (STSkeleton)drawable;
} }
} }