Browse Source

pseudo joint marking bug fixed

Asad M. Zaman 19 years ago
parent
commit
cdf8d3ea7f
2 changed files with 28 additions and 12 deletions
  1. 18 5
      pandatool/src/mayaegg/mayaNodeDesc.cxx
  2. 10 7
      pandatool/src/mayaegg/mayaToEggConverter.cxx

+ 18 - 5
pandatool/src/mayaegg/mayaNodeDesc.cxx

@@ -369,11 +369,11 @@ mark_joint_parent() {
 void MayaNodeDesc::
 check_pseudo_joints(bool joint_above) {
   static uint32 space_count = 0;
+  string space;
+  for (uint32 idx=0; idx<space_count; ++idx) {
+    space.append(" ");
+  }
   if (mayaegg_cat.is_spam()) {
-    string space;
-    for (uint32 idx=0; idx<space_count; ++idx) {
-      space.append(" ");
-    }
     mayaegg_cat.spam() << "cpj:" << space << get_name() << " joint_type: " << _joint_type << endl;
   }
   if (_joint_type == JT_joint_parent && joint_above) {
@@ -413,11 +413,24 @@ check_pseudo_joints(bool joint_above) {
       bool all_joints = true;
       for (ci = _children.begin(); ci != _children.end(); ++ci) {
         MayaNodeDesc *child = (*ci);
+        MStatus status;
+        MFnDagNode dag_node(child->get_dag_path(), &status);
+        if (!status) {
+          status.perror("MFnDagNode constructor");
+        }
+        string type_name = dag_node.typeName().asChar();
         if (child->_joint_type == JT_joint_parent) {
           child->_joint_type = JT_pseudo_joint;
         } else if (child->_joint_type == JT_none) {
-          if (!child->get_dag_path().hasFn(MFn::kCamera))
+          if (mayaegg_cat.is_spam()) {
+            mayaegg_cat.spam() << "cpj: " << space << "jt_none for " << child->get_name() << endl;
+          }
+          if (type_name.find("transform") == string::npos) {
+            if (mayaegg_cat.is_spam()) {
+              mayaegg_cat.spam() << "cpj: " << space << "all_joints false for " << get_name() << endl;
+            }
             all_joints = false;
+          }
         }
       }
 

+ 10 - 7
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -860,16 +860,16 @@ process_model_node(MayaNodeDesc *node_desc) {
     
     // Extract some interesting Camera data
     if (mayaegg_cat.is_spam()) {
-      mayaegg_cat.info() << "  eyePoint: "
+      mayaegg_cat.spam() << "  eyePoint: "
                          << camera.eyePoint(MSpace::kWorld) << endl;
-      mayaegg_cat.info() << "  upDirection: "
+      mayaegg_cat.spam() << "  upDirection: "
                          << camera.upDirection(MSpace::kWorld) << endl;
-      mayaegg_cat.info() << "  viewDirection: "
+      mayaegg_cat.spam() << "  viewDirection: "
                          << camera.viewDirection(MSpace::kWorld) << endl;
-      mayaegg_cat.info() << "  aspectRatio: " << camera.aspectRatio() << endl;
-      mayaegg_cat.info() << "  horizontalFilmAperture: "
+      mayaegg_cat.spam() << "  aspectRatio: " << camera.aspectRatio() << endl;
+      mayaegg_cat.spam() << "  horizontalFilmAperture: "
                          << camera.horizontalFilmAperture() << endl;
-      mayaegg_cat.info() << "  verticalFilmAperture: "
+      mayaegg_cat.spam() << "  verticalFilmAperture: "
                          << camera.verticalFilmAperture() << endl;
     }
 
@@ -1000,7 +1000,10 @@ get_transform(MayaNodeDesc *node_desc, const MDagPath &dag_path,
     // for joints, and they get converted in a special way.
 
     if (node_desc->is_joint()) {
-      //mayaegg_cat.info() << "gt: " << node_desc->get_name() << endl;
+      if (mayaegg_cat.is_spam()) {
+        mayaegg_cat.spam()
+          << "gt: joint " << node_desc->get_name() << "\n";
+      }
       get_joint_transform(dag_path, egg_group);
     }
     return;