Kaynağa Gözat

only check timestamps for textures named on command line

David Rose 22 yıl önce
ebeveyn
işleme
9fdb85793c

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

@@ -569,15 +569,20 @@ update_image(bool redo_all) {
       needs_update = true;
 
     } else {
-      SourceTextureImage *source =
-        placement->get_texture()->get_preferred_source();
-
-      if (source != (SourceTextureImage *)NULL &&
-          source->get_filename().compare_timestamps(get_filename()) > 0) {
-        // The source image is newer than the palette image; we need to
-        // regenerate.
-        placement->mark_unfilled();
-        needs_update = true;
+      TextureImage *texture = placement->get_texture();
+
+      // Only check the timestamps on textures that are named
+      // (indirectly) on the command line.
+      if (texture->is_texture_named()) {
+        SourceTextureImage *source = texture->get_preferred_source();
+
+        if (source != (SourceTextureImage *)NULL &&
+            source->get_filename().compare_timestamps(get_filename()) > 0) {
+          // The source image is newer than the palette image; we need to
+          // regenerate.
+          placement->mark_unfilled();
+          needs_update = true;
+        }
       }
     }
   }

+ 3 - 1
pandatool/src/egg-palettize/palettizer.cxx

@@ -392,7 +392,7 @@ process_command_line_eggs(bool force_texture_read, const Filename &state_filenam
 
     egg_file->scan_textures();
     egg_file->get_textures(_command_line_textures);
-
+    
     egg_file->pre_txa_file();
     _txa_file.match_egg(egg_file);
     egg_file->post_txa_file();
@@ -422,6 +422,7 @@ process_command_line_eggs(bool force_texture_read, const Filename &state_filenam
       texture->read_header();
     }
 
+    texture->mark_texture_named();
     texture->pre_txa_file();
     _txa_file.match_texture(texture);
     texture->post_txa_file();
@@ -525,6 +526,7 @@ process_all(bool force_texture_read, const Filename &state_filename) {
       texture->read_source_image();
     }
 
+    texture->mark_texture_named();
     texture->pre_txa_file();
     _txa_file.match_texture(texture);
     texture->post_txa_file();

+ 27 - 0
pandatool/src/egg-palettize/textureImage.cxx

@@ -50,6 +50,7 @@ TextureImage() {
   _forced_grayscale = false;
   _alpha_bits = 0;
   _alpha_mode = EggRenderMode::AM_unspecified;
+  _texture_named = false;
   _got_txa_file = false;
 }
 
@@ -248,6 +249,32 @@ mark_eggs_stale() {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: TextureImage::mark_texture_named
+//       Access: Public
+//  Description: Indicates that this particular texture has been named
+//               by the user for processing this session, normally by
+//               listing an egg file on the command line that
+//               references it.
+////////////////////////////////////////////////////////////////////
+void TextureImage::
+mark_texture_named() {
+  _texture_named = true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextureImage::is_texture_named
+//       Access: Public
+//  Description: Returns true if this particular texture has been
+//               named by the user for procession this session, for
+//               instance by listing an egg file on the command line
+//               that references it.
+////////////////////////////////////////////////////////////////////
+bool TextureImage::
+is_texture_named() const {
+  return _texture_named;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: TextureImage::pre_txa_file
 //       Access: Public

+ 4 - 0
pandatool/src/egg-palettize/textureImage.h

@@ -64,6 +64,9 @@ public:
   void force_replace();
   void mark_eggs_stale();
 
+  void mark_texture_named();
+  bool is_texture_named() const;
+
   void pre_txa_file();
   void post_txa_file();
   bool got_txa_file() const;
@@ -146,6 +149,7 @@ private:
 
   bool _read_source_image;
   PNMImage _source_image;
+  bool _texture_named;
   bool _got_txa_file;