RNA: Wrapped texture nodes, made a start on compo nodes.
authorRobin Allen <roblovski@gmail.com>
Sun, 31 May 2009 16:45:30 +0000 (16:45 +0000)
committerRobin Allen <roblovski@gmail.com>
Sun, 31 May 2009 16:45:30 +0000 (16:45 +0000)
Difficult to test, because outliner no longer shows nodetree? (Just a bullet icon)

source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h

index 76baed46666f721173a66247adf9f29167110cd1..9594a1a4a05be6bc540e1f0920e23e73825419ac 100644 (file)
 #include "rna_internal.h"
 
 #include "DNA_node_types.h"
+#include "DNA_scene_types.h"
 #include "BKE_node.h"
 
 #ifdef RNA_RUNTIME
 
 StructRNA *rna_Node_refine(struct PointerRNA *ptr)
 {
-       bNode *node= (bNode*)ptr->data;
+       bNode *node = (bNode*)ptr->data;
 
        switch(node->type) {
                
@@ -118,7 +119,7 @@ static StructRNA* def_node(BlenderRNA *brna, int node_id)
        StructRNA *srna;
        NodeInfo *node = nodes + node_id;
        
-       srna= RNA_def_struct(brna, node->struct_name, node->base_name);
+       srna = RNA_def_struct(brna, node->struct_name, node->base_name);
        RNA_def_struct_ui_text(srna, node->ui_name, node->ui_desc);
        RNA_def_struct_sdna(srna, "bNode");
        
@@ -191,9 +192,9 @@ static void def_math(BlenderRNA *brna, int id)
                {0, NULL, NULL, NULL}
        };
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, items);
        RNA_def_property_ui_text(prop, "Operation", "");
@@ -215,9 +216,9 @@ static void def_vector_math(BlenderRNA *brna, int id)
                {0, NULL, NULL, NULL}
        };
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, items);
        RNA_def_property_ui_text(prop, "Operation", "");
@@ -228,9 +229,9 @@ static void def_rgb_curve(BlenderRNA *brna, int id)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "CurveMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
@@ -241,23 +242,44 @@ static void def_vector_curve(BlenderRNA *brna, int id)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "CurveMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
 }
 
+static void def_time(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "storage");
+       RNA_def_property_struct_type(prop, "CurveMapping");
+       RNA_def_property_ui_text(prop, "Curve", "");
+       
+       prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "custom1");
+       RNA_def_property_ui_text(prop, "Start Frame", "");
+       
+       prop = RNA_def_property(srna, "end", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "custom2");
+       RNA_def_property_ui_text(prop, "End Frame", "");
+}
+
 static void def_val_to_rgb(BlenderRNA *brna, int id)
 {
        StructRNA *srna;
 //     PropertyRNA *prop;
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
        /* TODO: uncomment when ColorBand is wrapped */
-       /*prop= RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE);
+       /*prop = RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "ColorBand");
        RNA_def_property_ui_text(prop, "Color Band", "");*/
@@ -288,18 +310,36 @@ static void def_mix_rgb(BlenderRNA *brna, int id)
                {0, NULL, NULL, NULL}
        };
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, blend_type_items);
        RNA_def_property_ui_text(prop, "Blend Type", "");
        
-       prop= RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE);
+       prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
        RNA_def_property_ui_text(prop, "Diffuse", "Include alpha of second input in this operation");
 }
 
+static void def_texture(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "id");
+       RNA_def_property_struct_type(prop, "Texture");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Texture", "");
+       
+       prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "custom1");
+       RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use");
+}
+
 
 /* -- Shader Node Storage Types --------------------------------------------- */
 
@@ -308,14 +348,14 @@ static void rna_def_storage_node_geometry(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= RNA_def_struct(brna, "NodeGeometry", NULL);
+       srna = RNA_def_struct(brna, "NodeGeometry", NULL);
        RNA_def_struct_ui_text(srna, "Node Geometry", "");
        
-       prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+       prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "uvname");
        RNA_def_property_ui_text(prop, "UV Layer", "");
        
-       prop= RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
+       prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "colname");
        RNA_def_property_ui_text(prop, "Vertex Color Layer", "");
 }
