Browse Source

use PT(EggData) instead of concrete EggData

David Rose 21 years ago
parent
commit
ff6b6dad89
38 changed files with 107 additions and 114 deletions
  1. 4 4
      pandatool/src/bam/bamToEgg.cxx
  2. 1 1
      pandatool/src/bam/eggToBam.cxx
  3. 3 3
      pandatool/src/converter/somethingToEggConverter.I
  4. 6 15
      pandatool/src/converter/somethingToEggConverter.cxx
  5. 3 4
      pandatool/src/converter/somethingToEggConverter.h
  6. 1 1
      pandatool/src/dxfegg/dxfToEggConverter.cxx
  7. 2 2
      pandatool/src/dxfprogs/dxfToEgg.cxx
  8. 1 1
      pandatool/src/dxfprogs/eggToDXF.cxx
  9. 2 2
      pandatool/src/egg-qtess/eggQtess.cxx
  10. 3 3
      pandatool/src/eggbase/eggBase.cxx
  11. 2 2
      pandatool/src/eggbase/eggBase.h
  12. 1 1
      pandatool/src/eggbase/eggMultiFilter.cxx
  13. 4 4
      pandatool/src/eggbase/eggReader.cxx
  14. 4 2
      pandatool/src/eggbase/eggSingleBase.cxx
  15. 2 1
      pandatool/src/eggbase/eggSingleBase.h
  16. 9 9
      pandatool/src/eggbase/eggWriter.cxx
  17. 2 2
      pandatool/src/eggbase/somethingToEgg.cxx
  18. 1 1
      pandatool/src/eggbase/somethingToEgg.h
  19. 2 2
      pandatool/src/eggprogs/eggCrop.cxx
  20. 1 1
      pandatool/src/eggprogs/eggMakeTube.cxx
  21. 1 1
      pandatool/src/eggprogs/eggTextureCards.cxx
  22. 7 7
      pandatool/src/eggprogs/eggToC.cxx
  23. 10 10
      pandatool/src/eggprogs/eggTrans.cxx
  24. 1 1
      pandatool/src/fltprogs/eggToFlt.cxx
  25. 2 2
      pandatool/src/fltprogs/fltToEgg.cxx
  26. 1 1
      pandatool/src/lwoegg/cLwoLayer.cxx
  27. 1 1
      pandatool/src/lwoegg/cLwoPolygons.cxx
  28. 2 2
      pandatool/src/lwoprogs/lwoToEgg.cxx
  29. 7 7
      pandatool/src/mayaegg/mayaToEggConverter.cxx
  30. 3 3
      pandatool/src/mayaprogs/mayaPview.cxx
  31. 2 2
      pandatool/src/mayaprogs/mayaToEgg.cxx
  32. 5 5
      pandatool/src/ptloader/loaderFileTypePandatool.cxx
  33. 1 1
      pandatool/src/vrmlegg/vrmlToEggConverter.cxx
  34. 2 2
      pandatool/src/vrmlprogs/vrmlToEgg.cxx
  35. 2 2
      pandatool/src/xfileegg/xFileAnimationSet.cxx
  36. 3 3
      pandatool/src/xfileegg/xFileMaker.cxx
  37. 1 1
      pandatool/src/xfileegg/xFileMaker.h
  38. 2 2
      pandatool/src/xfileprogs/xFileToEgg.cxx

+ 4 - 4
pandatool/src/bam/bamToEgg.cxx

