Răsfoiți Sursa

*** empty log message ***

David Rose 25 ani în urmă
părinte
comite
ce7cc4526b

+ 18 - 5
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;
 }

+ 2 - 0
pandatool/src/eggbase/eggMultiBase.h

@@ -38,6 +38,8 @@ protected:
 
   typedef vector<EggData *> Eggs;
   Eggs _eggs;
+
+  bool _force_complete;
 };
 
 #endif

+ 1 - 0
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);

+ 12 - 0
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;

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

@@ -23,6 +23,7 @@ public:
 protected:
   virtual bool handle_args(Args &args);
 
+  bool _force_complete;
 };
 
 #endif