@@ -323,46 +363,28 @@ static void rna_def_storage_node_geometry(BlenderRNA *brna)
 
 /* -- Shader Nodes ---------------------------------------------------------- */
 
-static void def_sh_texture(BlenderRNA *brna, int id)
-{
-       StructRNA *srna;
-       PropertyRNA *prop;
-       
-       srna= def_node(brna, id);
-       
-       prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "id");
-       RNA_def_property_struct_type(prop, "Texture");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Texture", "");
-       
-       prop= RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "custom1");
-       RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use");
-}
-
 static void def_sh_material(BlenderRNA *brna, int id)
 {
        StructRNA *srna;
        PropertyRNA *prop;
 
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
 
-       prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "id");
        RNA_def_property_struct_type(prop, "Material");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Material", "");
 
-       prop= RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE);
+       prop = RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF);
        RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse");
 
-       prop= RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE);
+       prop = RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_SPEC);
        RNA_def_property_ui_text(prop, "Specular", "Material Node outputs Specular");
        
-       prop= RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE);
+       prop = RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_NEG);
        RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal");
 }
@@ -372,9 +394,9 @@ static void def_sh_mapping(BlenderRNA *brna, int id)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "TexMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
@@ -385,18 +407,235 @@ static void def_sh_geometry(BlenderRNA *brna, int id)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= def_node(brna, id);
+       srna = def_node(brna, id);
        
-       prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "NodeGeometry");
        RNA_def_property_ui_text(prop, "Settings", "");
 }
 
+
+/* -- Compositor Node Storage Types ----------------------------------------- */
+
+static void rna_def_storage_node_blur_data(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       static EnumPropertyItem filter_type_items[] ={
+               {R_FILTER_BOX,        "FLAT",       "Flat",          ""},
+               {R_FILTER_TENT,       "TENT",       "Tent",          ""},
+               {R_FILTER_QUAD,       "QUAD",       "Quadratic",     ""},
+               {R_FILTER_CUBIC,      "CUBIC",      "Cubic",         ""},
+               {R_FILTER_GAUSS,      "GAUSS",      "Gaussian",      ""},
+               {R_FILTER_FAST_GAUSS, "FAST_GAUSS", "Fast Gaussian", ""},
+               {R_FILTER_CATROM,     "CATROM",     "Catrom",        ""},
+               {R_FILTER_MITCH,      "MITCH",      "Mitch",         ""},
+               {0, NULL, NULL, NULL}
+       };
+       
+       srna = RNA_def_struct(brna, "NodeBlurData", NULL);
+       RNA_def_struct_ui_text(srna, "Node Blur Data", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "sizex", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "sizex");
+       RNA_def_property_ui_text(prop, "Size X", "");
+       
+       prop = RNA_def_property(srna, "sizey", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "sizey");
+       RNA_def_property_ui_text(prop, "Size Y", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "samples");
+       RNA_def_property_ui_text(prop, "Samples", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "maxspeed");
+       RNA_def_property_ui_text(prop, "Max Speed", "");
+       
+       prop = RNA_def_property(srna, "min_speed", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "minspeed");
+       RNA_def_property_ui_text(prop, "Min Speed", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
+       RNA_def_property_ui_text(prop, "Relative", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "fac");
+       RNA_def_property_ui_text(prop, "Factor", "");
+       
+       /* These aren't percentages */
+       prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "percentx");
+       RNA_def_property_ui_text(prop, "Relative Size X", "");
+       
+       prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "percenty");
+       RNA_def_property_ui_text(prop, "Relative Size Y", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "filtertype");
+       RNA_def_property_enum_items(prop, filter_type_items);
+       RNA_def_property_ui_text(prop, "Filter Type", "");
+       
+       /**/
+       
+       prop = RNA_def_property(srna, "bokeh", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
+       RNA_def_property_ui_text(prop, "Bokeh", "");
+       
+       prop = RNA_def_property(srna, "gamma", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
+       RNA_def_property_ui_text(prop, "Gamma", "");
+       
+       /*
+               Also:
+                       curved
+                       image_in_width
+                       image_in_height
+                       
+               Don't know if these need wrapping
+       */
+       
+}
+
+
 /* -- Compositor Nodes ------------------------------------------------------ */
 
+static void def_cmp_alpha_over(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = def_node(brna, id);
+
+       prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+       RNA_def_property_ui_text(prop, "convert_premul", "TODO: don't know what this is");
+       
+       /* TODO: uses NodeTwoFloats storage */
+}
+
+static void def_cmp_blur(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "storage");
+       RNA_def_property_struct_type(prop, "NodeBlurData");
+       RNA_def_property_ui_text(prop, "Settings", "");
+}
+
+static void def_cmp_filter(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem type_items[] ={
+               {0, "SOFTEN",  "Soften",  ""},
+               {1, "SHARPEN", "Sharpen", ""},
+               {2, "LAPLACE", "Laplace", ""},
+               {3, "SOBEL",   "Sobel",   ""},
+               {4, "PREWITT", "Prewitt", ""},
+               {5, "KIRSCH",  "Kirsch",  ""},
+               {6, "SHADOW",  "Shadow",  ""},
+               {0, NULL, NULL, NULL}
+       };
+       
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "custom1");
+       RNA_def_property_enum_items(prop, type_items);
+       RNA_def_property_ui_text(prop, "Type", "");
+}
+
+
+/* -- Texture Node Storage Types --------------------------------------------- */
+
+static void rna_def_storage_tex_node_output(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna = RNA_def_struct(brna, "TexNodeOutput", NULL);
+       RNA_def_struct_ui_text(srna, "Texture Node Output", "");
+       
+       prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "name");
+       RNA_def_property_ui_text(prop, "Name", "");
+}
+
+
 /* -- Texture Nodes --------------------------------------------------------- */
 
