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:
authorCampbell Barton <ideasman42@gmail.com>2010-12-03 06:44:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-03 06:44:39 +0300
commitcfc1b133f664b024acc460e0204bb0bea66a83d3 (patch)
tree0391686d2afb6fd9bb02bdfc479ceb0bd5428e4d /source/blender/makesrna/intern/rna_nodetree.c
parent892b3fbe17c366d37565c7ea85a7704f8daa9560 (diff)
updates to patch from Dan Eicher, allow adding a NodeGroup through bpy.data.node_groups.new(name, type)
made some minor changes.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 6297a7897d9..183b64fb808 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -429,7 +429,13 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, in
static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
{
- bNode *node= nodeAddNodeType(ntree, type, group, NULL);
+ bNode *node;
+
+ if (type == NODE_GROUP && group == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "node type \'GROUP\' missing group argument");
+ return NULL;
+ }
+ node = nodeAddNodeType(ntree, type, group, NULL);
if (node == NULL) {
BKE_reportf(reports, RPT_ERROR, "Unable to create node");
@@ -438,6 +444,9 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
nodeVerifyGroup(ntree); /* update group node socket links*/
NodeTagChanged(ntree, node);
WM_event_add_notifier(C, NC_NODE|NA_EDITED, ntree);
+
+ if (group)
+ id_us_plus(&group->id);
}
return node;