David Rose %!s(int64=20) %!d(string=hai) anos
pai
achega
2362924423

+ 7 - 3
pandatool/src/eggbase/eggBase.cxx

@@ -91,14 +91,18 @@ add_normals_options() {
   add_option
     ("tbn", "name", 48,
      "Compute tangent and binormal for the named texture coordinate "
-     "set(s).  The name may include wildcard characters such as * and ?; "
-     "use \"*\" to recompute tangent and binormal for all texture coordinate "
-     "sets.  "
+     "set(s).  The name may include wildcard characters such as * and ?.  "
      "The normal must already exist or have been computed via one of the "
      "above options.  The tangent and binormal are used to implement "
      "bump mapping and related texture-based lighting effects.  This option "
      "may be repeated as necessary to name multiple texture coordinate sets.",
      &EggBase::dispatch_vector_string, NULL, &_tbn_names);
+
+  add_option
+    ("tbnall", "", 48,
+     "Compute tangent and binormal for all texture coordinate "
+     "set(s).  This is equivalent to -tbn \"*\".",
+     &EggBase::dispatch_none, &_got_tbnall);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
pandatool/src/eggbase/eggBase.h

@@ -67,6 +67,7 @@ protected:
   NormalsMode _normals_mode;
   double _normals_threshold;
   vector_string _tbn_names;
+  bool _got_tbnall;
 
   bool _got_transform;
   LMatrix4d _transform;

+ 12 - 6
pandatool/src/eggbase/eggWriter.cxx

@@ -163,12 +163,18 @@ post_process_egg_file() {
     break;
   }
 
-  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";
-    _data->recompute_tangent_binormal(uv_name);
+  if (_got_tbnall) {
+    nout << "Computing tangent and binormal for all UV sets.\n";
+    _data->recompute_tangent_binormal(GlobPattern("*"));
+
+  } else {
+    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";
+      _data->recompute_tangent_binormal(uv_name);
+    }
   }
 }