+static void def_tex_output(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "storage");
+       RNA_def_property_struct_type(prop, "TexNodeOutput");
+       RNA_def_property_ui_text(prop, "Settings", "");
+}
+
+static void def_tex_image(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "storage");
+       RNA_def_property_struct_type(prop, "ImageUser");
+       RNA_def_property_ui_text(prop, "Settings", "");
+}
+
+static void def_tex_bricks(BlenderRNA *brna, int id)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = def_node(brna, id);
+       
+       prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "custom3");
+       RNA_def_property_ui_text(prop, "Offset Amount", "");
+       
+       prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "custom1");
+       RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
+       
+       prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "custom4");
+       RNA_def_property_ui_text(prop, "Squash Amount", "");
+       
+       prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "custom2");
+       RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
+}
+
 /* -------------------------------------------------------------------------- */
 
 static void rna_def_shader_node(BlenderRNA *brna)
@@ -407,11 +646,11 @@ static void rna_def_shader_node(BlenderRNA *brna)
        
        node_type_items = alloc_node_type_items(Category_ShaderNode);
 
-       srna= RNA_def_struct(brna, "ShaderNode", "Node");
+       srna = RNA_def_struct(brna, "ShaderNode", "Node");
        RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node.");
        RNA_def_struct_sdna(srna, "bNode");
 
