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:
authorMatt Ebb <matt@mke3.net>2010-01-13 09:35:12 +0300
committerMatt Ebb <matt@mke3.net>2010-01-13 09:35:12 +0300
commit7df44b9cede3aa903c4463f9e5f885a705b4173a (patch)
tree1d9c9e221f1469989d7c3d901b5ffb424eba815d /source/blender/makesrna
parent728359a6a5fd5736e1f1fdfa359f22474e76fd1d (diff)
Fix: wasn't able to rename node group nodetree name, or access the nodetree at all. Now you
can switch between them too. Wrapped group nodes in RNA as part of this.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c41
2 files changed, 40 insertions, 2 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index efd42878087..ba2d272309f 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -317,6 +317,7 @@ extern StructRNA RNA_NearSensor;
extern StructRNA RNA_NlaStrip;
extern StructRNA RNA_NlaTrack;
extern StructRNA RNA_Node;
+extern StructRNA RNA_NodeGroup;
extern StructRNA RNA_NodeSocket;
extern StructRNA RNA_NodeTree;
extern StructRNA RNA_NoiseTexture;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 9922f099cd5..646a7419d68 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -63,6 +63,9 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
#undef DefNode
+ case NODE_GROUP:
+ return &RNA_NodeGroup;
+
default:
return &RNA_Node;
}
@@ -177,6 +180,16 @@ static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
node_update(bmain, scene, ntree, node);
}
+static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+ bNode *node= (bNode*)ptr->data;
+
+ nodeVerifyGroup((bNodeTree *)node->id);
+
+ node_update(bmain, scene, ntree, node);
+}
+
static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
@@ -474,7 +487,7 @@ static EnumPropertyItem node_filter_items[] = {
enum
{
- Category_NoCategory,
+ Category_GroupNode,
Category_ShaderNode,
Category_CompositorNode,
Category_TextureNode
@@ -521,6 +534,8 @@ static void init(void)
#undef DefNode
#undef Str
+
+ reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "Node", "Group", "");
}
static StructRNA* def_node(BlenderRNA *brna, int node_id)
@@ -567,6 +582,13 @@ static EnumPropertyItem* alloc_node_type_items(int category)
item++;
+ item->value = NODE_GROUP;
+ item->identifier = "GROUP";
+ item->name = "Group";
+ item->description = "";
+
+ item++;
+
memset(item, 0, sizeof(EnumPropertyItem));
return items;
@@ -575,6 +597,19 @@ static EnumPropertyItem* alloc_node_type_items(int category)
/* -- Common nodes ---------------------------------------------------------- */
+static void def_group(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "NodeTree");
+ 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");
+}
+
+
static void def_math(StructRNA *srna)
{
PropertyRNA *prop;
@@ -2106,13 +2141,15 @@ void RNA_def_nodetree(BlenderRNA *brna)
rna_def_shader_node(brna);
rna_def_compositor_node(brna);
rna_def_texture_node(brna);
-
+
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
define_specific_node(brna, ID, DefFunc);
#include "rna_nodetree_types.h"
#undef DefNode
+
+ define_specific_node(brna, NODE_GROUP, def_group);
}
#endif