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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-07-18 17:28:33 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-07-18 17:37:32 +0400
commit9a45c9dadf435ac6c1329372dc08f21b1af242c6 (patch)
tree91bc74aa7ac5ca8bedfdc8f19016be2dcba6bf98 /intern/cycles/render
parentb98448918160f05feb725c29a9c6b7c2cf4257f8 (diff)
Fix T41109: Reloading image that has been modified outside Blender does not update image in Image Texture nodes
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/image.cpp26
-rw-r--r--intern/cycles/render/image.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 8369df5e137..f84396ab6a1 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -313,6 +313,32 @@ void ImageManager::remove_image(const string& filename, void *builtin_data, Inte
}
}
+/* TODO(sergey): Deduplicate with the iteration above, but make it pretty,
+ * without bunch of arguments passing around making code readability even
+ * more cluttered.
+ */
+void ImageManager::tag_reload_image(const string& filename, void *builtin_data, InterpolationType interpolation)
+{
+ size_t slot;
+
+ for(slot = 0; slot < images.size(); slot++) {
+ if(images[slot] && image_equals(images[slot], filename, builtin_data, interpolation)) {
+ images[slot]->need_load = true;
+ break;
+ }
+ }
+
+ if(slot == images.size()) {
+ /* see if it's in a float texture slot */
+ for(slot = 0; slot < float_images.size(); slot++) {
+ if(float_images[slot] && image_equals(float_images[slot], filename, builtin_data, interpolation)) {
+ images[slot]->need_load = true;
+ break;
+ }
+ }
+ }
+}
+
bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
{
if(img->filename == "")
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 50ea346c034..535f0ff156d 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -59,6 +59,7 @@ public:
bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha);
void remove_image(int slot);
void remove_image(const string& filename, void *builtin_data, InterpolationType interpolation);
+ void tag_reload_image(const string& filename, void *builtin_data, InterpolationType interpolation);
bool is_float_image(const string& filename, void *builtin_data, bool& is_linear);
void device_update(Device *device, DeviceScene *dscene, Progress& progress);