diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-01-05 18:16:18 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-01-05 18:34:55 +0300 |
commit | 9dbea1db66da5e277e8279811d66096751f38d29 (patch) | |
tree | 4fe64c2cb671e0c08f91a37d80c180689c9dec1d /source/blender/nodes/composite | |
parent | 357e519575411cc338acfe899fde6e5ea3476801 (diff) |
Compositor: Alpha Mode
{D9211} introduced pre-multiplying the color for the keying node. This
pre-multiplication should also be done by other keying nodes and should be
the default operation for alpha node.
This patch will change the logic of keying nodes (Cryptomatte Node,
Channel Matte, Chroma Matte, Color Matte, Difference Matte, Distance
Matte, Luminance Matte) and breaks old files.
The Set alpha node has a mode parameter. This parameter changes
the logic to `Apply Mask` the alpha on the RGBA channels of the input color
or only replace the alpha channel (old behavior).
The replace mode is automatically set for older files. When adding
new files the the multiply mode is set.
Reviewed By: Sergey Sharybin
Differential Revision: https://developer.blender.org/D9630
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_setalpha.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c index a1ede7dbb1f..1488ff1a25f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c @@ -34,12 +34,22 @@ static bNodeSocketTemplate cmp_node_setalpha_out[] = { {-1, ""}, }; +static void node_composit_init_setalpha(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeSetAlpha *settings = MEM_callocN(sizeof(NodeSetAlpha), __func__); + node->storage = settings; + settings->mode = CMP_NODE_SETALPHA_MODE_APPLY; +} + void register_node_type_cmp_setalpha(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out); + node_type_init(&ntype, node_composit_init_setalpha); + node_type_storage( + &ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage); nodeRegisterType(&ntype); } |