diff --git a/pandatool/src/eggcharbase/eggJointData.cxx b/pandatool/src/eggcharbase/eggJointData.cxx index 164fa48217..82f5ac13cd 100644 --- a/pandatool/src/eggcharbase/eggJointData.cxx +++ b/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 diff --git a/pandatool/src/eggcharbase/eggJointData.h b/pandatool/src/eggcharbase/eggJointData.h index f98865f0ab..4819dd4164 100644 --- a/pandatool/src/eggcharbase/eggJointData.h +++ b/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; diff --git a/pandatool/src/eggcharbase/eggJointNodePointer.cxx b/pandatool/src/eggcharbase/eggJointNodePointer.cxx index f8c3e9ca98..7038040f00 100644 --- a/pandatool/src/eggcharbase/eggJointNodePointer.cxx +++ b/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 diff --git a/pandatool/src/eggcharbase/eggJointNodePointer.h b/pandatool/src/eggcharbase/eggJointNodePointer.h index d7eba74daf..15308a34f8 100644 --- a/pandatool/src/eggcharbase/eggJointNodePointer.h +++ b/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; diff --git a/pandatool/src/eggcharbase/eggJointPointer.cxx b/pandatool/src/eggcharbase/eggJointPointer.cxx index 2005b05713..f4aaade8b0 100644 --- a/pandatool/src/eggcharbase/eggJointPointer.cxx +++ b/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) { +} diff --git a/pandatool/src/eggcharbase/eggJointPointer.h b/pandatool/src/eggcharbase/eggJointPointer.h index 966d3dcb44..95814b3566 100644 --- a/pandatool/src/eggcharbase/eggJointPointer.h +++ b/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 RebuildFrames;