diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-02-22 23:49:34 +0300 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-02-22 23:49:34 +0300 |
commit | e7750aa6ed4c448d4a39cf399b02f6b86c676816 (patch) | |
tree | 002815cce369a6f4ca0d79398f2d465609095471 /source/blender/makesrna | |
parent | 692b711bf40f500c38fdc310ada7db0eacf21b8a (diff) |
Convenience fix: Exposing internal sockets now copies the default input value to the group sockets. The "expose" function on group inputs/outputs has an optional parameter "add_link", which can be used to prevent the automatic linking.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a20ced776e5..b8ff41a7948 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -659,7 +659,7 @@ static bNodeSocket *rna_NodeTree_output_new(bNodeTree *ntree, ReportList *UNUSED return gsock; } -static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock) +static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link) { bNode *node; bNodeSocket *gsock; @@ -672,7 +672,8 @@ static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *repo else { /* XXX should check if tree is a group here! no good way to do this currently. */ gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_IN); - nodeAddLink(ntree, NULL, gsock, node, sock); + if (add_link) + nodeAddLink(ntree, NULL, gsock, node, sock); nodeGroupVerify(ntree); /* update group node socket links*/ WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); @@ -681,7 +682,7 @@ static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *repo return NULL; } -static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock) +static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link) { bNode *node; bNodeSocket *gsock; @@ -694,7 +695,8 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep else { /* XXX should check if tree is a group here! no good way to do this currently. */ gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_OUT); - nodeAddLink(ntree, node, sock, NULL, gsock); + if (add_link) + nodeAddLink(ntree, node, sock, NULL, gsock); nodeGroupVerify(ntree); /* update group node socket links*/ WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); @@ -2749,6 +2751,8 @@ static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int RNA_def_function_ui_description(func, "Expose an internal socket in the group tree."); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "add_link", TRUE, "Add Link", "If TRUE, adds a link to the internal socket"); /* return value */ parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket."); RNA_def_function_return(func, parm); |