diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-03-30 12:05:10 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-03-30 17:03:43 +0300 |
commit | d4e76712d4fdf55815cf59df52ffa35df84ed09a (patch) | |
tree | 2fcc9a90ae45c2c0cea36860fec2991a4b0359bb /source/blender | |
parent | e125c9329d44ec096199618d7880c0212e0f8176 (diff) |
Cryptomatte: Fix When Image based Cryptomatte Aren't On The First Render Layer.
The image user wasn't updated to reflect the correct render layer.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/compositor/nodes/COM_CryptomatteNode.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index f5025285a34..89caff047b4 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -178,7 +178,12 @@ void CryptomatteNode::input_operations_from_image_source( } const std::string prefix = prefix_from_node(node); - LISTBASE_FOREACH (RenderLayer *, render_layer, &image->rr->layers) { + int layer_index; + LISTBASE_FOREACH_INDEX (RenderLayer *, render_layer, &image->rr->layers, layer_index) { + if (!blender::StringRef(prefix).startswith(blender::StringRef( + render_layer->name, BLI_strnlen(render_layer->name, sizeof(render_layer->name))))) { + continue; + } LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) { const std::string combined_name = combined_layer_pass_name(render_layer, render_pass); if (blender::StringRef(combined_name).startswith(prefix)) { @@ -186,10 +191,12 @@ void CryptomatteNode::input_operations_from_image_source( render_layer, render_pass, view); op->setImage(image); op->setImageUser(iuser); + iuser->layer = layer_index; op->setFramenumber(context.getFramenumber()); r_input_operations.append(op); } } + break; } } BKE_image_release_ibuf(image, ibuf, nullptr); |