-       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_enum_items(prop, node_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
@@ -428,14 +667,17 @@ static void rna_def_compositor_node(BlenderRNA *brna)
        
        node_type_items = alloc_node_type_items(Category_CompositorNode);
        
-       srna= RNA_def_struct(brna, "CompositorNode", "Node");
+       srna = RNA_def_struct(brna, "CompositorNode", "Node");
        RNA_def_struct_ui_text(srna, "Compositor Node", "");
        RNA_def_struct_sdna(srna, "bNode");
 
-       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_enum_items(prop, node_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
+       
+       /* Compositor storage types */
+       rna_def_storage_node_blur_data(brna);
 }
 
 static void rna_def_texture_node(BlenderRNA *brna)
@@ -446,14 +688,17 @@ static void rna_def_texture_node(BlenderRNA *brna)
        
        node_type_items = alloc_node_type_items(Category_TextureNode);
        
-       srna= RNA_def_struct(brna, "TextureNode", "Node");
+       srna = RNA_def_struct(brna, "TextureNode", "Node");
        RNA_def_struct_ui_text(srna, "Texture Node", "");
        RNA_def_struct_sdna(srna, "bNode");
 
-       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_enum_items(prop, node_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
+       
+       /* Texture storage types */
+       rna_def_storage_tex_node_output(brna);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -463,18 +708,18 @@ static void rna_def_node(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= RNA_def_struct(brna, "Node", NULL);
+       srna = RNA_def_struct(brna, "Node", NULL);
        RNA_def_struct_ui_text(srna, "Node", "Node in a node tree.");
        RNA_def_struct_sdna(srna, "bNode");
        RNA_def_struct_refine_func(srna, "rna_Node_refine");
        
-       prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
+       prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
        RNA_def_property_float_sdna(prop, NULL, "locx");
        RNA_def_property_array(prop, 2);
        RNA_def_property_range(prop, -10000.0f, 10000.0f);
        RNA_def_property_ui_text(prop, "Location", "");
        
-       prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+       prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_ui_text(prop, "Name", "Node name.");
        RNA_def_struct_name_property(srna, prop);
 }
@@ -484,11 +729,11 @@ static void rna_def_nodetree(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       srna= RNA_def_struct(brna, "NodeTree", "ID");
+       srna = RNA_def_struct(brna, "NodeTree", "ID");
        RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for materials, textures and compositing.");
        RNA_def_struct_sdna(srna, "bNodeTree");
 
-       prop= RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
+       prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
        RNA_def_property_struct_type(prop, "Node");
        RNA_def_property_ui_text(prop, "Nodes", "");
index 00b7f7e62cba02da86f69222d53ac38b0240007d..0c333dfef567566c770fe9ffb50516d9cf47a3e7 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * Contributor(s): Blender Foundation (2008), Robin Allen
+ * Contributor(s): Robin Allen
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+#define TODO 0
 
 /*       Tree type       Node ID                  RNA def function     Enum name         Struct name       UI Name              UI Description */
 DefNode( ShaderNode,     SH_NODE_OUTPUT,          0,                   "OUTPUT",         Output,           "Output",            ""              )
@@ -30,7 +32,7 @@ DefNode( ShaderNode,     SH_NODE_VALUE,           0,                   "VALUE",
 DefNode( ShaderNode,     SH_NODE_MIX_RGB,         def_mix_rgb,         "MIX_RGB",        MixRGB,           "MixRGB",            ""              )
 DefNode( ShaderNode,     SH_NODE_VALTORGB,        def_val_to_rgb,      "VALTORGB",       ValToRGB,         "Value to RGB",      ""              )
 DefNode( ShaderNode,     SH_NODE_RGBTOBW,         0,                   "RGBTOBW",        RGBToBW,          "RGB to BW",         ""              )
-DefNode( ShaderNode,     SH_NODE_TEXTURE,         def_sh_texture,      "TEXTURE",        Texture,          "Texture",           ""              )
+DefNode( ShaderNode,     SH_NODE_TEXTURE,         def_texture,         "TEXTURE",        Texture,          "Texture",           ""              )
 DefNode( ShaderNode,     SH_NODE_NORMAL,          0,                   "NORMAL",         Normal,           "Normal",            ""              )
 DefNode( ShaderNode,     SH_NODE_GEOMETRY,        def_sh_geometry,     "GEOMETRY",       Geometry,         "Geometry",          ""              )
 DefNode( ShaderNode,     SH_NODE_MAPPING,         def_sh_mapping,      "MAPPING",        Mapping,          "Mapping",           ""              )
@@ -49,76 +51,76 @@ DefNode( ShaderNode,     SH_NODE_HUE_SAT,         0,                   "HUE_SAT"
 DefNode( CompositorNode, CMP_NODE_VIEWER,         0,                   "VIEWER",         Viewer,           "Viewer",            ""              )
 DefNode( CompositorNode, CMP_NODE_RGB,            0,                   "RGB",            RGB,              "RGB",               ""              )
 DefNode( CompositorNode, CMP_NODE_VALUE,          0,                   "VALUE",          Value,            "Value",             ""              )
-DefNode( CompositorNode, CMP_NODE_MIX_RGB,        0,                   "MIX_RGB",        MixRGB,           "Mix RGB",           ""              )
-DefNode( CompositorNode, CMP_NODE_VALTORGB,       0,                   "VALTORGB",       ValToRGB,         "Val to RGB",        ""              )
+DefNode( CompositorNode, CMP_NODE_MIX_RGB,        def_mix_rgb,         "MIX_RGB",        MixRGB,           "Mix RGB",           ""              )
+DefNode( CompositorNode, CMP_NODE_VALTORGB,       def_val_to_rgb,      "VALTORGB",       ValToRGB,         "Val to RGB",        ""              )
 DefNode( CompositorNode, CMP_NODE_RGBTOBW,        0,                   "RGBTOBW",        RGBToBW,          "RGB to BW",         ""              )
 DefNode( CompositorNode, CMP_NODE_NORMAL,         0,                   "NORMAL",         Normal,           "Normal",            ""              )
-DefNode( CompositorNode, CMP_NODE_CURVE_VEC,      0,                   "CURVE_VEC",      CurveVec,         "Vector Curve",      ""              )
-DefNode( CompositorNode, CMP_NODE_CURVE_RGB,      0,                   "CURVE_RGB",      CurveRGB,         "RGB Curve",         ""              )
-DefNode( CompositorNode, CMP_NODE_ALPHAOVER,      0,                   "ALPHAOVER",      AlphaOver,        "Alpha Over",        ""              )
-DefNode( CompositorNode, CMP_NODE_BLUR,           0,                   "BLUR",           Blur,             "Blur",              ""              )
-DefNode( CompositorNode, CMP_NODE_FILTER,         0,                   "FILTER",         Filter,           "Filter",            ""              )
-DefNode( CompositorNode, CMP_NODE_MAP_VALUE,      0,                   "MAP_VALUE",      MapValue,         "Map Value",         ""              )
-DefNode( CompositorNode, CMP_NODE_TIME,           0,                   "TIME",           Time,             "Time",              ""              )
-DefNode( CompositorNode, CMP_NODE_VECBLUR,        0,                   "VECBLUR",        VecBlur,          "Vector Blur",       ""              )
+DefNode( CompositorNode, CMP_NODE_CURVE_VEC,      def_vector_curve,    "CURVE_VEC",      CurveVec,         "Vector Curve",      ""              )
+DefNode( CompositorNode, CMP_NODE_CURVE_RGB,      def_rgb_curve,       "CURVE_RGB",      CurveRGB,         "RGB Curve",         ""              )
+DefNode( CompositorNode, CMP_NODE_ALPHAOVER,      def_cmp_alpha_over,  "ALPHAOVER",      AlphaOver,        "Alpha Over",        ""              )
+DefNode( CompositorNode, CMP_NODE_BLUR,           def_cmp_blur,        "BLUR",           Blur,             "Blur",              ""              )
+DefNode( CompositorNode, CMP_NODE_FILTER,         def_cmp_filter,      "FILTER",         Filter,           "Filter",            ""              )
+DefNode( CompositorNode, CMP_NODE_MAP_VALUE,      TODO,                "MAP_VALUE",      MapValue,         "Map Value",         ""              )
+DefNode( CompositorNode, CMP_NODE_TIME,           def_time,            "TIME",           Time,             "Time",              ""              )
+DefNode( CompositorNode, CMP_NODE_VECBLUR,        TODO,                "VECBLUR",        VecBlur,          "Vector Blur",       ""              )
 DefNode( CompositorNode, CMP_NODE_SEPRGBA,        0,                   "SEPRGBA",        SepRGBA,          "Separate RGBA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SEPHSVA,        0,                   "SEPHSVA",        SepHSVA,          "Separate HSVA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SETALPHA,       0,                   "SETALPHA",       SetAlpha,         "Set Alpha",         ""              )
 DefNode( CompositorNode, CMP_NODE_HUE_SAT,        0,                   "HUE_SAT",        HueSat,           "Hue/Saturation",    ""              )
-DefNode( CompositorNode, CMP_NODE_IMAGE,          0,                   "IMAGE",          Image,            "Image",             ""              )
-DefNode( CompositorNode, CMP_NODE_R_LAYERS,       0,                   "R_LAYERS",       RLayers,          "Render Layers",     ""              )
+DefNode( CompositorNode, CMP_NODE_IMAGE,          TODO,                "IMAGE",          Image,            "Image",             ""              )
+DefNode( CompositorNode, CMP_NODE_R_LAYERS,       TODO,                "R_LAYERS",       RLayers,          "Render Layers",     ""              )
 DefNode( CompositorNode, CMP_NODE_COMPOSITE,      0,                   "COMPOSITE",      Composite,        "Composite",         ""              )
-DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE,    0,                   "OUTPUT_FILE",    OutputFile,       "Output File",       ""              )
-DefNode( CompositorNode, CMP_NODE_TEXTURE,        0,                   "TEXTURE",        Texture,          "Texture",           ""              )
+DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE,    TODO,                "OUTPUT_FILE",    OutputFile,       "Output File",       ""              )
+DefNode( CompositorNode, CMP_NODE_TEXTURE,        TODO,                "TEXTURE",        Texture,          "Texture",           ""              )
 DefNode( CompositorNode, CMP_NODE_TRANSLATE,      0,                   "TRANSLATE",      Translate,        "Translate",         ""              )
 DefNode( CompositorNode, CMP_NODE_ZCOMBINE,       0,                   "ZCOMBINE",       Zcombine,         "Z Combine",         ""              )
 DefNode( CompositorNode, CMP_NODE_COMBRGBA,       0,                   "COMBRGBA",       CombRGBA,         "Combine RGBA",      ""              )
-DefNode( CompositorNode, CMP_NODE_DILATEERODE,    0,                   "DILATEERODE",    DilateErode,      "Dilate/Erode",      ""              )
+DefNode( CompositorNode, CMP_NODE_DILATEERODE,    TODO,                "DILATEERODE",    DilateErode,      "Dilate/Erode",      ""              )
 DefNode( CompositorNode, CMP_NODE_ROTATE,         0,                   "ROTATE",         Rotate,           "Rotate",            ""              )
-DefNode( CompositorNode, CMP_NODE_SCALE,          0,                   "SCALE",          Scale,            "Scale",             ""              )
+DefNode( CompositorNode, CMP_NODE_SCALE,          TODO,                "SCALE",          Scale,            "Scale",             ""              )
 DefNode( CompositorNode, CMP_NODE_SEPYCCA,        0,                   "SEPYCCA",        SepYCCA,          "Separate YCCA",     ""              )
 DefNode( CompositorNode, CMP_NODE_COMBYCCA,       0,                   "COMBYCCA",       CombYCCA,         "Combine YCCA",      ""              )
 DefNode( CompositorNode, CMP_NODE_SEPYUVA,        0,                   "SEPYUVA",        SepYUVA,          "Separate YUVA",     ""              )
 DefNode( CompositorNode, CMP_NODE_COMBYUVA,       0,                   "COMBYUVA",       CombYUVA,         "Combine YUVA",      ""              )
-DefNode( CompositorNode, CMP_NODE_DIFF_MATTE,     0,                   "DIFF_MATTE",     DiffMatte,        "Diff Matte",        ""              )
-DefNode( CompositorNode, CMP_NODE_COLOR_SPILL,    0,                   "COLOR_SPILL",    ColorSpill,       "Color Spill",       ""              )
-DefNode( CompositorNode, CMP_NODE_CHROMA,         0,                   "CHROMA",         Chroma,           "Chroma",            ""              )
-DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE,  0,                   "CHANNEL_MATTE",  ChannelMatte,     "Channel Matte",     ""              )
-DefNode( CompositorNode, CMP_NODE_FLIP,           0,                   "FLIP",           Flip,             "Flip",              ""              )
-DefNode( CompositorNode, CMP_NODE_SPLITVIEWER,    0,                   "SPLITVIEWER",    SplitViewer,      "Split Viewer",      ""              )
-DefNode( CompositorNode, CMP_NODE_INDEX_MASK,     0,                   "INDEX_MASK",     IndexMask,        "Index Mask",        ""              )
-DefNode( CompositorNode, CMP_NODE_MAP_UV,         0,                   "MAP_UV",         MapUV,            "Map UV",            ""              )
-DefNode( CompositorNode, CMP_NODE_ID_MASK,        0,                   "ID_MASK",        IDMask,           "ID Mask",           ""              )
-DefNode( CompositorNode, CMP_NODE_DEFOCUS,        0,                   "DEFOCUS",        Defocus,          "Defocus",           ""              )
+DefNode( CompositorNode, CMP_NODE_DIFF_MATTE,     TODO,                "DIFF_MATTE",     DiffMatte,        "Diff Matte",        ""              )
+DefNode( CompositorNode, CMP_NODE_COLOR_SPILL,    TODO,                "COLOR_SPILL",    ColorSpill,       "Color Spill",       ""              )
+DefNode( CompositorNode, CMP_NODE_CHROMA,         TODO,                "CHROMA",         Chroma,           "Chroma",            ""              )
+DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE,  TODO,                "CHANNEL_MATTE",  ChannelMatte,     "Channel Matte",     ""              )
+DefNode( CompositorNode, CMP_NODE_FLIP,           TODO,                "FLIP",           Flip,             "Flip",              ""              )
+DefNode( CompositorNode, CMP_NODE_SPLITVIEWER,    TODO,                "SPLITVIEWER",    SplitViewer,      "Split Viewer",      ""              )
+DefNode( CompositorNode, CMP_NODE_INDEX_MASK,     TODO,                "INDEX_MASK",     IndexMask,        "Index Mask",        ""              )
+DefNode( CompositorNode, CMP_NODE_MAP_UV,         TODO,                "MAP_UV",         MapUV,            "Map UV",            ""              )
+DefNode( CompositorNode, CMP_NODE_ID_MASK,        TODO,                "ID_MASK",        IDMask,           "ID Mask",           ""              )
+DefNode( CompositorNode, CMP_NODE_DEFOCUS,        TODO,                "DEFOCUS",        Defocus,          "Defocus",           ""              )
 DefNode( CompositorNode, CMP_NODE_DISPLACE,       0,                   "DISPLACE",       Displace,         "Displace",          ""              )
 DefNode( CompositorNode, CMP_NODE_COMBHSVA,       0,                   "COMBHSVA",       CombHSVA,         "Combine HSVA",      ""              )
 DefNode( CompositorNode, CMP_NODE_MATH,           def_math,            "MATH",           Math,             "Math",              ""              )
-DefNode( CompositorNode, CMP_NODE_LUMA_MATTE,     0,                   "LUMA_MATTE",     LumaMatte,        "Luma Matte",        ""              )
+DefNode( CompositorNode, CMP_NODE_LUMA_MATTE,     TODO,                "LUMA_MATTE",     LumaMatte,        "Luma Matte",        ""              )
 DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0,                   "BRIGHTCONTRAST", BrightContrast,   "Bright Contrast",   ""              )
 DefNode( CompositorNode, CMP_NODE_GAMMA,          0,                   "GAMMA",          Gamma,            "Gamma",             ""              )
