From ebd2fd2f012a834a2e89de8f5206ea6901ac7c78 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Thu, 11 Aug 2005 18:02:39 +0000 Subject: [PATCH] Fixed a bug (wasn't clearing skin weights of unused bones) --- pandatool/src/mayaeggimport/mayaEggLoader.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pandatool/src/mayaeggimport/mayaEggLoader.cxx b/pandatool/src/mayaeggimport/mayaEggLoader.cxx index 74d13446d4..55f58df45e 100755 --- a/pandatool/src/mayaeggimport/mayaEggLoader.cxx +++ b/pandatool/src/mayaeggimport/mayaEggLoader.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -644,10 +645,18 @@ void MayaEggLoader::CreateSkinCluster(MayaEggMesh *M) influenceIndices.append((int)index); } - MFloatArray values, oldvalues; + MDagPathArray paths; + unsigned infcount = skinCluster.influenceObjects(paths, &status); + if (status != MStatus::kSuccess) { perror("influenceObjects"); return; } + for (unsigned int i=0; i_shape_dag_path, component.object(), index, 0.0, false, NULL); + } + + MFloatArray values; int tot = M->_vert_count * joints.size(); values.setLength(tot); - oldvalues.setLength(tot); for (int i=0; i_vert_tab.begin(); vert != M->_vert_tab.end(); ++vert) { for (unsigned int i=0; i_weights.size(); i++) { @@ -656,9 +665,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggMesh *M) values[vert->_index * joints.size() + joint->_index] = (float)strength; } } - // for (unsigned int i=0; i<1024; i++) - // skinCluster.setWeights(M->_shape_dag_path, component.object(), i, 0.0, false, &oldvalues); - skinCluster.setWeights(M->_shape_dag_path, component.object(), influenceIndices, values, false, &oldvalues); + skinCluster.setWeights(M->_shape_dag_path, component.object(), influenceIndices, values, false, NULL); for (unsigned int i=0; i_inskin = false;