Procházet zdrojové kódy

*** empty log message ***

David Rose před 25 roky
rodič
revize
25fd0d0c3a
1 změnil soubory, kde provedl 13 přidání a 9 odebrání
  1. 13 9
      pandatool/src/egg-palettize/paletteImage.cxx

+ 13 - 9
pandatool/src/egg-palettize/paletteImage.cxx

@@ -186,20 +186,24 @@ get_page() const {
 //     Function: PaletteImage::is_empty
 //     Function: PaletteImage::is_empty
 //       Access: Public
 //       Access: Public
 //  Description: Returns true if there are no textures, or only one
 //  Description: Returns true if there are no textures, or only one
-//               texture, placed on the image.  In either case, the
-//               PaletteImage need not be generated.
+//               "solitary" texture, placed on the image.  In either
+//               case, the PaletteImage need not be generated.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool PaletteImage::
 bool PaletteImage::
 is_empty() const {
 is_empty() const {
-  if (pal->_omit_solitary) {
-    // If we're omitting solitary textures, the image is considered
-    // empty even if it has one texture.
-    return _placements.size() < 2;
+  if (_placements.empty()) {
+    // The image is genuinely empty.
+    return true;
+
+  } else if (_placements.size() == 1) {
+    // If the image has exactly one texture, we consider the image
+    // empty only if the texture is actually flagged as 'solitary'.
+    return (_placements[0]->get_omit_reason() == OR_solitary);
 
 
   } else {
   } else {
-    // If we're not omitting solitary textures, the image is only
-    // empty if it has no textures.
-    return _placements.empty();
+    // The image has more than one texture, so it's definitely not
+    // empty.
+    return false;
   }
   }
 }
 }