diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 11:09:36 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 11:09:36 +0400 |
commit | 870ff57557e23a83d0c5e9102c6870eaf15b47b6 (patch) | |
tree | e7d3c61bf0c2c8b96e41bab0ebe73ee82dc44752 /source | |
parent | 771906bc09317e3dc77be2319b44bc59081eff93 (diff) |
Fix #36584, in python inputs/outputs of created node group not accessable by their names.
The lookupstring function for node sockets and node tree interface items was using the identifier strings of bNodeSocket. This would ensure uniqueness, but doesn't work nicely because the identifier is
not the RNA name property and differs for node groups (with regular nodes it only differs if socket names are duplicate).
Now removed the specialized callbacks, so that inputs/outputs collections simply use the name property. In cases where socket names are duplicate (e.g. math node "Value" + "Value") only the first socket
is returned, but in such cases access by index is the preferred method anyway.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7be333247a6..6645e4f6de0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -921,22 +921,6 @@ static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value) } } -static int rna_NodeTree_inputs_lookupstring(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) -{ - bNodeTree *ntree = (bNodeTree *)ptr->data; - bNodeSocket *sock = ntreeFindSocketInterface(ntree, SOCK_IN, key); - RNA_pointer_create(ptr->id.data, &RNA_NodeSocketInterface, sock, r_ptr); - return (sock != NULL); -} - -static int rna_NodeTree_outputs_lookupstring(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) -{ - bNodeTree *ntree = (bNodeTree *)ptr->data; - bNodeSocket *sock = ntreeFindSocketInterface(ntree, SOCK_OUT, key); - RNA_pointer_create(ptr->id.data, &RNA_NodeSocketInterface, sock, r_ptr); - return (sock != NULL); -} - static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, ReportList *reports, const char *type, const char *name) { bNodeSocket *sock; @@ -1563,22 +1547,6 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) BKE_all_animdata_fix_paths_rename(NULL, "nodes", oldname, node->name); } -static int rna_Node_inputs_lookupstring(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) -{ - bNode *node = (bNode *)ptr->data; - bNodeSocket *sock = nodeFindSocket(node, SOCK_IN, key); - RNA_pointer_create(ptr->id.data, &RNA_NodeSocket, sock, r_ptr); - return (sock != NULL); -} - -static int rna_Node_outputs_lookupstring(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) -{ - bNode *node = (bNode *)ptr->data; - bNodeSocket *sock = nodeFindSocket(node, SOCK_OUT, key); - RNA_pointer_create(ptr->id.data, &RNA_NodeSocket, sock, r_ptr); - return (sock != NULL); -} - static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, ReportList *reports, const char *type, const char *name, const char *identifier) { bNodeTree *ntree = (bNodeTree *)id; @@ -6841,16 +6809,12 @@ static void rna_def_node(BlenderRNA *brna) prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, - "rna_Node_inputs_lookupstring", NULL); RNA_def_property_struct_type(prop, "NodeSocket"); RNA_def_property_ui_text(prop, "Inputs", ""); rna_def_node_sockets_api(brna, prop, SOCK_IN); prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, - "rna_Node_outputs_lookupstring", NULL); RNA_def_property_struct_type(prop, "NodeSocket"); RNA_def_property_ui_text(prop, "Outputs", ""); rna_def_node_sockets_api(brna, prop, SOCK_OUT); @@ -7266,8 +7230,6 @@ static void rna_def_nodetree(BlenderRNA *brna) prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, - "rna_NodeTree_inputs_lookupstring", NULL); RNA_def_property_struct_type(prop, "NodeSocketInterface"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Inputs", "Node tree inputs"); @@ -7280,8 +7242,6 @@ static void rna_def_nodetree(BlenderRNA *brna) prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, - "rna_NodeTree_outputs_lookupstring", NULL); RNA_def_property_struct_type(prop, "NodeSocketInterface"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Outputs", "Node tree outputs"); |