From 2de4051fea759804db768cee96bb30e2da3d8cd7 Mon Sep 17 00:00:00 2001 From: "Asad M. Zaman" Date: Thu, 23 Dec 2004 00:42:43 +0000 Subject: [PATCH] incorporated new method to getWeights from cluster. the nurbSurface getweights is not tested though! hopefully it will work. --- pandatool/src/mayaegg/mayaToEggConverter.cxx | 145 +++++++++++++------ 1 file changed, 99 insertions(+), 46 deletions(-) diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index 3417b6a059..094fead575 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -51,6 +51,8 @@ #include #include #include +#include +#include #include #include #include @@ -1948,7 +1950,7 @@ get_vertex_weights(const MDagPath &dag_path, const MFnMesh &mesh, // creates the mesh is named "inMesh" // MObject attr = mesh.attribute("inMesh"); - + // Create the plug to the "inMesh" attribute then use the // DG iterator to walk through the DG, at the node level. // @@ -1963,6 +1965,7 @@ get_vertex_weights(const MDagPath &dag_path, const MFnMesh &mesh, // spot a skinCluster node. // MObject c_node = it.thisNode(); + //mayaegg_cat.info() << "thisNode type: " << c_node.apiTypeStr() << endl; if (c_node.hasFn(MFn::kSkinClusterFilter)) { // We've found the cluster handle. Try to get the weight // data. @@ -1973,10 +1976,13 @@ get_vertex_weights(const MDagPath &dag_path, const MFnMesh &mesh, return false; } + mayaegg_cat.info() << "getting weights of mesh: " << dag_path.fullPathName() << endl; + mayaegg_cat.info() << "and cluster: " << cluster.name() << endl; + // Get the set of objects that influence the vertices of this // mesh. Hopefully these will all be joints. MDagPathArray influence_objects; - cluster.influenceObjects(influence_objects, &status); + cluster.influenceObjects(influence_objects, &status); if (!status) { status.perror("MFnSkinCluster::influenceObjects"); @@ -1984,36 +1990,59 @@ get_vertex_weights(const MDagPath &dag_path, const MFnMesh &mesh, // Fill up the vector with the corresponding table of egg // groups for each joint. joints.clear(); + int numWeights = 0; for (unsigned oi = 0; oi < influence_objects.length(); oi++) { MDagPath joint_dag_path = influence_objects[oi]; + //mayaegg_cat.info() << "influence joint[" << oi << "]:" << joint_dag_path.partialPathName() <