Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-09-02 18:23:42 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-09-02 18:23:42 +0400
commit568a0c81992a8de683617d2509d89e0a73214f31 (patch)
tree60ce3eede0184a8656ccac68fea64898a0aa14ab /source/blender/blenkernel/intern/bpath.c
parent55daa3cc6bb8e939a5112217f161d256f6d72485 (diff)
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).
Diffstat (limited to 'source/blender/blenkernel/intern/bpath.c')
-rw-r--r--source/blender/blenkernel/intern/bpath.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 4018b757559..4d5107efad7 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -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 @@ static bool rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *a
}
}
+/* 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 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
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;