Parcourir la source

fix assertion failure when texture is no longer used

David Rose il y a 22 ans
Parent
commit
b3fd81d53e

+ 3 - 0
pandatool/src/palettizer/omitReason.cxx

@@ -41,6 +41,9 @@ operator << (ostream &out, OmitReason omit) {
 
 
   case OR_unknown:
   case OR_unknown:
     return out << "unknown";
     return out << "unknown";
+
+  case OR_unused:
+    return out << "unused";
   }
   }
 
 
   return out << "**invalid**(" << (int)omit << ")";
   return out << "**invalid**(" << (int)omit << ")";

+ 4 - 0
pandatool/src/palettizer/omitReason.h

@@ -49,6 +49,10 @@ enum OmitReason {
 
 
   OR_unknown,
   OR_unknown,
   // The texture file cannot be read, so its size can't be determined.
   // The texture file cannot be read, so its size can't be determined.
+
+  OR_unused,
+  // The texture is no longer used by any of the egg files that
+  // formerly referenced it.
 };
 };
 
 
 ostream &operator << (ostream &out, OmitReason omit);
 ostream &operator << (ostream &out, OmitReason omit);

+ 6 - 1
pandatool/src/palettizer/texturePlacement.cxx

@@ -282,7 +282,12 @@ determine_size() {
     }
     }
   }
   }
 
 
-  nassertr(_has_uvs, false);
+  if (!_has_uvs) {
+    force_replace();
+    _omit_reason = OR_unused;
+    return false;
+  }
+
   TexCoordd rounded_min_uv = min_uv;
   TexCoordd rounded_min_uv = min_uv;
   TexCoordd rounded_max_uv = max_uv;
   TexCoordd rounded_max_uv = max_uv;