Add type RNA property to special nodes (e.g. frame)
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Aug 2012 10:31:45 +0000 (10:31 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Aug 2012 10:31:45 +0000 (10:31 +0000)
source/blender/makesrna/intern/rna_nodetree.c

index 5e95fa25cba18a16594de04087d737785d760ec5..e6d89bc6e0461682f4e23feec9e3aa8b7f3b749f 100644 (file)
@@ -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);