BFRES : Fix bone matching for models with multiple skeletons.

This commit is contained in:
KillzXGaming 2021-04-12 19:49:45 -04:00
parent 1fd81feb22
commit 8a9390cb6c
2 changed files with 15 additions and 9 deletions

View file

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

View file

@ -9,6 +9,9 @@ Keep in mind this tool is still very experimental. If something breaks from a co
## Discord
https://discord.gg/eyvGXWP
## Support
If you'd like to support me, you can [donate!](https://www.paypal.com/donate?business=TCG7P6PH6V3PU&currency_code=USD)
## Features
This tool currently features: