[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59737] trunk/blender/source/blender/ blenkernel/intern/bpath.c: Fix #36639, textures not reloaded after fixing paths.

Lukas Toenne lukas.toenne at googlemail.com
Mon Sep 2 16:23:42 CEST 2013


Revision: 59737
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59737
Author:   lukastoenne
Date:     2013-09-02 14:23:42 +0000 (Mon, 02 Sep 2013)
Log Message:
-----------
Fix #36639, textures not reloaded after fixing paths.
The BKE_bpath_traverse_id method updates path variables of image data blocks, but did not cause the image to be reloaded (or rather, tagged so it gets reloaded on next use). This requires also updating
all the ImageUser "ok" tags, which happens in some odd places in other cases where reload happens (e.g. the reload operator and the image path button handler function in image template).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/bpath.c

Modified: trunk/blender/source/blender/blenkernel/intern/bpath.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/bpath.c	2013-09-02 14:14:02 UTC (rev 59736)
+++ trunk/blender/source/blender/blenkernel/intern/bpath.c	2013-09-02 14:23:42 UTC (rev 59737)
@@ -76,7 +76,7 @@
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_sequencer.h"
-#include "BKE_image.h" /* so we can check the image's type */
+#include "BKE_image.h"
 
 #include "BKE_bpath.h"  /* own include */
 
@@ -388,6 +388,13 @@
 	}
 }
 
+/* fix the image user "ok" tag after updating paths, so ImBufs get loaded */
+static void bpath_traverse_image_user_cb(Image *ima, ImageUser *iuser, void *customdata)
+{
+	if (ima == customdata)
+		iuser->ok = 1;
+}
+
 /* Run visitor function 'visit' on all paths contained in 'id'. */
 void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
@@ -405,6 +412,8 @@
 			if (ima->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
 				if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
 					rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
+					BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+					BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb);
 				}
 			}
 			break;




More information about the Bf-blender-cvs mailing list