Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-08-10 11:22:33 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-08-10 11:22:33 +0400
commit1eb611ea55cd9fdf23c8e5b712a144d291d4f0ed (patch)
treedd75819bff69848c2574b3230ba2309147edd6dd /source/blender/makesrna
parent32a8d7cbdf9a705a5b97554651ab500ed5962fb4 (diff)
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).
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index eadd4f16a8a..a0e15b48e23 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -439,6 +439,15 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
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 @@ static void def_group(StructRNA *srna)
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");