Fix #115859: Cryptomatte node considers preview channels

The Cryptomatte node considers preview channels as part of the
Cryptomatte layers, producing bad pick outputs at best and bad mattes at
worst.

The Cryptomatte specification specifies that a layer with the same name
as the typename is a (Now deprecated) preview layer, so it should be
ignored, which is what the patch does.

Pull Request: https://projects.blender.org/blender/blender/pulls/115879
This commit is contained in:
Omar Emara
2023-12-07 10:00:55 +01:00
committed by Omar Emara
parent 5475d8c5cf
commit 45dcc61fd2

View File

@@ -121,7 +121,7 @@ void CryptomatteNode::input_operations_from_render_source(
}
const std::string combined_name = combined_layer_pass_name(render_layer, render_pass);
if (blender::StringRef(combined_name).startswith(prefix)) {
if (combined_name != prefix && blender::StringRef(combined_name).startswith(prefix)) {
RenderLayersProg *op = new RenderLayersProg(
render_pass->name, DataType::Color, render_pass->channels);
op->set_scene(scene);
@@ -183,7 +183,7 @@ void CryptomatteNode::input_operations_from_image_source(
}
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)) {
if (combined_name != prefix && blender::StringRef(combined_name).startswith(prefix)) {
MultilayerColorOperation *op = new MultilayerColorOperation(
render_layer, render_pass, view);
op->set_image(image);