-DefNode( CompositorNode, CMP_NODE_INVERT,         0,                   "INVERT",         Invert,           "Invert",            ""              )
+DefNode( CompositorNode, CMP_NODE_INVERT,         TODO,                "INVERT",         Invert,           "Invert",            ""              )
 DefNode( CompositorNode, CMP_NODE_NORMALIZE,      0,                   "NORMALIZE",      Normalize,        "Normalize",         ""              )
-DefNode( CompositorNode, CMP_NODE_CROP,           0,                   "CROP",           Crop,             "Crop",              ""              )
-DefNode( CompositorNode, CMP_NODE_DBLUR,          0,                   "DBLUR",          DBlur,            "DBlur",             ""              )
-DefNode( CompositorNode, CMP_NODE_BILATERALBLUR,  0,                   "BILATERALBLUR",  Bilateralblur,    "Bilateral Blur",    ""              )
-DefNode( CompositorNode, CMP_NODE_PREMULKEY,      0,                   "PREMULKEY",      PremulKey,        "Premul Key",        ""              )
-DefNode( CompositorNode, CMP_NODE_GLARE,          0,                   "GLARE",          Glare,            "Glare",             ""              )
-DefNode( CompositorNode, CMP_NODE_TONEMAP,        0,                   "TONEMAP",        Tonemap,          "Tonemap",           ""              )
-DefNode( CompositorNode, CMP_NODE_LENSDIST,       0,                   "LENSDIST",       Lensdist,         "Lensdist",          ""              )
+DefNode( CompositorNode, CMP_NODE_CROP,           TODO,                "CROP",           Crop,             "Crop",              ""              )
+DefNode( CompositorNode, CMP_NODE_DBLUR,          TODO,                "DBLUR",          DBlur,            "DBlur",             ""              )
+DefNode( CompositorNode, CMP_NODE_BILATERALBLUR,  TODO,                "BILATERALBLUR",  Bilateralblur,    "Bilateral Blur",    ""              )
+DefNode( CompositorNode, CMP_NODE_PREMULKEY,      TODO,                "PREMULKEY",      PremulKey,        "Premul Key",        ""              )
+DefNode( CompositorNode, CMP_NODE_GLARE,          TODO,                "GLARE",          Glare,            "Glare",             ""              )
+DefNode( CompositorNode, CMP_NODE_TONEMAP,        TODO,                "TONEMAP",        Tonemap,          "Tonemap",           ""              )
+DefNode( CompositorNode, CMP_NODE_LENSDIST,       TODO,                "LENSDIST",       Lensdist,         "Lensdist",          ""              )
                                                                                                                                                 
