From 9fef3a1f4f0367718d7ea111f719b6738d6abbfb Mon Sep 17 00:00:00 2001
From: Alecu100 <lui_alecu@yahoo.co.uk>
Date: Tue, 14 Feb 2012 23:27:17 +0200
Subject: [PATCH] made more changes to the complex shape to prepare it for
 skyrim and fallout 3 support

---
 include/ComplexShape.h |  3 +--
 src/ComplexShape.cpp   | 13 ++++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/ComplexShape.h b/include/ComplexShape.h
index 47c2711a..ede2cdac 100644
--- a/include/ComplexShape.h
+++ b/include/ComplexShape.h
@@ -182,8 +182,7 @@ public:
 		int max_bones_per_partition = 4,
 		bool stripify = false,
 		bool tangent_space = false,
-		float min_vertex_weight = 0.001f,
-		bool use_dismember_partitions = false
+		float min_vertex_weight = 0.001f
 	) const;
 
 	/* 
diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp
index b7b3b6ff..8a469c76 100644
--- a/src/ComplexShape.cpp
+++ b/src/ComplexShape.cpp
@@ -698,17 +698,24 @@ void ComplexShape::Merge( NiAVObject * root ) {
 	//Done Merging
 }
 
-Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int max_bones_per_partition, bool stripify, bool tangent_space, float min_vertex_weight, bool use_dismember_partitions ) const {
+Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int max_bones_per_partition, bool stripify, bool tangent_space, float min_vertex_weight ) const {
 
 	//Make sure parent is not NULL
 	if ( parent == NULL ) {
 		throw runtime_error ("A parent is necessary to split a complex shape.");
 	}
 
-	if( use_dismember_partitions == true ) {
-		if(dismemberPartitionsFaces.size() != faces.size()) {
+	bool use_dismember_partitions = false;
+
+	if( dismemberPartitionsFaces.size() > 0 ) {
+		if( dismemberPartitionsFaces.size() != faces.size() ) {
 			throw runtime_error ("The number of faces mapped to skin partitions is different from the actual face count.");
 		}
+		if(dismemberPartitionsBodyParts.size() == 0) {
+			throw runtime_error ("The number of dismember partition body parts can't be 0.");
+		}
+
+		use_dismember_partitions = true;
 	}
 	
 	//There will be one NiTriShape per property group
-- 
GitLab