Browse Source

Fix inoperative -tbn/-tbnall/-tbnauto options in egg-optchar

rdb 9 years ago
parent
commit
aa74caacbe
2 changed files with 28 additions and 0 deletions
  1. 1 0
      doc/ReleaseNotes
  2. 27 0
      pandatool/src/eggbase/eggMultiBase.cxx

+ 1 - 0
doc/ReleaseNotes

@@ -37,6 +37,7 @@ This issue fixes several bugs that were still found in 1.9.2.
 * Fix asyncFlattenStrong called on nodes without parent
 * Fix is_playing() check when playing an animation backwards
 * Windows installer no longer clears %PATH% if longer than 1024 chars
+* Fix inoperative -tbn/-tbnall/-tbnauto options in egg-optchar
 
 ------------------------  RELEASE 1.9.2  ------------------------
 

+ 27 - 0
pandatool/src/eggbase/eggMultiBase.cxx

@@ -111,6 +111,33 @@ post_process_egg_files() {
     // Do nothing.
     break;
   }
+
+  if (_got_tbnall) {
+    for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
+      if ((*ei)->recompute_tangent_binormal(GlobPattern("*"))) {
+        (*ei)->remove_unused_vertices(true);
+      }
+    }
+  } else {
+    if (_got_tbnauto) {
+      for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
+        if ((*ei)->recompute_tangent_binormal_auto()) {
+          (*ei)->remove_unused_vertices(true);
+        }
+      }
+    }
+
+    for (vector_string::const_iterator si = _tbn_names.begin();
+         si != _tbn_names.end();
+         ++si) {
+      GlobPattern uv_name(*si);
+      nout << "Computing tangent and binormal for \"" << uv_name << "\"\n";
+      for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
+        (*ei)->recompute_tangent_binormal(uv_name);
+        (*ei)->remove_unused_vertices(true);
+      }
+    }
+  }
 }