*** empty log message ***

This commit is contained in:
David Rose 2001-05-03 01:17:45 +00:00
parent 25df0f6b19
commit c3e650dcb1
7 changed files with 35 additions and 30 deletions

View File

@ -296,15 +296,6 @@ pre_write() {
textures.uniquify_trefs();
textures.sort_by_tref();
// Now put them all back at the head of the file, after any initial
// comment records.
iterator ci = begin();
while (ci != end() && (*ci)->is_of_type(EggComment::get_class_type())) {
++ci;
}
textures.insert_textures(this, ci);
// Do the same thing with the materials.
EggMaterialCollection materials;
materials.extract_materials(this);
@ -312,6 +303,14 @@ pre_write() {
materials.collapse_equivalent_materials(~0, this);
materials.uniquify_mrefs();
materials.sort_by_mref();
// Now put them all back at the head of the file, after any initial
// comment records.
iterator ci = begin();
while (ci != end() && (*ci)->is_of_type(EggComment::get_class_type())) {
++ci;
}
textures.insert_textures(this, ci);
materials.insert_materials(this, ci);
// Also make sure that the vertex pools are uniquely named. This

View File

@ -961,6 +961,7 @@ r_resolve_externals(const DSearchPath &searchpath,
////////////////////////////////////////////////////////////////////
void EggGroupNode::
prepare_add_child(EggNode *node) {
nassertv(node != (EggNode *)NULL);
// Make sure the node is not already a child of some other group.
nassertv(node->get_parent() == NULL);
nassertv(node->get_depth() == 0);
@ -983,6 +984,7 @@ prepare_add_child(EggNode *node) {
////////////////////////////////////////////////////////////////////
void EggGroupNode::
prepare_remove_child(EggNode *node) {
nassertv(node != (EggNode *)NULL);
// Make sure the node is in fact a child of this group.
nassertv(node->get_parent() == this);
nassertv(node->get_depth() == get_depth() + 1);

View File

@ -76,10 +76,10 @@ extract_materials(EggGroupNode *node) {
// Access: Public
// Description: Adds a series of EggMaterial nodes to the beginning of
// the indicated node to reflect each of the materials in
// the collection. Returns the number of material nodes
// added.
// the collection. Returns an iterator representing the
// first position after the newly inserted materials.
////////////////////////////////////////////////////////////////////
int EggMaterialCollection::
EggGroupNode::iterator EggMaterialCollection::
insert_materials(EggGroupNode *node) {
return insert_materials(node, node->begin());
}
@ -89,19 +89,20 @@ insert_materials(EggGroupNode *node) {
// Access: Public
// Description: Adds a series of EggMaterial nodes to the beginning of
// the indicated node to reflect each of the materials in
// the collection. Returns the number of material nodes
// added.
// the collection. Returns an iterator representing the
// first position after the newly inserted materials.
////////////////////////////////////////////////////////////////////
int EggMaterialCollection::
EggGroupNode::iterator EggMaterialCollection::
insert_materials(EggGroupNode *node, EggGroupNode::iterator position) {
OrderedMaterials::iterator oti;
for (oti = _ordered_materials.begin();
oti != _ordered_materials.end();
++oti) {
node->insert(position, (*oti).p());
EggMaterial *material = (*oti);
position = node->insert(position, material);
}
return size();
return position;
}
////////////////////////////////////////////////////////////////////

View File

@ -50,8 +50,8 @@ public:
void clear();
int extract_materials(EggGroupNode *node);
int insert_materials(EggGroupNode *node);
int insert_materials(EggGroupNode *node, EggGroupNode::iterator position);
EggGroupNode::iterator insert_materials(EggGroupNode *node);
EggGroupNode::iterator insert_materials(EggGroupNode *node, EggGroupNode::iterator position);
int find_used_materials(EggNode *node);
void remove_unused_materials(EggNode *node);

View File

@ -75,7 +75,9 @@ uniquify(EggNode *node) {
EggGroupNode::iterator ci;
for (ci = group->begin(); ci != group->end(); ++ci) {
uniquify(*ci);
EggNode *child = (*ci);
nassertv(child != (EggNode *)NULL);
uniquify(child);
}
}
}

View File

@ -76,10 +76,10 @@ extract_textures(EggGroupNode *node) {
// Access: Public
// Description: Adds a series of EggTexture nodes to the beginning of
// the indicated node to reflect each of the textures in
// the collection. Returns the number of texture nodes
// added.
// the collection. Returns an iterator representing the
// first position after the newly inserted textures.
////////////////////////////////////////////////////////////////////
int EggTextureCollection::
EggGroupNode::iterator EggTextureCollection::
insert_textures(EggGroupNode *node) {
return insert_textures(node, node->begin());
}
@ -89,19 +89,20 @@ insert_textures(EggGroupNode *node) {
// Access: Public
// Description: Adds a series of EggTexture nodes to the beginning of
// the indicated node to reflect each of the textures in
// the collection. Returns the number of texture nodes
// added.
// the collection. Returns an iterator representing the
// first position after the newly inserted textures.
////////////////////////////////////////////////////////////////////
int EggTextureCollection::
EggGroupNode::iterator EggTextureCollection::
insert_textures(EggGroupNode *node, EggGroupNode::iterator position) {
OrderedTextures::iterator oti;
for (oti = _ordered_textures.begin();
oti != _ordered_textures.end();
++oti) {
node->insert(position, (*oti).p());
EggTexture *texture = (*oti);
position = node->insert(position, texture);
}
return size();
return position;
}
////////////////////////////////////////////////////////////////////

View File

@ -50,8 +50,8 @@ public:
void clear();
int extract_textures(EggGroupNode *node);
int insert_textures(EggGroupNode *node);
int insert_textures(EggGroupNode *node, EggGroupNode::iterator position);
EggGroupNode::iterator insert_textures(EggGroupNode *node);
EggGroupNode::iterator insert_textures(EggGroupNode *node, EggGroupNode::iterator position);
int find_used_textures(EggNode *node);
void remove_unused_textures(EggNode *node);