瀏覽代碼

make friendlier when source textures are not found

David Rose 23 年之前
父節點
當前提交
45b5c4a9bf

+ 5 - 3
pandatool/src/egg-palettize/destTextureImage.cxx

@@ -49,9 +49,11 @@ DestTextureImage::
 DestTextureImage(TexturePlacement *placement) {
 DestTextureImage(TexturePlacement *placement) {
   TextureImage *texture = placement->get_texture();
   TextureImage *texture = placement->get_texture();
   _properties = texture->get_properties();
   _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) {
   if (pal->_force_power_2) {
     _x_size = to_power_2(_x_size);
     _x_size = to_power_2(_x_size);

+ 7 - 1
pandatool/src/egg-palettize/textureImage.cxx

@@ -633,7 +633,8 @@ copy_unplaced(bool redo_all) {
   Placement::iterator pi;
   Placement::iterator pi;
   for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
   for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
     TexturePlacement *placement = (*pi).second;
     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);
       DestTextureImage *dest = new DestTextureImage(placement);
       Filename filename = dest->get_filename();
       Filename filename = dest->get_filename();
       filename.make_canonical();
       filename.make_canonical();
@@ -858,6 +859,11 @@ write_scale_info(ostream &out, int indent_level) {
         << "placed on "
         << "placed on "
         << FilenameUnifier::make_user_filename(image->get_filename())
         << FilenameUnifier::make_user_filename(image->get_filename())
         << "\n";
         << "\n";
+
+    } else if (placement->get_omit_reason() == OR_unknown) {
+      indent(out, indent_level + 2)
+        << "not placed because unknown.\n";
+
     } else {
     } else {
       DestTextureImage *image = placement->get_dest();
       DestTextureImage *image = placement->get_dest();
       nassertv(image != (DestTextureImage *)NULL);
       nassertv(image != (DestTextureImage *)NULL);

+ 9 - 1
pandatool/src/egg-palettize/textureReference.cxx

@@ -310,8 +310,16 @@ update_egg() {
   // We check for an OmitReason of OR_none, rather than asking
   // We check for an OmitReason of OR_none, rather than asking
   // is_placed(), because in this case we don't want to consider an
   // is_placed(), because in this case we don't want to consider an
   // OR_solitary texture as having been placed.
   // 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) {
   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
     // case; we simply have to update the texture reference to the new
     // texture location.
     // texture location.
     DestTextureImage *dest = _placement->get_dest();
     DestTextureImage *dest = _placement->get_dest();