[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55980] trunk/blender/source/blender/ makesrna/intern/rna_space.c: 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.

Lukas Toenne lukas.toenne at googlemail.com
Fri Apr 12 09:35:50 CEST 2013


Revision: 55980
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55980
Author:   lukastoenne
Date:     2013-04-12 07:35:49 +0000 (Fri, 12 Apr 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-04-12 02:16:44 UTC (rev 55979)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-04-12 07:35:49 UTC (rev 55980)
@@ -1098,17 +1098,9 @@
 	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 @@
 
 	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");




More information about the Bf-blender-cvs mailing list