-DefNode( TextureNode,    TEX_NODE_OUTPUT,         0,                   "OUTPUT",         Output,           "Output",            ""              )
+DefNode( TextureNode,    TEX_NODE_OUTPUT,         def_tex_output,      "OUTPUT",         Output,           "Output",            ""              )
 DefNode( TextureNode,    TEX_NODE_CHECKER,        0,                   "CHECKER",        Checker,          "Checker",           ""              )
-DefNode( TextureNode,    TEX_NODE_TEXTURE,        0,                   "TEXTURE",        Texture,          "Texture",           ""              )
-DefNode( TextureNode,    TEX_NODE_BRICKS,         0,                   "BRICKS",         Bricks,           "Bricks",            ""              )
+DefNode( TextureNode,    TEX_NODE_TEXTURE,        def_texture,         "TEXTURE",        Texture,          "Texture",           ""              )
+DefNode( TextureNode,    TEX_NODE_BRICKS,         def_tex_bricks,      "BRICKS",         Bricks,           "Bricks",            ""              )
 DefNode( TextureNode,    TEX_NODE_MATH,           def_math,            "MATH",           Math,             "Math",              ""              )
 DefNode( TextureNode,    TEX_NODE_MIX_RGB,        def_mix_rgb,         "MIX_RGB",        MixRGB,           "Mix RGB",           ""              )
 DefNode( TextureNode,    TEX_NODE_RGBTOBW,        0,                   "RGBTOBW",        RGBToBW,          "RGB To BW",         ""              )
 DefNode( TextureNode,    TEX_NODE_VALTORGB,       def_val_to_rgb,      "VALTORGB",       ValToRGB,         "Val To RGB",        ""              )
