[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45700] trunk/blender/source/blender: fix for fail thumbs being used when the failed thumbnail image is older then the image /movie/blend.
Campbell Barton
ideasman42 at gmail.com
Mon Apr 16 17:13:21 CEST 2012
Revision: 45700
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45700
Author: campbellbarton
Date: 2012-04-16 15:13:21 +0000 (Mon, 16 Apr 2012)
Log Message:
-----------
fix for fail thumbs being used when the failed thumbnail image is older then the image/movie/blend.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/storage.c
trunk/blender/source/blender/imbuf/intern/thumbs.c
Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c 2012-04-16 14:34:48 UTC (rev 45699)
+++ trunk/blender/source/blender/blenlib/intern/storage.c 2012-04-16 15:13:21 UTC (rev 45700)
@@ -551,6 +551,7 @@
BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN);
}
+/** is file1 older then file2 */
int BLI_file_older(const char *file1, const char *file2)
{
#ifdef WIN32
Modified: trunk/blender/source/blender/imbuf/intern/thumbs.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/thumbs.c 2012-04-16 14:34:48 UTC (rev 45699)
+++ trunk/blender/source/blender/imbuf/intern/thumbs.c 2012-04-16 15:13:21 UTC (rev 45700)
@@ -223,6 +223,8 @@
to_hex_char(hexdigest, digest, 16);
hexdigest[32] = '\0';
BLI_snprintf(thumb, thumb_len, "%s.png", hexdigest);
+
+ // printf("%s: '%s' --> '%s'\n", __func__, uri, thumb);
}
static int thumbpath_from_uri(const char* uri, char* path, const int path_len, ThumbSize size)
@@ -378,7 +380,9 @@
if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) {
#ifndef WIN32
chmod(temp, S_IRUSR | S_IWUSR);
-#endif
+#endif
+ // printf("%s saving thumb: '%s'\n", __func__, tpath);
+
BLI_rename(temp, tpath);
}
@@ -441,7 +445,13 @@
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) {
/* failure thumb exists, don't try recreating */
if (BLI_exists(thumb)) {
- return NULL;
+ /* clear out of date fail case */
+ if (BLI_file_older(thumb, path)) {
+ BLI_delete(thumb, 0, 0);
+ }
+ else {
+ return NULL;
+ }
}
}
More information about the Bf-blender-cvs
mailing list