Browse Source

add -ignore

David Rose 23 years ago
parent
commit
cac8df8ea5

+ 5 - 1
pandatool/src/converter/somethingToEggConverter.cxx

@@ -28,6 +28,7 @@
 ////////////////////////////////////////////////////////////////////
 SomethingToEggConverter::
 SomethingToEggConverter() {
+  _allow_errors = false;
   _tpc = PC_absolute;
   _mpc = PC_absolute;
   _merge_externals = false;
@@ -43,6 +44,7 @@ SomethingToEggConverter() {
 ////////////////////////////////////////////////////////////////////
 SomethingToEggConverter::
 SomethingToEggConverter(const SomethingToEggConverter &copy) :
+  _allow_errors(copy._allow_errors),
   _tpc(copy._tpc),
   _tpc_directory(copy._tpc_directory),
   _mpc(copy._mpc),
@@ -124,7 +126,9 @@ handle_external_reference(EggGroupNode *egg_parent,
     if (!ext->convert_file(as_found)) {
       delete ext;
       nout << "Unable to read external reference: " << orig_filename << "\n";
-      _error = true;
+      if (!_allow_errors) {
+        _error = true;
+      }
       return false;
     }
 

+ 4 - 0
pandatool/src/converter/somethingToEggConverter.h

@@ -89,6 +89,10 @@ public:
                                PathConvert path_convert);
 
 
+  // Set this true to treat errors as warnings and generate output
+  // anyway.
+  bool _allow_errors;
+
 protected:
   PathConvert _tpc;
   Filename _tpc_directory;

+ 5 - 0
pandatool/src/eggbase/somethingToEgg.cxx

@@ -51,6 +51,11 @@ SomethingToEgg(const string &format_name,
      "Specify the coordinate system of the input " + _format_name +
      " file.  Normally, this can inferred from the file itself.");
 
+  add_option
+    ("ignore", "", 0,
+     "Ignore non-fatal errors and generate an egg file anyway.",
+     &SomethingToEgg::dispatch_none, &_allow_errors);
+
   _input_units = DU_invalid;
   _output_units = DU_invalid;
   _texture_path_convert = SomethingToEggConverter::PC_unchanged;

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

@@ -77,6 +77,7 @@ protected:
   bool _append_to_sys_paths;
 
   bool _merge_externals;
+  bool _allow_errors;
 };
 
 #endif

+ 9 - 3
pandatool/src/fltegg/fltToEggConverter.cxx

@@ -663,7 +663,9 @@ parse_comment(const string &comment, const string &name,
   if (p >= comment.length() || comment[p] != '{') {
     nout << "No opening brace in comment for "
          << name << "\n\n";
-    _error = true;
+    if (!_allow_errors) {
+      _error = true;
+    }
     return false;
   }
 
@@ -677,7 +679,9 @@ parse_comment(const string &comment, const string &name,
   if (q == p) {
     nout << "No closing brace in comment for "
          << name << "\n\n";
-    _error = true;
+    if (!_allow_errors) {
+      _error = true;
+    }
     return false;
   }
 
@@ -686,7 +690,9 @@ parse_comment(const string &comment, const string &name,
   if (!egg_node->parse_egg(egg_syntax)) {
     nout << "Syntax error in comment for "
          << name << "\n\n";
-    _error = true;
+    if (!_allow_errors) {
+      _error = true;
+    }
     return false;
   }
 

+ 1 - 0
pandatool/src/fltprogs/fltToEgg.cxx

@@ -90,6 +90,7 @@ run() {
   converter.set_texture_path_convert(_texture_path_convert, _make_rel_dir);
   converter.set_model_path_convert(_model_path_convert, _make_rel_dir);
   converter._compose_transforms = _compose_transforms;
+  converter._allow_errors = _allow_errors;
 
   if (!converter.convert_flt(header)) {
     nout << "Errors in conversion.\n";