Browse Source

support -expose properly

David Rose 22 years ago
parent
commit
86e034103e

+ 25 - 0
pandatool/src/eggcharbase/eggJointData.cxx

@@ -199,6 +199,31 @@ optimize() {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: EggJointData::expose
+//       Access: Public
+//  Description: Calls expose() on all models, and recursively on
+//               all joints at this node and below.
+////////////////////////////////////////////////////////////////////
+void EggJointData::
+expose(EggGroup::DCSType dcs_type) {
+  BackPointers::iterator bpi;
+  for (bpi = _back_pointers.begin(); bpi != _back_pointers.end(); ++bpi) {
+    EggBackPointer *back = (*bpi);
+    if (back != (EggBackPointer *)NULL) {
+      EggJointPointer *joint;
+      DCAST_INTO_V(joint, back);
+      joint->expose(dcs_type);
+    }
+  }
+
+  Children::iterator ci;
+  for (ci = _children.begin(); ci != _children.end(); ++ci) {
+    EggJointData *child = (*ci);
+    child->expose(dcs_type);
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: EggJointData::add_back_pointer
 //       Access: Public, Virtual

+ 2 - 1
pandatool/src/eggcharbase/eggJointData.h

@@ -22,7 +22,7 @@
 #include "pandatoolbase.h"
 
 #include "eggComponentData.h"
-
+#include "eggGroup.h"
 #include "luse.h"
 
 ////////////////////////////////////////////////////////////////////
@@ -52,6 +52,7 @@ public:
 
   bool do_rebuild();
   void optimize();
+  void expose(EggGroup::DCSType dcs_type = EggGroup::DC_default);
 
   virtual void add_back_pointer(int model_index, EggObject *egg_object);
   virtual void write(ostream &out, int indent_level = 0) const;

+ 13 - 0
pandatool/src/eggcharbase/eggJointNodePointer.cxx

@@ -179,6 +179,19 @@ do_rebuild() {
   return true;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: EggJointNodePointer::expose
+//       Access: Public, Virtual
+//  Description: Flags the joint with the indicated DCS flag so that
+//               it will be loaded as a separate node in the player.
+////////////////////////////////////////////////////////////////////
+void EggJointNodePointer::
+expose(EggGroup::DCSType dcs_type) {
+  if (_joint != (EggGroup *)NULL) {
+    _joint->set_dcs_type(dcs_type);
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: EggJointNodePointer::has_vertices
 //       Access: Public, Virtual

+ 1 - 0
pandatool/src/eggcharbase/eggJointNodePointer.h

@@ -43,6 +43,7 @@ public:
 
   virtual bool add_rebuild_frame(const LMatrix4d &mat);
   virtual bool do_rebuild();
+  virtual void expose(EggGroup::DCSType dcs_type);
 
   virtual bool has_vertices() const;
 

+ 10 - 0
pandatool/src/eggcharbase/eggJointPointer.cxx

@@ -105,3 +105,13 @@ do_rebuild() {
 void EggJointPointer::
 optimize() {
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggJointPointer::expose
+//       Access: Public, Virtual
+//  Description: Flags the joint with the indicated DCS flag so that
+//               it will be loaded as a separate node in the player.
+////////////////////////////////////////////////////////////////////
+void EggJointPointer::
+expose(EggGroup::DCSType) {
+}

+ 2 - 1
pandatool/src/eggcharbase/eggJointPointer.h

@@ -22,7 +22,7 @@
 #include "pandatoolbase.h"
 
 #include "eggBackPointer.h"
-
+#include "eggGroup.h"
 #include "luse.h"
 
 ////////////////////////////////////////////////////////////////////
@@ -51,6 +51,7 @@ public:
   virtual bool do_rebuild();
 
   virtual void optimize();
+  virtual void expose(EggGroup::DCSType dcs_type);
 
 protected:
   typedef pvector<LMatrix4d> RebuildFrames;