Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 1,217 Lines • ▼ Show 20 Lines | static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, | ||||
| if (verify_limits) { | if (verify_limits) { | ||||
| /* remove other socket links if limit is exceeded */ | /* remove other socket links if limit is exceeded */ | ||||
| if (nodeCountSocketLinks(ntree, fromsock) + 1 > nodeSocketLinkLimit(fromsock)) { | if (nodeCountSocketLinks(ntree, fromsock) + 1 > nodeSocketLinkLimit(fromsock)) { | ||||
| nodeRemSocketLinks(ntree, fromsock); | nodeRemSocketLinks(ntree, fromsock); | ||||
| } | } | ||||
| if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) { | if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) { | ||||
| nodeRemSocketLinks(ntree, tosock); | nodeRemSocketLinks(ntree, tosock); | ||||
| } | } | ||||
| if (tosock->flag & SOCK_MULTI_INPUT) { | |||||
| LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) { | |||||
| if (link->fromsock == fromsock && link->tosock == tosock) { | |||||
| nodeRemLink(ntree, link); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); | ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); | ||||
| if (ret) { | if (ret) { | ||||
| /* not an issue from the UI, clear hidden from API to keep valid state. */ | /* not an issue from the UI, clear hidden from API to keep valid state. */ | ||||
| fromsock->flag &= ~SOCK_HIDDEN; | fromsock->flag &= ~SOCK_HIDDEN; | ||||
| ▲ Show 20 Lines • Show All 2,653 Lines • ▼ Show 20 Lines | static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value) | ||||
| NodeCryptomatte *storage = node->storage; | NodeCryptomatte *storage = node->storage; | ||||
| CryptomatteLayer *layer = BLI_findlink(&storage->runtime.layers, new_value); | CryptomatteLayer *layer = BLI_findlink(&storage->runtime.layers, new_value); | ||||
| if (layer) { | if (layer) { | ||||
| STRNCPY(storage->layer_name, layer->name); | STRNCPY(storage->layer_name, layer->name); | ||||
| } | } | ||||
| } | } | ||||
| static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *UNUSED(C), | static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *C, | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| { | { | ||||
| bNode *node = (bNode *)ptr->data; | bNode *node = (bNode *)ptr->data; | ||||
| NodeCryptomatte *storage = node->storage; | NodeCryptomatte *storage = node->storage; | ||||
| EnumPropertyItem *item = NULL; | EnumPropertyItem *item = NULL; | ||||
| EnumPropertyItem template = {0, "", 0, "", ""}; | EnumPropertyItem template = {0, "", 0, "", ""}; | ||||
| int totitem = 0; | int totitem = 0; | ||||
| ntreeCompositCryptomatteUpdateLayerNames(node); | ntreeCompositCryptomatteUpdateLayerNames(CTX_data_scene(C), node); | ||||
| int layer_index; | int layer_index; | ||||
| LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) { | LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) { | ||||
| template.value = layer_index; | template.value = layer_index; | ||||
| template.identifier = layer->name; | template.identifier = layer->name; | ||||
| template.name = layer->name; | template.name = layer->name; | ||||
| RNA_enum_item_add(&item, &totitem, &template); | RNA_enum_item_add(&item, &totitem, &template); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| bNode *node = (bNode *)ptr->data; | bNode *node = (bNode *)ptr->data; | ||||
| NodeCryptomatte *nc = node->storage; | NodeCryptomatte *nc = node->storage; | ||||
| BKE_cryptomatte_matte_id_to_entries(nc, value); | BKE_cryptomatte_matte_id_to_entries(nc, value); | ||||
| } | } | ||||
| static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| ntreeCompositCryptomatteSyncFromAdd(ptr->data); | ntreeCompositCryptomatteSyncFromAdd(scene, ptr->data); | ||||
| rna_Node_update(bmain, scene, ptr); | rna_Node_update(bmain, scene, ptr); | ||||
| } | } | ||||
| static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| ntreeCompositCryptomatteSyncFromRemove(ptr->data); | ntreeCompositCryptomatteSyncFromRemove(ptr->data); | ||||
| rna_Node_update(bmain, scene, ptr); | rna_Node_update(bmain, scene, ptr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 7,582 Lines • Show Last 20 Lines | |||||