diff --git a/pandatool/src/eggbase/eggMultiBase.cxx b/pandatool/src/eggbase/eggMultiBase.cxx index cc5c24d368..7d2a4d64f5 100644 --- a/pandatool/src/eggbase/eggMultiBase.cxx +++ b/pandatool/src/eggbase/eggMultiBase.cxx @@ -22,6 +22,12 @@ EggMultiBase() { "'y-up', 'z-up', 'y-up-left', or 'z-up-left'.", &EggMultiBase::dispatch_coordinate_system, &_got_coordinate_system, &_coordinate_system); + + add_option + ("f", "", 80, + "Force complete loading: load up the egg file along with all of its " + "external references.", + &EggMultiBase::dispatch_none, &_force_complete); } @@ -94,11 +100,18 @@ append_command_comment(EggData &data) { EggData *EggMultiBase:: read_egg(const Filename &filename) { EggData *data = new EggData; - if (data->read(filename)) { - return data; + if (!data->read(filename)) { + // Failure reading. + delete data; + return (EggData *)NULL; } - // Failure reading. - delete data; - return (EggData *)NULL; + if (_force_complete) { + if (!data->resolve_externals()) { + delete data; + return (EggData *)NULL; + } + } + + return data; } diff --git a/pandatool/src/eggbase/eggMultiBase.h b/pandatool/src/eggbase/eggMultiBase.h index 0b30b2fb74..818e30afa8 100644 --- a/pandatool/src/eggbase/eggMultiBase.h +++ b/pandatool/src/eggbase/eggMultiBase.h @@ -38,6 +38,8 @@ protected: typedef vector Eggs; Eggs _eggs; + + bool _force_complete; }; #endif diff --git a/pandatool/src/eggbase/eggMultiFilter.cxx b/pandatool/src/eggbase/eggMultiFilter.cxx index 754a1ea0c9..0e36b06577 100644 --- a/pandatool/src/eggbase/eggMultiFilter.cxx +++ b/pandatool/src/eggbase/eggMultiFilter.cxx @@ -152,6 +152,7 @@ write_eggs() { nassertv(_inplace); } + nout << "Writing " << filename << "\n"; if (!data->write_egg(filename)) { // Error writing an egg file; abort. exit(1); diff --git a/pandatool/src/eggbase/eggReader.cxx b/pandatool/src/eggbase/eggReader.cxx index 692c74e247..b23fd9bf35 100644 --- a/pandatool/src/eggbase/eggReader.cxx +++ b/pandatool/src/eggbase/eggReader.cxx @@ -20,6 +20,12 @@ EggReader() { "Specify the coordinate system to operate in. This may be " " one of 'y-up', 'z-up', 'y-up-left', or 'z-up-left'. The default " "is the coordinate system of the input egg file."); + + add_option + ("f", "", 80, + "Force complete loading: load up the egg file along with all of its " + "external references.", + &EggReader::dispatch_none, &_force_complete); } //////////////////////////////////////////////////////////////////// @@ -45,6 +51,12 @@ handle_args(ProgramBase::Args &args) { // just because we got a bad egg file. exit(1); } + + if (_force_complete) { + if (!_data.resolve_externals()) { + exit(1); + } + } } return true; diff --git a/pandatool/src/eggbase/eggReader.h b/pandatool/src/eggbase/eggReader.h index 65a752c4da..9954ea2310 100644 --- a/pandatool/src/eggbase/eggReader.h +++ b/pandatool/src/eggbase/eggReader.h @@ -23,6 +23,7 @@ public: protected: virtual bool handle_args(Args &args); + bool _force_complete; }; #endif