diff options
author | Colin Basnett <cmbasnett@gmail.com> | 2022-09-17 03:50:37 +0300 |
---|---|---|
committer | Colin Basnett <cmbasnett@gmail.com> | 2022-09-17 03:50:37 +0300 |
commit | 564bda241a973396da51d7c3ccd9efd97d51728a (patch) | |
tree | 4d9aa4cccd82e2e606b47774afa5e1015bf14768 /source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc | |
parent | 0fff238150d076576053c25b646f653d6e3b0edb (diff) | |
parent | 48d7ff68f0df209c77bbb081ab46fbc109fd825a (diff) |
Merge branch 'master' into feature-imformatfeature-imformat
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 9193f91087a..7e5544381a4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -17,12 +17,17 @@ #include "BKE_context.h" #include "BKE_cryptomatte.hh" #include "BKE_global.h" +#include "BKE_image.h" #include "BKE_lib_id.h" #include "BKE_library.h" #include "BKE_main.h" #include "MEM_guardedalloc.h" +#include "RE_pipeline.h" + +#include "COM_node_operation.hh" + #include <optional> /* -------------------------------------------------------------------- */ @@ -102,7 +107,6 @@ static blender::bke::cryptomatte::CryptomatteSessionPtr cryptomatte_init_from_no return session; } -extern "C" { static CryptomatteEntry *cryptomatte_find(const NodeCryptomatte &n, float encoded_hash) { LISTBASE_FOREACH (CryptomatteEntry *, entry, &n.entries) { @@ -296,6 +300,25 @@ static bool node_poll_cryptomatte(bNodeType *UNUSED(ntype), return false; } +using namespace blender::realtime_compositor; + +class CryptoMatteOperation : public NodeOperation { + public: + using NodeOperation::NodeOperation; + + void execute() override + { + get_input("Image").pass_through(get_result("Image")); + get_result("Matte").allocate_invalid(); + get_result("Pick").allocate_invalid(); + } +}; + +static NodeOperation *get_compositor_operation(Context &context, DNode node) +{ + return new CryptoMatteOperation(context, node); +} + } // namespace blender::nodes::node_composite_cryptomatte_cc void register_node_type_cmp_cryptomatte() @@ -313,6 +336,8 @@ void register_node_type_cmp_cryptomatte() ntype.poll = file_ns::node_poll_cryptomatte; node_type_storage( &ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte); + ntype.get_compositor_operation = file_ns::get_compositor_operation; + nodeRegisterType(&ntype); } @@ -347,7 +372,7 @@ int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node) return 1; } -namespace blender::nodes::node_composite_cryptomatte_cc { +namespace blender::nodes::node_composite_legacy_cryptomatte_cc { static void node_init_cryptomatte_legacy(bNodeTree *ntree, bNode *node) { @@ -362,22 +387,43 @@ static void node_init_cryptomatte_legacy(bNodeTree *ntree, bNode *node) ntreeCompositCryptomatteAddSocket(ntree, node); } -} // namespace blender::nodes::node_composite_cryptomatte_cc +using namespace blender::realtime_compositor; + +class CryptoMatteOperation : public NodeOperation { + public: + using NodeOperation::NodeOperation; + + void execute() override + { + get_input("image").pass_through(get_result("Image")); + get_result("Matte").allocate_invalid(); + get_result("Pick").allocate_invalid(); + } +}; + +static NodeOperation *get_compositor_operation(Context &context, DNode node) +{ + return new CryptoMatteOperation(context, node); +} + +} // namespace blender::nodes::node_composite_legacy_cryptomatte_cc void register_node_type_cmp_cryptomatte_legacy() { - namespace legacy_file_ns = blender::nodes::node_composite_cryptomatte_cc; + namespace legacy_file_ns = blender::nodes::node_composite_legacy_cryptomatte_cc; namespace file_ns = blender::nodes::node_composite_cryptomatte_cc; static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte", NODE_CLASS_MATTE); node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out); - node_type_init(&ntype, file_ns::node_init_cryptomatte_legacy); + node_type_init(&ntype, legacy_file_ns::node_init_cryptomatte_legacy); node_type_storage( &ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte); + ntype.gather_link_search_ops = nullptr; + ntype.get_compositor_operation = legacy_file_ns::get_compositor_operation; + nodeRegisterType(&ntype); } /** \} */ -} |