From 1bf10f271416f2df701086eb779052971b89c1c0 Mon Sep 17 00:00:00 2001
From: Amorilia <amorilia@users.sourceforge.net>
Date: Mon, 30 Jan 2006 01:41:35 +0000
Subject: [PATCH] workaround in SkeletonRootAttr to extract correct skeleton
 root also for BabelFish.nif; probably needs some more testing

---
 nif_attrs.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/nif_attrs.h b/nif_attrs.h
index 5323f010..e12e44ac 100644
--- a/nif_attrs.h
+++ b/nif_attrs.h
@@ -1233,7 +1233,15 @@ public:
 				flags = par->GetAttr("Flags")->asInt();
 
 				if ( (flags & 8) != 0 ) {
-					return par;
+					// extra check: skeleton root cannot be a bone (this fixes the BabelFish.nif problem)
+					int par_is_bone = false;
+					for ( vector<blk_ref>::const_iterator it = bones.begin(); it != bones.end(); ++it) {
+						if ( *it == par ) {
+							par_is_bone = true;
+							break;
+						};
+					}
+					if ( ! par_is_bone ) return par;
 				}
 			}
 
-- 
GitLab