diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-05-18 18:03:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-05-18 18:03:19 +0300 |
commit | b712dbe5de2dcba3338f42b74b75388453d52d23 (patch) | |
tree | ce1939518256c3580002245d272efe79491f47ac /source/blender/depsgraph/intern | |
parent | 708547ab06519ce741a091a20777cd5b1bf27120 (diff) | |
parent | c56103356f642041f76c0be84772a40f1caad9df (diff) |
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 19 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 11 |
2 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 4782f1c4a5d..c6fc3cd5d0b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1078,14 +1078,17 @@ void DepsgraphNodeBuilder::build_animdata_nlastrip_targets(ListBase *strips) void DepsgraphNodeBuilder::build_animation_images(ID *id) { - /* GPU materials might use an animated image. However, these materials have no been built yet. We - * could scan the entire node tree recursively to check if any texture node has a video. That is - * quite expensive. For now just always add this operation node, because it is very fast. */ - /* TODO: Add a more precise check when it is cheaper to iterate over all image nodes in a node - * tree. */ - const bool can_have_gpu_material = ELEM(GS(id->name), ID_MA, ID_WO); - - if (can_have_gpu_material || BKE_image_user_id_has_animation(id)) { + /* GPU materials might use an animated image. However, these materials have no been built yet so + * we have to check if they might be created during evaluation. */ + bool has_image_animation = false; + if (ELEM(GS(id->name), ID_MA, ID_WO)) { + bNodeTree *ntree = *BKE_ntree_ptr_from_id(id); + if (ntree != nullptr && ntree->runtime_flag & NTREE_RUNTIME_FLAG_HAS_IMAGE_ANIMATION) { + has_image_animation = true; + } + } + + if (has_image_animation || BKE_image_user_id_has_animation(id)) { ID *id_cow = get_cow_id(id); add_operation_node( id, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 5eccb5a4eb2..3eeab23823c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1446,10 +1446,15 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) void DepsgraphRelationBuilder::build_animation_images(ID *id) { /* See #DepsgraphNodeBuilder::build_animation_images. */ - const bool can_have_gpu_material = ELEM(GS(id->name), ID_MA, ID_WO); + bool has_image_animation = false; + if (ELEM(GS(id->name), ID_MA, ID_WO)) { + bNodeTree *ntree = *BKE_ntree_ptr_from_id(id); + if (ntree != nullptr && ntree->runtime_flag & NTREE_RUNTIME_FLAG_HAS_IMAGE_ANIMATION) { + has_image_animation = true; + } + } - /* TODO: can we check for existence of node for performance? */ - if (can_have_gpu_material || BKE_image_user_id_has_animation(id)) { + if (has_image_animation || BKE_image_user_id_has_animation(id)) { OperationKey image_animation_key( id, NodeType::IMAGE_ANIMATION, OperationCode::IMAGE_ANIMATION); TimeSourceKey time_src_key; |