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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-08-15 20:27:46 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-08-15 20:30:31 +0300
commit74e6218c35e839d27ab9db6ad956c24bb47f464e (patch)
tree268e63c3e68501b24696c842902a3eefec2774e5 /intern
parent3551b0a67213c3f35446a9cd673da4aa3b39ff1e (diff)
Fix T100106: Cycles poor playback performance with still image and auto refresh
The auto refresh option should be ignored in this case.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/shader.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp
index 113a8e47b6d..04eb1576330 100644
--- a/intern/cycles/blender/shader.cpp
+++ b/intern/cycles/blender/shader.cpp
@@ -248,6 +248,13 @@ static void get_tex_mapping(TextureNode *mapping, BL::TexMapping &b_mapping)
mapping->set_tex_mapping_z_mapping((TextureMapping::Mapping)b_mapping.mapping_z());
}
+static bool is_image_animated(BL::Image::source_enum b_image_source, BL::ImageUser &b_image_user)
+{
+ return (b_image_source == BL::Image::source_MOVIE ||
+ b_image_source == BL::Image::source_SEQUENCE) &&
+ b_image_user.use_auto_refresh();
+}
+
static ShaderNode *add_node(Scene *scene,
BL::RenderEngine &b_engine,
BL::BlendData &b_data,
@@ -748,10 +755,11 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(image, b_texture_mapping);
if (b_image) {
+ BL::Image::source_enum b_image_source = b_image.source();
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
image->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name")));
- image->set_animated(b_image_node.image_user().use_auto_refresh());
+ image->set_animated(is_image_animated(b_image_source, b_image_user));
image->set_alpha_type(get_image_alpha_type(b_image));
array<int> tiles;
@@ -763,9 +771,9 @@ static ShaderNode *add_node(Scene *scene,
/* builtin images will use callback-based reading because
* they could only be loaded correct from blender side
*/
- bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED ||
- b_image.source() == BL::Image::source_MOVIE ||
- (b_engine.is_preview() && b_image.source() != BL::Image::source_SEQUENCE);
+ bool is_builtin = b_image.packed_file() || b_image_source == BL::Image::source_GENERATED ||
+ b_image_source == BL::Image::source_MOVIE ||
+ (b_engine.is_preview() && b_image_source != BL::Image::source_SEQUENCE);
if (is_builtin) {
/* for builtin images we're using image datablock name to find an image to
@@ -776,7 +784,7 @@ static ShaderNode *add_node(Scene *scene,
*/
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame);
- if (b_image.source() != BL::Image::source_TILED) {
+ if (b_image_source != BL::Image::source_TILED) {
image->handle = scene->image_manager->add_image(
new BlenderImageLoader(b_image, image_frame, 0, b_engine.is_preview()),
image->image_params());
@@ -812,15 +820,15 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(env, b_texture_mapping);
if (b_image) {
+ BL::Image::source_enum b_image_source = b_image.source();
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
env->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name")));
-
- env->set_animated(b_env_node.image_user().use_auto_refresh());
+ env->set_animated(is_image_animated(b_image_source, b_image_user));
env->set_alpha_type(get_image_alpha_type(b_image));
- bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED ||
- b_image.source() == BL::Image::source_MOVIE ||
- (b_engine.is_preview() && b_image.source() != BL::Image::source_SEQUENCE);
+ bool is_builtin = b_image.packed_file() || b_image_source == BL::Image::source_GENERATED ||
+ b_image_source == BL::Image::source_MOVIE ||
+ (b_engine.is_preview() && b_image_source != BL::Image::source_SEQUENCE);
if (is_builtin) {
int scene_frame = b_scene.frame_current();