diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-04-08 12:59:30 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-04-08 12:59:30 +0400 |
commit | 17dcd1ea2dd80666b589067a69ab246839252c74 (patch) | |
tree | 202b39825e0dc2929d59d8d27a7a50b4265bc274 /source | |
parent | 0e1891648ecb14aa9c01322531a3e2195db302a5 (diff) |
Exposed the bNodeSocket->limit value in RNA, so it can be redefined by pynodes. All sockets will have strict n-to-1 connectivity by default, which is fine for data sockets, but things like geometry nodes with a more data-flow based connectivity for certain socket types will need to change this.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 13 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_socket.c | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7ccf11af829..a9054d7b4e0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2008,6 +2008,12 @@ static void rna_NodeSocket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA ED_node_tag_update_nodetree(bmain, ntree); } +static void rna_NodeSocket_link_limit_set(PointerRNA *ptr, int value) +{ + bNodeSocket *sock = ptr->data; + sock->limit = (value == 0 ? 0xFFF : value); +} + static void rna_NodeSocket_hide_set(PointerRNA *ptr, int value) { bNodeSocket *sock = (bNodeSocket *)ptr->data; @@ -5893,6 +5899,13 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Enabled", "Enable the socket"); RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL); + prop = RNA_def_property(srna, "link_limit", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "limit"); + RNA_def_property_int_funcs(prop, NULL, "rna_NodeSocket_link_limit_set", NULL); + RNA_def_property_range(prop, 1, 0xFFF); + RNA_def_property_ui_text(prop, "Link Limit", "Max number of links allowed for this socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL); + prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index f28d6a20dab..153d4677186 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -111,8 +111,7 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in } if (sock) { sock->type = stemp->type; - if (stemp->limit == 0) sock->limit= 0xFFF; - else sock->limit = stemp->limit; + sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit); sock->flag |= stemp->flag; BLI_remlink(socklist, sock); |