@@ -101,15 +101,15 @@ run() {
   bam_file.resolve();
   bam_file.resolve();
   bam_file.close();
   bam_file.close();
 
 
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
   _vpool = new EggVertexPool("vpool");
   _vpool = new EggVertexPool("vpool");
-  _data.add_child(_vpool);
+  _data->add_child(_vpool);
 
 
   if (objects.size() == 1 && 
   if (objects.size() == 1 && 
       objects[0]->is_of_type(PandaNode::get_class_type())) {
       objects[0]->is_of_type(PandaNode::get_class_type())) {
     PandaNode *node = DCAST(PandaNode, objects[0]);
     PandaNode *node = DCAST(PandaNode, objects[0]);
     NodePath root(node);
     NodePath root(node);
-    convert_node(WorkingNodePath(root), &_data, false);
+    convert_node(WorkingNodePath(root), _data, false);
 
 
   } else {
   } else {
     nout << "File does not contain a scene graph.\n";
     nout << "File does not contain a scene graph.\n";
@@ -118,7 +118,7 @@ run() {
 
 
   // Remove the vertex pool if it has no vertices.
   // Remove the vertex pool if it has no vertices.
   if (_vpool->empty()) {
   if (_vpool->empty()) {
-    _data.remove_child(_vpool);
+    _data->remove_child(_vpool);
   }
   }
 
 
   write_egg_file();
   write_egg_file();

+ 1 - 1
pandatool/src/bam/eggToBam.cxx

@@ -154,7 +154,7 @@ run() {
   if (!_got_coordinate_system) {
   if (!_got_coordinate_system) {
     // If the user didn't specify otherwise, ensure the coordinate
     // If the user didn't specify otherwise, ensure the coordinate
     // system is Z-up.
     // system is Z-up.
-    _data.set_coordinate_system(CS_zup_right);
+    _data->set_coordinate_system(CS_zup_right);
   }
   }
 
 
   PT(PandaNode) root = load_egg_data(_data);
   PT(PandaNode) root = load_egg_data(_data);

+ 3 - 3
pandatool/src/converter/somethingToEggConverter.I

@@ -487,7 +487,7 @@ get_merge_externals() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 INLINE void SomethingToEggConverter::
 INLINE void SomethingToEggConverter::
 clear_egg_data() {
 clear_egg_data() {
-  set_egg_data((EggData *)NULL, false);
+  set_egg_data((EggData *)NULL);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -495,9 +495,9 @@ clear_egg_data() {
 //       Access: Public
 //       Access: Public
 //  Description: Returns the EggData structure.
 //  Description: Returns the EggData structure.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
-INLINE EggData &SomethingToEggConverter::
+INLINE EggData *SomethingToEggConverter::
 get_egg_data() {
 get_egg_data() {
-  return *_egg_data;
+  return _egg_data;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 6 - 15
pandatool/src/converter/somethingToEggConverter.cxx

@@ -41,7 +41,6 @@ SomethingToEggConverter() {
   _control_flags = 0;
   _control_flags = 0;
   _merge_externals = false;
   _merge_externals = false;
   _egg_data = (EggData *)NULL;
   _egg_data = (EggData *)NULL;
-  _owns_egg_data = false;
   _error = false;
   _error = false;
 }
 }
 
 
@@ -57,7 +56,6 @@ SomethingToEggConverter(const SomethingToEggConverter &copy) :
   _merge_externals(copy._merge_externals)
   _merge_externals(copy._merge_externals)
 {
 {
   _egg_data = (EggData *)NULL;
   _egg_data = (EggData *)NULL;
-  _owns_egg_data = false;
   _error = false;
   _error = false;
 }
 }
 
 
@@ -76,18 +74,11 @@ SomethingToEggConverter::
 //       Access: Public
 //       Access: Public
 //  Description: Sets the egg data that will be filled in when
 //  Description: Sets the egg data that will be filled in when
 //               convert_file() is called.  This must be called before
 //               convert_file() is called.  This must be called before
-//               convert_file().  If owns_egg_data is true, the
-//               egg_data will be deleted when the converter
-//               destructs.  (We don't use the reference counting on
-//               EggData, to allow static EggDatas to be passed in.)
+//               convert_file().
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void SomethingToEggConverter::
 void SomethingToEggConverter::
-set_egg_data(EggData *egg_data, bool owns_egg_data) {
-  if (_owns_egg_data) {
-    delete _egg_data;
-  }
+set_egg_data(EggData *egg_data) {
   _egg_data = egg_data;
   _egg_data = egg_data;
-  _owns_egg_data = owns_egg_data;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -137,9 +128,9 @@ handle_external_reference(EggGroupNode *egg_parent,
                           const Filename &ref_filename) {
                           const Filename &ref_filename) {
   if (_merge_externals) {
   if (_merge_externals) {
     SomethingToEggConverter *ext = make_copy();
     SomethingToEggConverter *ext = make_copy();
-    EggData egg_data;
-    egg_data.set_coordinate_system(get_egg_data().get_coordinate_system());
-    ext->set_egg_data(&egg_data, false);
+    PT(EggData) egg_data = new EggData;
+    egg_data->set_coordinate_system(get_egg_data()->get_coordinate_system());
+    ext->set_egg_data(egg_data);
 
 
     if (!ext->convert_file(ref_filename)) {
     if (!ext->convert_file(ref_filename)) {
       delete ext;
       delete ext;
@@ -148,7 +139,7 @@ handle_external_reference(EggGroupNode *egg_parent,
       return false;
       return false;
     }
     }
 
 
-    egg_parent->steal_children(egg_data);
+    egg_parent->steal_children(*egg_data);
     delete ext;
     delete ext;
     return true;
     return true;
 
 

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

@@ -99,9 +99,9 @@ public:
   INLINE void set_merge_externals(bool merge_externals);
   INLINE void set_merge_externals(bool merge_externals);
   INLINE bool get_merge_externals() const;
   INLINE bool get_merge_externals() const;
 
 
-  void set_egg_data(EggData *egg_data, bool owns_egg_data);
+  void set_egg_data(EggData *egg_data);
   INLINE void clear_egg_data();
   INLINE void clear_egg_data();
-  INLINE EggData &get_egg_data();
+  INLINE EggData *get_egg_data();
 
 
   virtual string get_name() const=0;
   virtual string get_name() const=0;
   virtual string get_extension() const=0;
   virtual string get_extension() const=0;
@@ -143,8 +143,7 @@ protected:
 
 
   bool _merge_externals;
   bool _merge_externals;
 
 
-  EggData *_egg_data;
-  bool _owns_egg_data;
+  PT(EggData) _egg_data;
 
 
   bool _error;
   bool _error;
 };
 };

+ 1 - 1
pandatool/src/dxfegg/dxfToEggConverter.cxx

@@ -108,7 +108,7 @@ convert_file(const Filename &filename) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 DXFLayer *DXFToEggConverter::
 DXFLayer *DXFToEggConverter::
 new_layer(const string &name) {
 new_layer(const string &name) {
-  return new DXFToEggLayer(name, &get_egg_data());
+  return new DXFToEggLayer(name, get_egg_data());
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
pandatool/src/dxfprogs/dxfToEgg.cxx

@@ -56,10 +56,10 @@ void DXFToEgg::
 run() {
 run() {
   nout << "Reading " << _input_filename << "\n";
   nout << "Reading " << _input_filename << "\n";
 
 
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
   DXFToEggConverter converter;
   DXFToEggConverter converter;
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
   converter._allow_errors = _allow_errors;
   converter._allow_errors = _allow_errors;
 
 
   apply_parameters(converter);
   apply_parameters(converter);

+ 1 - 1
pandatool/src/dxfprogs/eggToDXF.cxx

@@ -52,7 +52,7 @@ EggToDXF() :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void EggToDXF::
 void EggToDXF::
 run() {
 run() {
-  get_layers(&_data);
+  get_layers(_data);
   if (_layers.empty()) {
   if (_layers.empty()) {
     nout << "Egg file contains no polygons.  Output file not written.\n";
     nout << "Egg file contains no polygons.  Output file not written.\n";
     exit(1);
     exit(1);

+ 2 - 2
pandatool/src/egg-qtess/eggQtess.cxx

@@ -149,7 +149,7 @@ run() {
     read_qtess = true;
     read_qtess = true;
   }
   }
 
 
-  find_surfaces(&_data);
+  find_surfaces(_data);
 
 
   QtessInputEntry &default_entry = _qtess_file.get_default_entry();
   QtessInputEntry &default_entry = _qtess_file.get_default_entry();
   if (!read_qtess || default_entry.get_num_surfaces() == 0) {
   if (!read_qtess || default_entry.get_num_surfaces() == 0) {
@@ -215,7 +215,7 @@ run() {
     // vertices.
     // vertices.
     _surfaces.clear();
     _surfaces.clear();
 
 
-    _data.remove_unused_vertices();
+    _data->remove_unused_vertices();
     write_egg_file();
     write_egg_file();
   }
   }
 }
 }

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

@@ -178,7 +178,7 @@ convert_paths(EggNode *node, PathReplace *path_replace,
 //               call it explicitly.
 //               call it explicitly.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void EggBase::
 void EggBase::
-append_command_comment(EggData &data) {
+append_command_comment(EggData *data) {
   append_command_comment(data, get_exec_command());
   append_command_comment(data, get_exec_command());
 }
 }
 
 
@@ -194,8 +194,8 @@ append_command_comment(EggData &data) {
 //               call it explicitly.
 //               call it explicitly.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void EggBase::
 void EggBase::
-append_command_comment(EggData &data, const string &comment) {
-  data.insert(data.begin(), new EggComment("", comment));
+append_command_comment(EggData *data, const string &comment) {
+  data->insert(data->begin(), new EggComment("", comment));
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
pandatool/src/eggbase/eggBase.h

@@ -44,8 +44,8 @@ public:
                             const DSearchPath &additional_path);
                             const DSearchPath &additional_path);
 
 
 protected:
 protected:
-  void append_command_comment(EggData &_data);
-  static void append_command_comment(EggData &_data, const string &comment);
+  void append_command_comment(EggData *_data);
+  static void append_command_comment(EggData *_data, const string &comment);
 
 
   static bool dispatch_normals(ProgramBase *self, const string &opt, const string &arg, void *mode);
   static bool dispatch_normals(ProgramBase *self, const string &opt, const string &arg, void *mode);
   bool ns_dispatch_normals(const string &opt, const string &arg, void *mode);
   bool ns_dispatch_normals(const string &opt, const string &arg, void *mode);

+ 1 - 1
pandatool/src/eggbase/eggMultiFilter.cxx

@@ -149,7 +149,7 @@ post_command_line() {
     if (_got_coordinate_system) {
     if (_got_coordinate_system) {
       data->set_coordinate_system(_coordinate_system);
       data->set_coordinate_system(_coordinate_system);
     }
     }
-    append_command_comment(*data);
+    append_command_comment(data);
   }
   }
 
 
   return EggMultiBase::post_command_line();
   return EggMultiBase::post_command_line();

+ 4 - 4
pandatool/src/eggbase/eggReader.cxx

@@ -168,7 +168,7 @@ handle_args(ProgramBase::Args &args) {
   // get implicitly loaded up into one big egg file.
   // get implicitly loaded up into one big egg file.
 
 
   if (!args.empty()) {
   if (!args.empty()) {
-    _data.set_egg_filename(Filename::from_os_specific(args[0]));
+    _data->set_egg_filename(Filename::from_os_specific(args[0]));
   }
   }
   Args::const_iterator ai;
   Args::const_iterator ai;
   for (ai = args.begin(); ai != args.end(); ++ai) {
   for (ai = args.begin(); ai != args.end(); ++ai) {
@@ -207,7 +207,7 @@ handle_args(ProgramBase::Args &args) {
     // specified _path_replace.
     // specified _path_replace.
     convert_paths(&file_data, _path_replace, file_path);
     convert_paths(&file_data, _path_replace, file_path);
 
 
-    _data.merge(file_data);
+    _data->merge(file_data);
   }
   }
 
 
   return true;
   return true;
@@ -247,7 +247,7 @@ do_reader_options() {
   }
   }
 
 
   if (_delod >= 0.0) {
   if (_delod >= 0.0) {
-    do_delod(&_data);
+    do_delod(_data);
   }
   }
 
 
   return okflag;
   return okflag;
@@ -265,7 +265,7 @@ bool EggReader::
 copy_textures() {
 copy_textures() {
   bool success = true;
   bool success = true;
   EggTextureCollection textures;
   EggTextureCollection textures;
-  textures.find_used_textures(&_data);
+  textures.find_used_textures(_data);
 
 
   EggTextureCollection::const_iterator ti;
   EggTextureCollection::const_iterator ti;
   for (ti = textures.begin(); ti != textures.end(); ++ti) {
   for (ti = textures.begin(); ti != textures.end(); ++ti) {

+ 4 - 2
pandatool/src/eggbase/eggSingleBase.cxx

@@ -31,7 +31,9 @@
 //  Description:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 EggSingleBase::
 EggSingleBase::
-EggSingleBase() {
+EggSingleBase() :
+  _data(new EggData)
+{
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -76,7 +78,7 @@ as_writer() {
 bool EggSingleBase::
 bool EggSingleBase::
 post_command_line() {
 post_command_line() {
   if (_got_coordinate_system) {
   if (_got_coordinate_system) {
-    _data.set_coordinate_system(_coordinate_system);
+    _data->set_coordinate_system(_coordinate_system);
   }
   }
 
 
   return EggBase::post_command_line();
   return EggBase::post_command_line();

+ 2 - 1
pandatool/src/eggbase/eggSingleBase.h

@@ -24,6 +24,7 @@
 #include "eggBase.h"
 #include "eggBase.h"
 #include "coordinateSystem.h"
 #include "coordinateSystem.h"
 #include "eggData.h"
 #include "eggData.h"
+#include "pointerTo.h"
 
 
 class EggReader;
 class EggReader;
 class EggWriter;
 class EggWriter;
@@ -51,7 +52,7 @@ protected:
   virtual bool post_command_line();
   virtual bool post_command_line();
 
 
 protected:
 protected:
-  EggData _data;
+  PT(EggData) _data;
 };
 };
 
 
 #endif
 #endif

+ 9 - 9
pandatool/src/eggbase/eggWriter.cxx

@@ -131,30 +131,30 @@ post_process_egg_file() {
     _transform.write(nout, 2);
     _transform.write(nout, 2);
     LVecBase3d scale, hpr, translate;
     LVecBase3d scale, hpr, translate;
     if (decompose_matrix(_transform, scale, hpr, translate,
     if (decompose_matrix(_transform, scale, hpr, translate,
-                         _data.get_coordinate_system())) {
+                         _data->get_coordinate_system())) {
       nout << "(scale " << scale << ", hpr " << hpr << ", translate "
       nout << "(scale " << scale << ", hpr " << hpr << ", translate "
            << translate << ")\n";
            << translate << ")\n";
     }
     }
-    _data.transform(_transform);
+    _data->transform(_transform);
   }
   }
 
 
   switch (_normals_mode) {
   switch (_normals_mode) {
   case NM_strip:
   case NM_strip:
     nout << "Stripping normals.\n";
     nout << "Stripping normals.\n";
-    _data.strip_normals();
-    _data.remove_unused_vertices();
+    _data->strip_normals();
+    _data->remove_unused_vertices();
     break;
     break;
 
 
   case NM_polygon:
   case NM_polygon:
     nout << "Recomputing polygon normals.\n";
     nout << "Recomputing polygon normals.\n";
-    _data.recompute_polygon_normals();
-    _data.remove_unused_vertices();
+    _data->recompute_polygon_normals();
+    _data->remove_unused_vertices();
     break;
     break;
 
 
   case NM_vertex:
   case NM_vertex:
     nout << "Recomputing vertex normals.\n";
     nout << "Recomputing vertex normals.\n";
-    _data.recompute_vertex_normals(_normals_threshold);
-    _data.remove_unused_vertices();
+    _data->recompute_vertex_normals(_normals_threshold);
+    _data->remove_unused_vertices();
     break;
     break;
 
 
   case NM_preserve:
   case NM_preserve:
@@ -175,7 +175,7 @@ post_process_egg_file() {
 void EggWriter::
 void EggWriter::
 write_egg_file() {
 write_egg_file() {
   post_process_egg_file();
   post_process_egg_file();
-  _data.write_egg(get_output());
+  _data->write_egg(get_output());
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
pandatool/src/eggbase/somethingToEgg.cxx

@@ -196,13 +196,13 @@ add_merge_externals_options() {
 //               done automatically when the file is written out.
 //               done automatically when the file is written out.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void SomethingToEgg::
 void SomethingToEgg::
-apply_units_scale(EggData &data) {
+apply_units_scale(EggData *data) {
   if (_output_units != DU_invalid && _input_units != DU_invalid &&
   if (_output_units != DU_invalid && _input_units != DU_invalid &&
       _input_units != _output_units) {
       _input_units != _output_units) {
     nout << "Converting from " << format_long_unit(_input_units)
     nout << "Converting from " << format_long_unit(_input_units)
          << " to " << format_long_unit(_output_units) << "\n";
          << " to " << format_long_unit(_output_units) << "\n";
     double scale = convert_units(_input_units, _output_units);
     double scale = convert_units(_input_units, _output_units);
-    data.transform(LMatrix4d::scale_mat(scale));
+    data->transform(LMatrix4d::scale_mat(scale));
   }
   }
 }
 }
 
 

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

@@ -45,7 +45,7 @@ public:
   void add_merge_externals_options();
   void add_merge_externals_options();
 
 
 protected:
 protected:
-  void apply_units_scale(EggData &data);
+  void apply_units_scale(EggData *data);
   void apply_parameters(SomethingToEggConverter &converter);
   void apply_parameters(SomethingToEggConverter &converter);
 
 
   virtual bool handle_args(Args &args);
   virtual bool handle_args(Args &args);

+ 2 - 2
pandatool/src/eggprogs/eggCrop.cxx

@@ -73,10 +73,10 @@ post_command_line() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void EggCrop::
 void EggCrop::
 run() {
 run() {
-  int num_removed = strip_prims(&_data);
+  int num_removed = strip_prims(_data);
   nout << "Removed " << num_removed << " primitives.\n";
   nout << "Removed " << num_removed << " primitives.\n";
 
 
-  _data.remove_unused_vertices();
+  _data->remove_unused_vertices();
   write_egg_file();
   write_egg_file();
 }
 }
 
 

+ 1 - 1
pandatool/src/eggprogs/eggMakeTube.cxx

@@ -108,7 +108,7 @@ run() {
 
 
   // First, create an enclosing group and a vertex pool.
   // First, create an enclosing group and a vertex pool.
   _group = new EggGroup("tube");
   _group = new EggGroup("tube");
-  _data.add_child(_group);
+  _data->add_child(_group);
 
 
   _vpool = new EggVertexPool("tube");
   _vpool = new EggVertexPool("tube");
   _group->add_child(_vpool);
   _group->add_child(_vpool);

+ 1 - 1
pandatool/src/eggprogs/eggTextureCards.cxx

@@ -296,7 +296,7 @@ run() {
   // vertices.  We can use the same four vertices on all polygons.
   // vertices.  We can use the same four vertices on all polygons.
 
 
   EggGroup *group = new EggGroup();
   EggGroup *group = new EggGroup();
-  _data.add_child(group);
+  _data->add_child(group);
 
 
   // If we have more than one tile, make the group a sequence, as a
   // If we have more than one tile, make the group a sequence, as a
   // convenience.  If we view the egg file directly we can see all the
   // convenience.  If we view the egg file directly we can see all the

+ 7 - 7
pandatool/src/eggprogs/eggToC.cxx

@@ -95,23 +95,23 @@ EggToC() :
 void EggToC::
 void EggToC::
 run() {
 run() {
   nout << "Removing invalid primitives.\n";
   nout << "Removing invalid primitives.\n";
-  int num_removed = _data.remove_invalid_primitives();
+  int num_removed = _data->remove_invalid_primitives();
   nout << "  (" << num_removed << " removed.)\n";
   nout << "  (" << num_removed << " removed.)\n";
 
 
   if (_triangulate_polygons) {
   if (_triangulate_polygons) {
     nout << "Triangulating polygons.\n";
     nout << "Triangulating polygons.\n";
-    int num_produced = _data.triangulate_polygons(true);
+    int num_produced = _data->triangulate_polygons(~0);
     nout << "  (" << num_produced << " triangles produced.)\n";
     nout << "  (" << num_produced << " triangles produced.)\n";
   }
   }
 
 
-  _data.apply_texmats();
-  _data.flatten_transforms();
-  _data.remove_unused_vertices();
+  _data->apply_texmats();
+  _data->flatten_transforms();
+  _data->remove_unused_vertices();
 
 
   // Collect all the polygons together into polysets.
   // Collect all the polygons together into polysets.
   EggPolysetMaker pmaker;
   EggPolysetMaker pmaker;
   pmaker.set_properties(0);
   pmaker.set_properties(0);
-  pmaker.make_bins(&_data);
+  pmaker.make_bins(_data);
 
 
   get_output()
   get_output()
     << "/*\n"
     << "/*\n"
@@ -122,7 +122,7 @@ run() {
 
 
   _next_vpool_index = 0;
   _next_vpool_index = 0;
   _next_bin_index = 0;
   _next_bin_index = 0;
-  traverse(&_data);
+  traverse(_data);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 10 - 10
pandatool/src/eggprogs/eggTrans.cxx

@@ -89,44 +89,44 @@ void EggTrans::
 run() {
 run() {
   if (_remove_invalid_primitives) {
   if (_remove_invalid_primitives) {
     nout << "Removing invalid primitives.\n";
     nout << "Removing invalid primitives.\n";
-    int num_removed = _data.remove_invalid_primitives();
+    int num_removed = _data->remove_invalid_primitives();
     nout << "  (" << num_removed << " removed.)\n";
     nout << "  (" << num_removed << " removed.)\n";
-    _data.remove_unused_vertices();
+    _data->remove_unused_vertices();
   }
   }
 
 
   if (_triangulate_polygons) {
   if (_triangulate_polygons) {
     nout << "Triangulating polygons.\n";
     nout << "Triangulating polygons.\n";
-    int num_produced = _data.triangulate_polygons(~0);
+    int num_produced = _data->triangulate_polygons(~0);
     nout << "  (" << num_produced << " triangles produced.)\n";
     nout << "  (" << num_produced << " triangles produced.)\n";
   }
   }
 
 
   if (_mesh_triangles) {
   if (_mesh_triangles) {
     nout << "Meshing triangles.\n";
     nout << "Meshing triangles.\n";
-    _data.mesh_triangles(~0);
+    _data->mesh_triangles(~0);
   }
   }
 
 
   if (_apply_texmats) {
   if (_apply_texmats) {
     nout << "Applying texture matrices.\n";
     nout << "Applying texture matrices.\n";
-    _data.apply_texmats();
-    _data.remove_unused_vertices();
+    _data->apply_texmats();
+    _data->remove_unused_vertices();
   }
   }
 
 
   if (_collapse_equivalent_textures) {
   if (_collapse_equivalent_textures) {
     nout << "Collapsing equivalent textures.\n";
     nout << "Collapsing equivalent textures.\n";
-    int num_removed = _data.collapse_equivalent_textures();
+    int num_removed = _data->collapse_equivalent_textures();
     nout << "  (" << num_removed << " removed.)\n";
     nout << "  (" << num_removed << " removed.)\n";
   }
   }
 
 
   if (_flatten_transforms) {
   if (_flatten_transforms) {
     nout << "Flattening transforms.\n";
     nout << "Flattening transforms.\n";
-    _data.flatten_transforms();
-    _data.remove_unused_vertices();
+    _data->flatten_transforms();
+    _data->remove_unused_vertices();
   }
   }
 
 
   if (_standardize_names) {
   if (_standardize_names) {
     nout << "Standardizing group names.\n";
     nout << "Standardizing group names.\n";
     EggGroupUniquifier uniquifier;
     EggGroupUniquifier uniquifier;
-    uniquifier.uniquify(&_data);
+    uniquifier.uniquify(_data);
   }
   }
 
 
   if (!do_reader_options()) {
   if (!do_reader_options()) {

+ 1 - 1
pandatool/src/fltprogs/eggToFlt.cxx

@@ -87,7 +87,7 @@ run() {
   _flt_header = new FltHeader(_path_replace);
   _flt_header = new FltHeader(_path_replace);
   _flt_header->set_auto_attr_update(_auto_attr_update);
   _flt_header->set_auto_attr_update(_auto_attr_update);
 
 
-  traverse(&_data, _flt_header, FltGeometry::BT_none);
+  traverse(_data, _flt_header, FltGeometry::BT_none);
 
 
   // Finally, write the resulting file out.
   // Finally, write the resulting file out.
   FltError result = _flt_header->write_flt(get_output());
   FltError result = _flt_header->write_flt(get_output());

+ 2 - 2
pandatool/src/fltprogs/fltToEgg.cxx

@@ -68,11 +68,11 @@ FltToEgg() :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void FltToEgg::
 void FltToEgg::
 run() {
 run() {
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
   FltToEggConverter converter;
   FltToEggConverter converter;
   converter.set_merge_externals(_merge_externals);
   converter.set_merge_externals(_merge_externals);
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
   converter._compose_transforms = _compose_transforms;
   converter._compose_transforms = _compose_transforms;
   converter._allow_errors = _allow_errors;
   converter._allow_errors = _allow_errors;
 
 

+ 1 - 1
pandatool/src/lwoegg/cLwoLayer.cxx

@@ -59,6 +59,6 @@ connect_egg() {
          << "; cannot parent layer " << _layer->_number << " properly.\n";
          << "; cannot parent layer " << _layer->_number << " properly.\n";
   }
   }
 
 
-  _converter->get_egg_data().add_child(_egg_group.p());
+  _converter->get_egg_data()->add_child(_egg_group.p());
 }
 }
 
 

+ 1 - 1
pandatool/src/lwoegg/cLwoPolygons.cxx

@@ -298,7 +298,7 @@ make_faces() {
     }
     }
   }
   }
 
 
-  CoordinateSystem cs = _converter->get_egg_data().get_coordinate_system();
+  CoordinateSystem cs = _converter->get_egg_data()->get_coordinate_system();
   if (smooth_angle > 0.0) {
   if (smooth_angle > 0.0) {
     _egg_group->recompute_vertex_normals(rad_2_deg(smooth_angle), cs);
     _egg_group->recompute_vertex_normals(rad_2_deg(smooth_angle), cs);
   } else {
   } else {

+ 2 - 2
pandatool/src/lwoprogs/lwoToEgg.cxx

@@ -66,14 +66,14 @@ LwoToEgg() :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void LwoToEgg::
 void LwoToEgg::
 run() {
 run() {
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
   if (_input_units == DU_invalid) {
   if (_input_units == DU_invalid) {
     _input_units = DU_meters;
     _input_units = DU_meters;
   }
   }
 
 
   LwoToEggConverter converter;
   LwoToEggConverter converter;
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
   apply_parameters(converter);
   apply_parameters(converter);
 
 
   if (!converter.convert_file(_input_filename)) {
   if (!converter.convert_file(_input_filename)) {

+ 7 - 7
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -445,7 +445,7 @@ convert_maya() {
       
       
     case AC_none:
     case AC_none:
       // none: just get out a static model, no animation.
       // none: just get out a static model, no animation.
-      all_ok = convert_hierarchy(&get_egg_data());
+      all_ok = convert_hierarchy(get_egg_data());
       break;
       break;
       
       
     case AC_flip:
     case AC_flip:
@@ -485,7 +485,7 @@ convert_maya() {
       break;
       break;
     };
     };
 
 
-    reparent_decals(&get_egg_data());
+    reparent_decals(get_egg_data());
   }
   }
 
 
   if (had_error()) {
   if (had_error()) {
@@ -564,7 +564,7 @@ convert_flip(double start_frame, double end_frame, double frame_inc,
   bool all_ok = true;
   bool all_ok = true;
 
 
   EggGroup *sequence_node = new EggGroup(_character_name);
   EggGroup *sequence_node = new EggGroup(_character_name);
-  get_egg_data().add_child(sequence_node);
+  get_egg_data()->add_child(sequence_node);
   if (_animation_convert == AC_flip) { 
   if (_animation_convert == AC_flip) { 
     sequence_node->set_switch_flag(true);
     sequence_node->set_switch_flag(true);
     sequence_node->set_switch_fps(output_frame_rate);
     sequence_node->set_switch_fps(output_frame_rate);
@@ -612,7 +612,7 @@ convert_char_model() {
   _tree.reset_sliders();
   _tree.reset_sliders();
 
 
   EggGroup *char_node = new EggGroup(_character_name);
   EggGroup *char_node = new EggGroup(_character_name);
-  get_egg_data().add_child(char_node);
+  get_egg_data()->add_child(char_node);
   char_node->set_dart_type(EggGroup::DT_default);
   char_node->set_dart_type(EggGroup::DT_default);
 
 
   return convert_hierarchy(char_node);
   return convert_hierarchy(char_node);
@@ -631,7 +631,7 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc,
   //  MStatus status;
   //  MStatus status;
 
 
   EggTable *root_table_node = new EggTable();
   EggTable *root_table_node = new EggTable();
-  get_egg_data().add_child(root_table_node);
+  get_egg_data()->add_child(root_table_node);
   EggTable *bundle_node = new EggTable(_character_name);
   EggTable *bundle_node = new EggTable(_character_name);
   bundle_node->set_table_type(EggTable::TT_bundle);
   bundle_node->set_table_type(EggTable::TT_bundle);
   root_table_node->add_child(bundle_node);
   root_table_node->add_child(bundle_node);
@@ -643,7 +643,7 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc,
   // Set the frame rate before we start asking for anim tables to be
   // Set the frame rate before we start asking for anim tables to be
   // created.
   // created.
   _tree._fps = output_frame_rate;
   _tree._fps = output_frame_rate;
-  _tree.clear_egg(&get_egg_data(), NULL, skeleton_node, morph_node);
+  _tree.clear_egg(get_egg_data(), NULL, skeleton_node, morph_node);
 
 
   // Now we can get the animation data by walking through all of the
   // Now we can get the animation data by walking through all of the
   // frames, one at a time, and getting the joint angles at each
   // frames, one at a time, and getting the joint angles at each
@@ -732,7 +732,7 @@ bool MayaToEggConverter::
 convert_hierarchy(EggGroupNode *egg_root) {
 convert_hierarchy(EggGroupNode *egg_root) {
   int num_nodes = _tree.get_num_nodes();
   int num_nodes = _tree.get_num_nodes();
 
 
-  _tree.clear_egg(&get_egg_data(), egg_root, NULL, NULL);
+  _tree.clear_egg(get_egg_data(), egg_root, NULL, NULL);
   for (int i = 0; i < num_nodes; i++) {
   for (int i = 0; i < num_nodes; i++) {
     MayaNodeDesc *node = _tree.get_node(i);
     MayaNodeDesc *node = _tree.get_node(i);
     if (!process_model_node(node)) {
     if (!process_model_node(node)) {

+ 3 - 3
pandatool/src/mayaprogs/mayaPview.cxx

@@ -146,8 +146,8 @@ convert(const NodePath &parent) {
   // Also search along the model path.
   // Also search along the model path.
   path_replace->_path.append_path(get_model_path());
   path_replace->_path.append_path(get_model_path());
 
 
-  EggData egg_data;
-  converter.set_egg_data(&egg_data, false);
+  PT(EggData) egg_data = new EggData;
+  converter.set_egg_data(egg_data);
   converter.set_from_selection(true);
   converter.set_from_selection(true);
 
 
   if (!converter.convert_maya()) {
   if (!converter.convert_maya()) {
@@ -157,7 +157,7 @@ convert(const NodePath &parent) {
 
 
   // Now the converter has filled up our egg structure with data, so
   // Now the converter has filled up our egg structure with data, so
   // convert this egg data to Panda data for immediate viewing.
   // convert this egg data to Panda data for immediate viewing.
-  egg_data.set_coordinate_system(CS_default);
+  egg_data->set_coordinate_system(CS_default);
   PT(PandaNode) result = load_egg_data(egg_data);
   PT(PandaNode) result = load_egg_data(egg_data);
 
 
   if (result == (PandaNode *)NULL) {
   if (result == (PandaNode *)NULL) {

+ 2 - 2
pandatool/src/mayaprogs/mayaToEgg.cxx

@@ -195,9 +195,9 @@ run() {
   if (!_got_coordinate_system) {
   if (!_got_coordinate_system) {
     _coordinate_system = converter._maya->get_coordinate_system();
     _coordinate_system = converter._maya->get_coordinate_system();
   }
   }
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
 
 
   if (!converter.convert_file(_input_filename)) {
   if (!converter.convert_file(_input_filename)) {
     nout << "Errors in conversion.\n";
     nout << "Errors in conversion.\n";

+ 5 - 5
pandatool/src/ptloader/loaderFileTypePandatool.cxx

@@ -99,8 +99,8 @@ PT(PandaNode) LoaderFileTypePandatool::
 load_file(const Filename &path, bool) const {
 load_file(const Filename &path, bool) const {
   PT(PandaNode) result;
   PT(PandaNode) result;
 
 
-  EggData egg_data;
-  _converter->set_egg_data(&egg_data, false);
+  PT(EggData) egg_data = new EggData;
+  _converter->set_egg_data(egg_data);
 
 
   DSearchPath file_path;
   DSearchPath file_path;
   file_path.append_directory(path.get_dirname());
   file_path.append_directory(path.get_dirname());
@@ -116,11 +116,11 @@ load_file(const Filename &path, bool) const {
         << "Converting from " << format_long_unit(input_units)
         << "Converting from " << format_long_unit(input_units)
         << " to " << format_long_unit(ptloader_units) << "\n";
         << " to " << format_long_unit(ptloader_units) << "\n";
       double scale = convert_units(input_units, ptloader_units);
       double scale = convert_units(input_units, ptloader_units);
-      egg_data.transform(LMatrix4d::scale_mat(scale));
+      egg_data->transform(LMatrix4d::scale_mat(scale));
     }
     }
 
 
-    if (!egg_data.has_normals()) {
-      egg_data.recompute_polygon_normals();
+    if (!egg_data->has_normals()) {
+      egg_data->recompute_polygon_normals();
     }
     }
 
 
     result = load_egg_data(egg_data);
     result = load_egg_data(egg_data);

+ 1 - 1
pandatool/src/vrmlegg/vrmlToEggConverter.cxx

@@ -121,7 +121,7 @@ convert_file(const Filename &filename) {
   // build the egg structure.
   // build the egg structure.
   VrmlScene::const_iterator csi;
   VrmlScene::const_iterator csi;
   for (csi = scene->begin(); csi != scene->end(); ++csi) {
   for (csi = scene->begin(); csi != scene->end(); ++csi) {
-    vrml_node((*csi)._node, &get_egg_data(), LMatrix4d::ident_mat());
+    vrml_node((*csi)._node, get_egg_data(), LMatrix4d::ident_mat());
   }
   }
 
 
   return !had_error();
   return !had_error();

+ 2 - 2
pandatool/src/vrmlprogs/vrmlToEgg.cxx

@@ -54,10 +54,10 @@ void VRMLToEgg::
 run() {
 run() {
   nout << "Reading " << _input_filename << "\n";
   nout << "Reading " << _input_filename << "\n";
 
 
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
   VRMLToEggConverter converter;
   VRMLToEggConverter converter;
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
   converter._allow_errors = _allow_errors;
   converter._allow_errors = _allow_errors;
 
 
   apply_parameters(converter);
   apply_parameters(converter);

+ 2 - 2
pandatool/src/xfileegg/xFileAnimationSet.cxx

@@ -54,7 +54,7 @@ create_hierarchy(XFileToEggConverter *converter) {
   // Egg animation tables start off with one Table entry, enclosing a
   // Egg animation tables start off with one Table entry, enclosing a
   // Bundle entry.
   // Bundle entry.
   EggTable *table = new EggTable(get_name());
   EggTable *table = new EggTable(get_name());
-  converter->get_egg_data().add_child(table);
+  converter->get_egg_data()->add_child(table);
   EggTable *bundle = new EggTable(converter->_char_name);
   EggTable *bundle = new EggTable(converter->_char_name);
   table->add_child(bundle);
   table->add_child(bundle);
   bundle->set_table_type(EggTable::TT_bundle);
   bundle->set_table_type(EggTable::TT_bundle);
@@ -150,7 +150,7 @@ mirror_table(XFileToEggConverter *converter,
         EggTable *new_table = new EggTable(group->get_name());
         EggTable *new_table = new EggTable(group->get_name());
         anim_node->add_child(new_table);
         anim_node->add_child(new_table);
         CoordinateSystem cs = 
         CoordinateSystem cs = 
-          converter->get_egg_data().get_coordinate_system();
+          converter->get_egg_data()->get_coordinate_system();
         EggXfmSAnim *xform = new EggXfmSAnim("xform", cs);
         EggXfmSAnim *xform = new EggXfmSAnim("xform", cs);
         new_table->add_child(xform);
         new_table->add_child(xform);
         xform->set_fps(converter->_frame_rate);
         xform->set_fps(converter->_frame_rate);

+ 3 - 3
pandatool/src/xfileegg/xFileMaker.cxx

@@ -75,15 +75,15 @@ write(const Filename &filename) {
 //               failure.
 //               failure.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool XFileMaker::
 bool XFileMaker::
-add_tree(EggData &egg_data) {
+add_tree(EggData *egg_data) {
   _meshes.clear();
   _meshes.clear();
 
 
   // Now collect all the polygons together into polysets.
   // Now collect all the polygons together into polysets.
   EggPolysetMaker pmaker;
   EggPolysetMaker pmaker;
-  pmaker.make_bins(&egg_data);
+  pmaker.make_bins(egg_data);
 
 
   // And now we're ready to traverse the egg hierarchy.
   // And now we're ready to traverse the egg hierarchy.
-  if (!recurse_nodes(&egg_data, _x_file)) {
+  if (!recurse_nodes(egg_data, _x_file)) {
     return false;
     return false;
   }
   }
 
 

+ 1 - 1
pandatool/src/xfileegg/xFileMaker.h

@@ -47,7 +47,7 @@ public:
 
 
   bool write(const Filename &filename);
   bool write(const Filename &filename);
 
 
-  bool add_tree(EggData &egg_data);
+  bool add_tree(EggData *egg_data);
 
 
 private:
 private:
   bool add_node(EggNode *egg_node, XFileNode *x_parent);
   bool add_node(EggNode *egg_node, XFileNode *x_parent);

+ 2 - 2
pandatool/src/xfileprogs/xFileToEgg.cxx

@@ -87,10 +87,10 @@ XFileToEgg() :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void XFileToEgg::
 void XFileToEgg::
 run() {
 run() {
-  _data.set_coordinate_system(_coordinate_system);
+  _data->set_coordinate_system(_coordinate_system);
 
 
   XFileToEggConverter converter;
   XFileToEggConverter converter;
-  converter.set_egg_data(&_data, false);
+  converter.set_egg_data(_data);
 
 
   converter._frame_rate = _frame_rate;
   converter._frame_rate = _frame_rate;
   converter._make_char = _make_char;
   converter._make_char = _make_char;