From d1b6f4ae23d8b035c5f629534da59006be69577c Mon Sep 17 00:00:00 2001 From: Tazpn <tazpn@users.sourceforge.net> Date: Sat, 22 Sep 2007 16:15:04 +0000 Subject: [PATCH] Set radius on collision export. Updates to try and minimize nodes created in skeleton only export. --- NifExport/Coll.cpp | 3 +++ NifExport/Util.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NifExport/Coll.cpp b/NifExport/Coll.cpp index 709d8ba..1498b0b 100755 --- a/NifExport/Coll.cpp +++ b/NifExport/Coll.cpp @@ -589,6 +589,9 @@ bhkShapeRef Exporter::makebhkBoxShape(INode *node, Object *obj, Matrix3& tm) Vector3 dim(width * scale[0], length * scale[1], height * scale[2]); + float radius = max( max(dim.x, dim.y), dim.z ); + box->SetRadius(radius); + // Adjust translation for center of z axis in box tm.Translate(Point3(0.0, 0.0, dim.z / 2.0)); box->SetDimensions(dim); diff --git a/NifExport/Util.cpp b/NifExport/Util.cpp index f5a0a24..ce72984 100755 --- a/NifExport/Util.cpp +++ b/NifExport/Util.cpp @@ -452,6 +452,7 @@ void Exporter::getChildNodes(INode *node, vector<NiNodeRef>& list) ObjectState os = node->EvalWorldState(0); bool addBone = false; bool local = !mFlattenHierarchy; + bool meshGroup = isMeshGroup(node); if (node->IsBoneShowing()) { @@ -459,14 +460,17 @@ void Exporter::getChildNodes(INode *node, vector<NiNodeRef>& list) } else if (os.obj && os.obj->SuperClassID()==GEOMOBJECT_CLASS_ID) { + Class_ID clsid = os.obj->ClassID(); if ( os.obj - && ( os.obj->ClassID() == BONE_OBJ_CLASSID - || os.obj->ClassID() == Class_ID(BONE_CLASS_ID,0) - || os.obj->ClassID() == Class_ID(0x00009125,0) /* Biped Twist Helpers */ + && ( clsid == BONE_OBJ_CLASSID + || clsid == Class_ID(BONE_CLASS_ID,0) + || clsid == Class_ID(0x00009125,0) /* Biped Twist Helpers */ ) ) { - addBone = true; + // skip mesh groups in skeleton only situations + if (!meshGroup || !local || !mSkeletonOnly) + addBone = true; } else if (!mSkeletonOnly) { @@ -480,7 +484,7 @@ void Exporter::getChildNodes(INode *node, vector<NiNodeRef>& list) { addBone = true; } - else if (isMeshGroup(node) && local) // only create node if local + else if (meshGroup && local && !mSkeletonOnly) // only create node if local { addBone = true; } -- GitLab