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.

This commit is contained in:
Lukas Toenne 2013-04-12 07:35:49 +00:00
parent ba845f6313
commit 048df1a07c

@ -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");