diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-04-12 11:35:49 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-04-12 11:35:49 +0400 |
commit | 048df1a07c2b030a8c62f4c37f4b5bbda439690e (patch) | |
tree | 6784c146d1ead934feab03dc4433b60b58e8a90f /source/blender/makesrna | |
parent | ba845f63138a8bd6cc2643b8f80120078da30f70 (diff) |
Small change to the node space RNA function for opening a node group: pass the node tree as explicit argument plus an optional group node, instead of trying to get the node tree from a node property. This is more flexible for future nodes that want to change the node editor. Node group operators can rely on group node types, but the generic RNA functions should not.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7a69f3c6b7c..da9e13c03db 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1098,17 +1098,9 @@ void rna_SpaceNodeEditor_path_start(SpaceNode *snode, bContext *C, PointerRNA *n ED_node_tree_update(C); } -void rna_SpaceNodeEditor_path_push(SpaceNode *snode, bContext *C, ReportList *reports, PointerRNA *node) +void rna_SpaceNodeEditor_path_push(SpaceNode *snode, bContext *C, PointerRNA *node_tree, PointerRNA *node) { - PointerRNA tree_ptr; - - tree_ptr = RNA_pointer_get(node, "node_tree"); - if (!tree_ptr.data) { - BKE_reportf(reports, RPT_WARNING, "Missing node group tree in node %s", ((bNode *)node->data)->name); - return; - } - - ED_node_tree_push(snode, (bNodeTree *)tree_ptr.data, (bNode *)node->data); + ED_node_tree_push(snode, node_tree->data, node->data); ED_node_tree_update(C); } @@ -3209,9 +3201,11 @@ static void rna_def_space_node_path_api(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "push", "rna_SpaceNodeEditor_path_push"); RNA_def_function_ui_description(func, "Append a node group tree to the path"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "node", "NodeGroup", "Node", "Group node"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "Node tree to append to the node editor path"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); + parm = RNA_def_pointer(func, "node", "Node", "Node", "Group node linking to this node tree"); + RNA_def_property_flag(parm, PROP_RNAPTR); func = RNA_def_function(srna, "pop", "rna_SpaceNodeEditor_path_pop"); RNA_def_function_ui_description(func, "Remove the last node tree from the path"); |