From 45b5c4a9bf291424bfb089086951ba5978c19cfe Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 16 Aug 2002 17:28:20 +0000 Subject: [PATCH] make friendlier when source textures are not found --- pandatool/src/egg-palettize/destTextureImage.cxx | 8 +++++--- pandatool/src/egg-palettize/textureImage.cxx | 8 +++++++- pandatool/src/egg-palettize/textureReference.cxx | 10 +++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pandatool/src/egg-palettize/destTextureImage.cxx b/pandatool/src/egg-palettize/destTextureImage.cxx index f627d6d3e6..7a63317e4e 100644 --- a/pandatool/src/egg-palettize/destTextureImage.cxx +++ b/pandatool/src/egg-palettize/destTextureImage.cxx @@ -49,9 +49,11 @@ DestTextureImage:: DestTextureImage(TexturePlacement *placement) { TextureImage *texture = placement->get_texture(); _properties = texture->get_properties(); - _size_known = true; - _x_size = texture->get_x_size(); - _y_size = texture->get_y_size(); + _size_known = texture->is_size_known(); + if (_size_known) { + _x_size = texture->get_x_size(); + _y_size = texture->get_y_size(); + } if (pal->_force_power_2) { _x_size = to_power_2(_x_size); diff --git a/pandatool/src/egg-palettize/textureImage.cxx b/pandatool/src/egg-palettize/textureImage.cxx index 3769d905ff..24183d0545 100644 --- a/pandatool/src/egg-palettize/textureImage.cxx +++ b/pandatool/src/egg-palettize/textureImage.cxx @@ -633,7 +633,8 @@ copy_unplaced(bool redo_all) { Placement::iterator pi; for (pi = _placement.begin(); pi != _placement.end(); ++pi) { TexturePlacement *placement = (*pi).second; - if (placement->get_omit_reason() != OR_none) { + if (placement->get_omit_reason() != OR_none && + placement->get_omit_reason() != OR_unknown) { DestTextureImage *dest = new DestTextureImage(placement); Filename filename = dest->get_filename(); filename.make_canonical(); @@ -858,6 +859,11 @@ write_scale_info(ostream &out, int indent_level) { << "placed on " << FilenameUnifier::make_user_filename(image->get_filename()) << "\n"; + + } else if (placement->get_omit_reason() == OR_unknown) { + indent(out, indent_level + 2) + << "not placed because unknown.\n"; + } else { DestTextureImage *image = placement->get_dest(); nassertv(image != (DestTextureImage *)NULL); diff --git a/pandatool/src/egg-palettize/textureReference.cxx b/pandatool/src/egg-palettize/textureReference.cxx index 0bdb8a0c0f..bde7c82e9c 100644 --- a/pandatool/src/egg-palettize/textureReference.cxx +++ b/pandatool/src/egg-palettize/textureReference.cxx @@ -310,8 +310,16 @@ update_egg() { // We check for an OmitReason of OR_none, rather than asking // is_placed(), because in this case we don't want to consider an // OR_solitary texture as having been placed. + if (_placement->get_omit_reason() == OR_unknown) { + // The texture doesn't even exist. We can't update the egg to + // point to any meaningful path; just leave it pointing to the + // source texture. Maybe it will be found along the texture path + // later. + texture->update_egg_tex(_egg_tex); + return; + } if (_placement->get_omit_reason() != OR_none) { - // The texture does not appear on a palette. This is the easy + // The texture exists but is not on a palette. This is the easy // case; we simply have to update the texture reference to the new // texture location. DestTextureImage *dest = _placement->get_dest();