support -expose properly

This commit is contained in:
David Rose 2003-07-21 18:51:28 +00:00
parent ad064f541f
commit ec3b053c72
2 changed files with 12 additions and 8 deletions

View File

@ -135,7 +135,7 @@ run() {
// The meat of the program: determine which joints are to be
// removed, and then actually remove them.
determine_removed_components();
if (remove_joints()) {
if (process_joints()) {
do_reparent();
}
@ -260,15 +260,16 @@ determine_removed_components() {
}
////////////////////////////////////////////////////////////////////
// Function: EggOptchar::remove_joints
// Function: EggOptchar::process_joints
// Access: Private
// Description: Effects the actual removal of joints flagged for
// removal by reparenting the hierarchy appropriately.
// Returns true if anything is done, false otherwise.
// Returns true if any joints are removed, false
// otherwise.
////////////////////////////////////////////////////////////////////
bool EggOptchar::
remove_joints() {
bool did_anything = false;
process_joints() {
bool removed_any = false;
int num_characters = _collection->get_num_characters();
for (int ci = 0; ci < num_characters; ci++) {
EggCharacterData *char_data = _collection->get_character(ci);
@ -303,12 +304,15 @@ remove_joints() {
} else if ((user_data->_flags & EggOptcharUserData::F_empty) != 0) {
num_empty++;
}
did_anything = true;
removed_any = true;
} else {
// This joint will be preserved, but maybe its parent will
// change.
joint_data->reparent_to(best_parent);
if ((user_data->_flags & EggOptcharUserData::F_expose) != 0) {
joint_data->expose();
}
num_kept++;
}
}
@ -324,7 +328,7 @@ remove_joints() {
}
}
return did_anything;
return removed_any;
}
////////////////////////////////////////////////////////////////////

View File

@ -53,7 +53,7 @@ private:
static bool dispatch_vector_string_pair(const string &opt, const string &arg, void *var);
void determine_removed_components();
bool remove_joints();
bool process_joints();
EggJointData *find_best_parent(EggJointData *joint_data) const;
bool apply_user_reparents();