Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | static void cryptomatte_add(const Scene &scene, | ||||
| NodeCryptomatte &node_cryptomatte, | NodeCryptomatte &node_cryptomatte, | ||||
| float encoded_hash) | float encoded_hash) | ||||
| { | { | ||||
| /* Check if entry already exist. */ | /* Check if entry already exist. */ | ||||
| if (cryptomatte_find(node_cryptomatte, encoded_hash)) { | if (cryptomatte_find(node_cryptomatte, encoded_hash)) { | ||||
| return; | return; | ||||
| } | } | ||||
| CryptomatteEntry *entry = MEM_cnew<CryptomatteEntry>(__func__); | CryptomatteEntry *entry = MEM_cnew<CryptomatteEntry>(MEM_AT); | ||||
| entry->encoded_hash = encoded_hash; | entry->encoded_hash = encoded_hash; | ||||
| blender::bke::cryptomatte::CryptomatteSessionPtr session = cryptomatte_init_from_node( | blender::bke::cryptomatte::CryptomatteSessionPtr session = cryptomatte_init_from_node( | ||||
| scene, node, true); | scene, node, true); | ||||
| if (session) { | if (session) { | ||||
| BKE_cryptomatte_find_name(session.get(), encoded_hash, entry->name, sizeof(entry->name)); | BKE_cryptomatte_find_name(session.get(), encoded_hash, entry->name, sizeof(entry->name)); | ||||
| } | } | ||||
| BLI_addtail(&node_cryptomatte.entries, entry); | BLI_addtail(&node_cryptomatte.entries, entry); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node) | ||||
| BLI_freelistN(&n->runtime.layers); | BLI_freelistN(&n->runtime.layers); | ||||
| blender::bke::cryptomatte::CryptomatteSessionPtr session = cryptomatte_init_from_node( | blender::bke::cryptomatte::CryptomatteSessionPtr session = cryptomatte_init_from_node( | ||||
| *scene, *node, false); | *scene, *node, false); | ||||
| if (session) { | if (session) { | ||||
| for (blender::StringRef layer_name : | for (blender::StringRef layer_name : | ||||
| blender::bke::cryptomatte::BKE_cryptomatte_layer_names_get(*session)) { | blender::bke::cryptomatte::BKE_cryptomatte_layer_names_get(*session)) { | ||||
| CryptomatteLayer *layer = MEM_cnew<CryptomatteLayer>(__func__); | CryptomatteLayer *layer = MEM_cnew<CryptomatteLayer>(MEM_AT); | ||||
| layer_name.copy(layer->name); | layer_name.copy(layer->name); | ||||
| BLI_addtail(&n->runtime.layers, layer); | BLI_addtail(&n->runtime.layers, layer); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, | void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, | ||||
| const bNode *node, | const bNode *node, | ||||
| Show All 28 Lines | |||||
| { | { | ||||
| blender::bke::cryptomatte::CryptomatteSessionPtr session_ptr = cryptomatte_init_from_node( | blender::bke::cryptomatte::CryptomatteSessionPtr session_ptr = cryptomatte_init_from_node( | ||||
| *scene, *node, true); | *scene, *node, true); | ||||
| return session_ptr.release(); | return session_ptr.release(); | ||||
| } | } | ||||
| static void node_init_cryptomatte(bNodeTree *UNUSED(ntree), bNode *node) | static void node_init_cryptomatte(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| NodeCryptomatte *user = MEM_cnew<NodeCryptomatte>(__func__); | NodeCryptomatte *user = MEM_cnew<NodeCryptomatte>(MEM_AT); | ||||
| node->storage = user; | node->storage = user; | ||||
| } | } | ||||
| static void node_init_api_cryptomatte(const bContext *C, PointerRNA *ptr) | static void node_init_api_cryptomatte(const bContext *C, PointerRNA *ptr) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| bNode *node = static_cast<bNode *>(ptr->data); | bNode *node = static_cast<bNode *>(ptr->data); | ||||
| BLI_assert(node->type == CMP_NODE_CRYPTOMATTE); | BLI_assert(node->type == CMP_NODE_CRYPTOMATTE); | ||||
| ▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines | |||||