From a8b30de9f9bab1ed0c949c43e3757c3dbd0214ba Mon Sep 17 00:00:00 2001
From: Shon Ferguson <shonferg@users.sourceforge.net>
Date: Sun, 25 Jun 2006 18:15:31 +0000
Subject: [PATCH] Removed code to re-position NiTriBasedGeom nodes as part of
 GoToSkeletonBindPosition since correct vertex positions can now be retrieved
 without doing this.

---
 obj/NiNode.cpp | 70 --------------------------------------------------
 1 file changed, 70 deletions(-)

diff --git a/obj/NiNode.cpp b/obj/NiNode.cpp
index daa96dcf..d6de37b8 100644
--- a/obj/NiNode.cpp
+++ b/obj/NiNode.cpp
@@ -208,74 +208,4 @@ void NiNode::GoToSkeletonBindPosition() {
 			}
 		}
 	}
-
-	//Search for any NiTriBasedGeom classes lower in the scene graph and
-	//reposition them
-	RepositionGeom(this);
-}
-
-void NiNode::RepositionGeom( NiAVObjectRef root ) {
-	//Check if this is a NiTriBasedGeom
-	NiTriBasedGeomRef geom = DynamicCast<NiTriBasedGeom>(root);
-
-	if ( geom != NULL ) {
-		//This is a NiTriBasedGeom class
-		//Get NiSkinInstance and NiSkinData
-
-		NiSkinInstanceRef skin_inst = geom->GetSkinInstance();
-
-		if ( skin_inst == NULL ) {
-			return;
-		}
-
-		NiSkinDataRef skin_data = skin_inst->GetSkinData();
-
-		if ( skin_data == NULL ) {
-			return;
-		}
-
-		//Get bone nodes
-		vector<NiNodeRef> bone_nodes = skin_inst->GetBones();
-
-		//Make sure the counts match
-		if ( bone_nodes.size() != skin_data->GetBoneCount() ) {
-			throw runtime_error( "Bone counts in NiSkinInstance and attached NiSkinData must match" );
-		}
-
-		//There must be at least one bone to do anything
-		if ( bone_nodes.size() == 0 ) {
-			return;
-		}
-
-		//Use first bone (arbitrary choice)
-		Matrix44 offset_mat = skin_data->GetBoneTransform(0);
-			
-		//Get built up rotations to the root of the skeleton from this bone
-		Matrix44 bone_mat = bone_nodes[0]->GetWorldTransform();
-
-		Matrix44 world_mat = offset_mat * bone_mat;
-
-		Matrix44 result_mat = world_mat * geom->GetParent()->GetWorldTransform().Inverse();
-
-		//--Set TriShape Local Position to Result--//
-		geom->SetLocalRotation( result_mat.GetRotation() );
-		geom->SetLocalTranslation( result_mat.GetTranslation() );
-		geom->SetLocalScale( 1.0f );
-
-		//TODO: Calculate the correct adjustment for the NiSkinData overall matrix
-		//due to this change
-
-		return;
-	}
-
-	//Check if this is a NiNode
-	NiNodeRef node = DynamicCast<NiNode>(root);
-	
-	if ( node != NULL ) {
-		//This is a NiNode, call this function on all children
-		vector<NiAVObjectRef> children = node->GetChildren();
-		for ( uint i = 0; i < children.size(); ++i ) {
-			RepositionGeom( children[i] );
-		}
-	}
 }
\ No newline at end of file
-- 
GitLab