-DefNode( TextureNode,    TEX_NODE_IMAGE,          0,                   "IMAGE",          Image,            "Image",             ""              )
+DefNode( TextureNode,    TEX_NODE_IMAGE,          def_tex_image,       "IMAGE",          Image,            "Image",             ""              )
 DefNode( TextureNode,    TEX_NODE_CURVE_RGB,      def_rgb_curve,       "CURVE_RGB",      CurveRGB,         "RGB Curve",         ""              )
 DefNode( TextureNode,    TEX_NODE_INVERT,         0,                   "INVERT",         Invert,           "Invert",            ""              )
 DefNode( TextureNode,    TEX_NODE_HUE_SAT,        0,                   "HUE_SAT",        HueSaturation,    "Hue/Saturation",    ""              )
-DefNode( TextureNode,    TEX_NODE_CURVE_TIME,     0,                   "CURVE_TIME",     CurveTime,        "Curve Time",        ""              )
+DefNode( TextureNode,    TEX_NODE_CURVE_TIME,     def_time,            "CURVE_TIME",     CurveTime,        "Curve Time",        ""              )
 DefNode( TextureNode,    TEX_NODE_ROTATE,         0,                   "ROTATE",         Rotate,           "Rotate",            ""              )
 DefNode( TextureNode,    TEX_NODE_VIEWER,         0,                   "VIEWER",         Viewer,           "Viewer",            ""              )
 DefNode( TextureNode,    TEX_NODE_TRANSLATE,      0,                   "TRANSLATE",      Translate,        "Translate",         ""              )