diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-06-22 00:18:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-06-22 00:21:04 +0400 |
commit | 88d8358f91e1306a67d59250162443194ee9edcf (patch) | |
tree | 27b62bb88e8815389fd465373a0baadfdf46e29c /intern/cycles/render | |
parent | 177e1ec9b22af557d669089da6063ca34479c9d2 (diff) |
Fix T40703: cycles viewport smoke not updating when changing frame.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/image.cpp | 24 | ||||
-rw-r--r-- | intern/cycles/render/image.h | 4 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 12 |
3 files changed, 30 insertions, 10 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 30d07fe0a7f..8369df5e137 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -157,7 +157,8 @@ static bool image_equals(ImageManager::Image *image, const string& filename, voi image->interpolation == interpolation; } -int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha) +int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, float frame, + bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha) { Image *img; size_t slot; @@ -168,8 +169,13 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani if(is_float) { /* find existing image */ for(slot = 0; slot < float_images.size(); slot++) { - if(float_images[slot] && image_equals(float_images[slot], filename, builtin_data, interpolation)) { - float_images[slot]->users++; + img = float_images[slot]; + if(img && image_equals(img, filename, builtin_data, interpolation)) { + if(img->frame != frame) { + img->frame = frame; + img->need_load = true; + } + img->users++; return slot; } } @@ -197,6 +203,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani img->builtin_data = builtin_data; img->need_load = true; img->animated = animated; + img->frame = frame; img->interpolation = interpolation; img->users = 1; img->use_alpha = use_alpha; @@ -205,8 +212,13 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani } else { for(slot = 0; slot < images.size(); slot++) { - if(images[slot] && image_equals(images[slot], filename, builtin_data, interpolation)) { - images[slot]->users++; + img = images[slot]; + if(img && image_equals(img, filename, builtin_data, interpolation)) { + if(img->frame != frame) { + img->frame = frame; + img->need_load = true; + } + img->users++; return slot+tex_image_byte_start; } } @@ -234,6 +246,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani img->builtin_data = builtin_data; img->need_load = true; img->animated = animated; + img->frame = frame; img->interpolation = interpolation; img->users = 1; img->use_alpha = use_alpha; @@ -242,6 +255,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani slot += tex_image_byte_start; } + need_update = true; return slot; diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 3eacfa7beed..50ea346c034 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -55,7 +55,8 @@ public: ImageManager(); ~ImageManager(); - int add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha); + int add_image(const string& filename, void *builtin_data, bool animated, float frame, + 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); bool is_float_image(const string& filename, void *builtin_data, bool& is_linear); @@ -82,6 +83,7 @@ public: bool use_alpha; bool need_load; bool animated; + float frame; InterpolationType interpolation; int users; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 6401d6d8e36..251afe9a0a2 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -243,7 +243,9 @@ void ImageTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(is_float == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear, interpolation, use_alpha); + slot = image_manager->add_image(filename, builtin_data, + animated, 0, is_float_bool, is_linear, + interpolation, use_alpha); is_float = (int)is_float_bool; } @@ -313,7 +315,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler) else { bool is_float_bool; slot = image_manager->add_image(filename, builtin_data, - animated, is_float_bool, is_linear, + animated, 0, is_float_bool, is_linear, interpolation, use_alpha); is_float = (int)is_float_bool; } @@ -430,7 +432,9 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(slot == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear, INTERPOLATION_LINEAR, use_alpha); + slot = image_manager->add_image(filename, builtin_data, + animated, 0, is_float_bool, is_linear, + INTERPOLATION_LINEAR, use_alpha); is_float = (int)is_float_bool; } @@ -491,7 +495,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) else { bool is_float_bool; slot = image_manager->add_image(filename, builtin_data, - animated, is_float_bool, is_linear, + animated, 0, is_float_bool, is_linear, INTERPOLATION_LINEAR, use_alpha); is_float = (int)is_float_bool; } |