add -ignore

This commit is contained in:
David Rose 2002-08-30 19:16:16 +00:00
parent 732f747bee
commit cac8df8ea5
6 changed files with 25 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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;
}

View File

@ -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";