support -expose properly

This commit is contained in:
David Rose 2003-07-21 19:01:41 +00:00
parent ec3b053c72
commit 86e034103e
6 changed files with 53 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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) {
}

View File

@ -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;