From 9fdb85793c611dee6ca5719fb4f35dd0904a7883 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 4 Jun 2003 22:09:32 +0000 Subject: [PATCH] only check timestamps for textures named on command line --- pandatool/src/egg-palettize/paletteImage.cxx | 21 +++++++++------ pandatool/src/egg-palettize/palettizer.cxx | 4 ++- pandatool/src/egg-palettize/textureImage.cxx | 27 ++++++++++++++++++++ pandatool/src/egg-palettize/textureImage.h | 4 +++ 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/pandatool/src/egg-palettize/paletteImage.cxx b/pandatool/src/egg-palettize/paletteImage.cxx index b38b636801..c3fde1525f 100644 --- a/pandatool/src/egg-palettize/paletteImage.cxx +++ b/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(); + TextureImage *texture = placement->get_texture(); - 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; + // 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; + } } } } diff --git a/pandatool/src/egg-palettize/palettizer.cxx b/pandatool/src/egg-palettize/palettizer.cxx index 8ac8b18330..ef65ee3ee2 100644 --- a/pandatool/src/egg-palettize/palettizer.cxx +++ b/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(); diff --git a/pandatool/src/egg-palettize/textureImage.cxx b/pandatool/src/egg-palettize/textureImage.cxx index a72597ef80..81f2306b00 100644 --- a/pandatool/src/egg-palettize/textureImage.cxx +++ b/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 diff --git a/pandatool/src/egg-palettize/textureImage.h b/pandatool/src/egg-palettize/textureImage.h index fdd0487594..e9fd130d47 100644 --- a/pandatool/src/egg-palettize/textureImage.h +++ b/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;