Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
| Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | if (STREQ(ntree->idname, "CompositorNodeTree")) { | ||||
| for (scene = static_cast<Scene *>(G.main->scenes.first); scene; | for (scene = static_cast<Scene *>(G.main->scenes.first); scene; | ||||
| scene = static_cast<Scene *>(scene->id.next)) { | scene = static_cast<Scene *>(scene->id.next)) { | ||||
| if (scene->nodetree == ntree) { | if (scene->nodetree == ntree) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (scene == nullptr) { | if (scene == nullptr) { | ||||
| *r_disabled_hint = | *r_disabled_hint = TIP_( | ||||
| TIP_("The node tree must be the compositing node tree of any scene in the file"); | "The node tree must be the compositing node tree of any scene in the file"); | ||||
| } | } | ||||
| return scene != nullptr; | return scene != nullptr; | ||||
| } | } | ||||
| *r_disabled_hint = TIP_("Not a compositor node tree"); | *r_disabled_hint = TIP_("Not a compositor node tree"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| void register_node_type_cmp_cryptomatte(void) | void register_node_type_cmp_cryptomatte() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE, 0); | cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_cryptomatte_in, cmp_node_cryptomatte_out); | node_type_socket_templates(&ntype, cmp_node_cryptomatte_in, cmp_node_cryptomatte_out); | ||||
| node_type_size(&ntype, 240, 100, 700); | node_type_size(&ntype, 240, 100, 700); | ||||
| node_type_init(&ntype, node_init_cryptomatte); | node_type_init(&ntype, node_init_cryptomatte); | ||||
| ntype.initfunc_api = node_init_api_cryptomatte; | ntype.initfunc_api = node_init_api_cryptomatte; | ||||
| Show All 38 Lines | if (n->num_inputs < 2) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| bNodeSocket *sock = static_cast<bNodeSocket *>(node->inputs.last); | bNodeSocket *sock = static_cast<bNodeSocket *>(node->inputs.last); | ||||
| nodeRemoveSocket(ntree, node, sock); | nodeRemoveSocket(ntree, node, sock); | ||||
| n->num_inputs--; | n->num_inputs--; | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| void register_node_type_cmp_cryptomatte_legacy(void) | void register_node_type_cmp_cryptomatte_legacy() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte", NODE_CLASS_MATTE, 0); | cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte", NODE_CLASS_MATTE, 0); | ||||
| node_type_socket_templates(&ntype, nullptr, cmp_node_cryptomatte_out); | node_type_socket_templates(&ntype, nullptr, cmp_node_cryptomatte_out); | ||||
| node_type_init(&ntype, node_init_cryptomatte_legacy); | node_type_init(&ntype, node_init_cryptomatte_legacy); | ||||
| node_type_storage(&ntype, "NodeCryptomatte", node_free_cryptomatte, node_copy_cryptomatte); | node_type_storage(&ntype, "NodeCryptomatte", node_free_cryptomatte, node_copy_cryptomatte); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| } | } | ||||