diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-01 14:31:45 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-01 14:31:45 +0400 |
commit | f8ff6edfc483d6f826e9b85f25fcb45e8770c651 (patch) | |
tree | db57552f0aa1963664040e6f4e7bef92ec69edfe /source | |
parent | 6704f56c15fc9dde61a97d9340a647bb7d650c50 (diff) |
Add type RNA property to special nodes (e.g. frame)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 5e95fa25cba..e6d89bc6e04 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -217,13 +217,11 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr) #include "rna_nodetree_types.h" case NODE_GROUP: - return &RNA_NodeGroup; case NODE_FORLOOP: - return &RNA_NodeForLoop; case NODE_WHILELOOP: - return &RNA_NodeWhileLoop; case NODE_FRAME: - return &RNA_NodeFrame; + case NODE_REROUTE: + return &RNA_SpecialNode; default: return &RNA_Node; @@ -3863,6 +3861,30 @@ static void rna_def_texture_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Type", ""); } +static void rna_def_special_node(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem specific_node_type_items[] = { + {NODE_GROUP, "GROUP", ICON_NODE, "Group", ""}, + {NODE_FORLOOP, "FORLOOP", ICON_NODE, "For Loop", ""}, + {NODE_WHILELOOP, "WHILELOOP", ICON_NODE, "While Loop", ""}, + {NODE_FRAME, "FRAME", ICON_NODE, "Frame", ""}, + {NODE_REROUTE, "REROUTE", ICON_NODE, "Reroute", ""}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "SpecialNode", "Node"); + RNA_def_struct_ui_text(srna, "Special Node", ""); + RNA_def_struct_sdna(srna, "bNode"); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_items(prop, specific_node_type_items); + RNA_def_property_ui_text(prop, "Type", ""); +} + /* -------------------------------------------------------------------------- */ static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop) @@ -4421,7 +4443,7 @@ static void rna_def_texture_nodetree(BlenderRNA *brna) static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA *)) { StructRNA *srna = def_node(brna, id); - + if (func) func(srna); } @@ -4448,6 +4470,7 @@ void RNA_def_nodetree(BlenderRNA *brna) rna_def_shader_node(brna); rna_def_compositor_node(brna); rna_def_texture_node(brna); + rna_def_special_node(brna); rna_def_composite_nodetree(brna); rna_def_shader_nodetree(brna); |