[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49754] trunk/blender/source/blender/ makesrna/intern/rna_nodetree.c: Added a poll function for the node_tree pointer node groups.

Lukas Toenne lukas.toenne at googlemail.com
Fri Aug 10 09:22:34 CEST 2012


Revision: 49754
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49754
Author:   lukastoenne
Date:     2012-08-10 07:22:33 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
Added a poll function for the node_tree pointer node groups. This ensure that only node trees of the same type as the group node's tree can be selected for the pointer, other trees would be invalid for the node group (e.g. a Shader node group using a Compositor node tree).

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

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-08-10 01:12:54 UTC (rev 49753)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-08-10 07:22:33 UTC (rev 49754)
@@ -439,6 +439,15 @@
 	node_update(bmain, scene, ntree, node);
 }
 
+static int rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
+{
+	bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+	bNodeTree *ngroup = (bNodeTree *)value.data;
+	
+	/* only allow node trees of the same type as the group node's tree */
+	return (ngroup->type == ntree->type);
+}
+
 static void rna_Node_name_set(PointerRNA *ptr, const char *value)
 {
 	bNodeTree *ntree = (bNodeTree *)ptr->id.data;
@@ -1129,6 +1138,7 @@
 	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "id");
 	RNA_def_property_struct_type(prop, "NodeTree");
+	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_NodeGroup_node_tree_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Node Tree", "");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");




More information about the Bf-blender-cvs mailing list