diff options
author | Robin Allen <roblovski@gmail.com> | 2009-03-24 20:40:58 +0300 |
---|---|---|
committer | Robin Allen <roblovski@gmail.com> | 2009-03-24 20:40:58 +0300 |
commit | 51ce279300511412bc417b540140ccebdbc130b3 (patch) | |
tree | 57d02707d9bf1effd7db3da1799a4010f4864bdd /source | |
parent | 6da5e62ee8633da9814c617874552f759ab4e740 (diff) |
Started wrapping nodes in RNA. Only shader nodes have all their options wrapped;
TEX and CMP to follow.
Also, renumbered the texture nodes because when I first wrote them I thought
they could share ID numbers with the SH and CMP nodes. D'oh!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 48 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 437 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree_types.h | 131 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 38 |
4 files changed, 587 insertions, 67 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 7b7de08bd56..09237e74d1d 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -388,32 +388,32 @@ void free_compbuf(struct CompBuf *cbuf); /* internal...*/ struct TexResult; -#define TEX_NODE_OUTPUT 101 -#define TEX_NODE_CHECKER 102 -#define TEX_NODE_TEXTURE 103 -#define TEX_NODE_BRICKS 104 -#define TEX_NODE_MATH 105 -#define TEX_NODE_MIX_RGB 106 -#define TEX_NODE_RGBTOBW 107 -#define TEX_NODE_VALTORGB 108 -#define TEX_NODE_IMAGE 109 -#define TEX_NODE_CURVE_RGB 110 -#define TEX_NODE_INVERT 111 -#define TEX_NODE_HUE_SAT 112 -#define TEX_NODE_CURVE_TIME 113 -#define TEX_NODE_ROTATE 114 -#define TEX_NODE_VIEWER 115 -#define TEX_NODE_TRANSLATE 116 -#define TEX_NODE_COORD 117 -#define TEX_NODE_DISTANCE 118 -#define TEX_NODE_COMPOSE 119 -#define TEX_NODE_DECOMPOSE 120 -#define TEX_NODE_VALTONOR 121 -#define TEX_NODE_SCALE 122 +#define TEX_NODE_OUTPUT 401 +#define TEX_NODE_CHECKER 402 +#define TEX_NODE_TEXTURE 403 +#define TEX_NODE_BRICKS 404 +#define TEX_NODE_MATH 405 +#define TEX_NODE_MIX_RGB 406 +#define TEX_NODE_RGBTOBW 407 +#define TEX_NODE_VALTORGB 408 +#define TEX_NODE_IMAGE 409 +#define TEX_NODE_CURVE_RGB 410 +#define TEX_NODE_INVERT 411 +#define TEX_NODE_HUE_SAT 412 +#define TEX_NODE_CURVE_TIME 413 +#define TEX_NODE_ROTATE 414 +#define TEX_NODE_VIEWER 415 +#define TEX_NODE_TRANSLATE 416 +#define TEX_NODE_COORD 417 +#define TEX_NODE_DISTANCE 418 +#define TEX_NODE_COMPOSE 419 +#define TEX_NODE_DECOMPOSE 420 +#define TEX_NODE_VALTONOR 421 +#define TEX_NODE_SCALE 422 /* 201-299 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */ -#define TEX_NODE_PROC 200 -#define TEX_NODE_PROC_MAX 300 +#define TEX_NODE_PROC 500 +#define TEX_NODE_PROC_MAX 600 extern struct ListBase node_all_textures; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index f4effddc7c5..6fb6a67650f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -17,12 +17,13 @@ * 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), Nathan Letwory + * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen * * ***** END GPL LICENSE BLOCK ***** */ #include <stdlib.h> +#include <string.h> #include "RNA_define.h" #include "RNA_types.h" @@ -39,11 +40,14 @@ StructRNA *rna_Node_refine(struct PointerRNA *ptr) bNode *node= (bNode*)ptr->data; switch(node->type) { - case SH_NODE_OUTPUT: - return &RNA_ShaderNodeOutput; - case SH_NODE_MATERIAL: - return &RNA_ShaderNodeMaterial; - /* XXX complete here */ + + #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ + case ID: return &RNA_##Category##StructName; + + #include "rna_nodetree_types.h" + + #undef DefNode + default: return &RNA_Node; } @@ -51,23 +55,297 @@ StructRNA *rna_Node_refine(struct PointerRNA *ptr) #else -static void rna_def_shader_node_output(BlenderRNA *brna) +#define MaxNodes 1000 + +enum { - StructRNA *srna; + Category_NoCategory, + Category_ShaderNode, + Category_CompositorNode, + Category_TextureNode +}; + +typedef struct NodeInfo +{ + int defined; + int category; + const char *enum_name; + const char *struct_name; + const char *base_name; + const char *ui_name; + const char *ui_desc; +} NodeInfo; + +static NodeInfo nodes[MaxNodes]; - srna= RNA_def_struct(brna, "ShaderNodeOutput", "ShaderNode"); - RNA_def_struct_ui_text(srna, "Shader Node Output", ""); +static void reg_node( + int ID, + int category, + const char *enum_name, + const char *struct_name, + const char *base_name, + const char *ui_name, + const char *ui_desc +){ + NodeInfo *ni = nodes + ID; + + ni->defined = 1; + ni->category = category; + ni->enum_name = enum_name; + ni->struct_name = struct_name; + ni->base_name = base_name; + ni->ui_name = ui_name; + ni->ui_desc = ui_desc; +} + +static void init(void) +{ + memset(nodes, 0, sizeof nodes); + + #define Str(x) #x + + #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ + reg_node(ID, Category_##Category, EnumName, Str(Category##StructName), #Category, UIName, UIDesc); + + #include "rna_nodetree_types.h" + + #undef DefNode + #undef Str +} + +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); + RNA_def_struct_ui_text(srna, node->ui_name, node->ui_desc); RNA_def_struct_sdna(srna, "bNode"); + + return srna; +} + +static EnumPropertyItem* alloc_node_type_items(int category) +{ + int i; + int count = 2; + EnumPropertyItem *item, *items; + + for(i=0; i<MaxNodes; i++) + if(nodes[i].defined && nodes[i].category == category) + count++; + + item = items = malloc(count * sizeof(EnumPropertyItem)); + + for(i=0; i<MaxNodes; i++) { + NodeInfo *node = nodes + i; + if(node->defined && node->category == category) { + item->value = i; + item->identifier = node->enum_name; + item->name = node->ui_name; + item->description = node->ui_desc; + + item++; + } + } + + item->value = NODE_DYNAMIC; + item->identifier = "SCRIPT"; + item->name = "Script"; + item->description = ""; + + item++; + + memset(item, 0, sizeof(EnumPropertyItem)); + + return items; } -static void rna_def_shader_node_material(BlenderRNA *brna) + +/* -- Common nodes ---------------------------------------------------------- */ + +static void def_math(BlenderRNA *brna, int id) { StructRNA *srna; PropertyRNA *prop; + + static EnumPropertyItem items[] ={ + { 0, "ADD", "Add", ""}, + { 1, "SUBTRACT", "Subtract", ""}, + { 2, "MULTIPLY", "Multiply", ""}, + { 3, "DIVIDE", "Divide", ""}, + { 4, "SINE", "Sine", ""}, + { 5, "COSINE", "Cosine", ""}, + { 6, "TANGENT", "Tangent", ""}, + { 7, "ARCSINE", "Arcsine", ""}, + { 8, "ARCCOSINE", "Arccosine", ""}, + { 9, "ARCTANGENT", "Arctangent", ""}, + {10, "POWER", "Power", ""}, + {11, "LOGARITHM", "Logarithm", ""}, + {12, "MINIMUM", "Minimum", ""}, + {13, "MAXIMUM", "Maximum", ""}, + {14, "ROUND", "Round", ""}, + {15, "LESS_THAN", "Less Than", ""}, + {16, "GREATER_THAN", "Greater Than", ""}, + + {0, NULL, NULL, NULL} + }; + + srna= def_node(brna, id); + + 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", ""); +} - srna= RNA_def_struct(brna, "ShaderNodeMaterial", "ShaderNode"); - RNA_def_struct_ui_text(srna, "Shader Node Material", ""); - RNA_def_struct_sdna(srna, "bNode"); +static void def_vector_math(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem items[] ={ + {0, "ADD", "Add", ""}, + {1, "SUBTRACT", "Subtract", ""}, + {2, "AVERAGE", "Average", ""}, + {3, "DOT_PRODUCT", "Dot Product", ""}, + {4, "CROSS_PRODUCT", "Cross Product", ""}, + {5, "NORMALIZE", "Normalize", ""}, + + {0, NULL, NULL, NULL} + }; + + srna= def_node(brna, id); + + 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", ""); +} + +static void def_rgb_curve(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= def_node(brna, id); + + 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_vector_curve(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= def_node(brna, id); + + 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_val_to_rgb(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= def_node(brna, id); + + /* TODO: uncomment when ColorBand is wrapped */ + /*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", "");*/ +} + +static void def_mix_rgb(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem blend_type_items[] ={ + { 0, "MIX", "Mix", ""}, + { 1, "ADD", "Add", ""}, + { 3, "SUBTRACT", "Subtract", ""}, + { 2, "MULTIPLY", "Multiply", ""}, + { 4, "SCREEN", "Screen", ""}, + { 9, "OVERLAY", "Overlay", ""}, + { 5, "DIVIDE", "Divide", ""}, + { 6, "DIFFERENCE", "Difference", ""}, + { 7, "DARKEN", "Darken", ""}, + { 8, "LIGHTEN", "Lighten", ""}, + {10, "DODGE", "Dodge", ""}, + {11, "BURN", "Burn", ""}, + {15, "COLOR", "Color", ""}, + {14, "VALUE", "Value", ""}, + {13, "SATURATION", "Saturation", ""}, + {12, "HUE", "Hue", ""}, + {0, NULL, NULL, NULL} + }; + + srna= def_node(brna, id); + + 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); + RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1); + RNA_def_property_ui_text(prop, "Diffuse", "Include alpha of second input in this operation"); +} + + +/* -- Shader Node Storage Types --------------------------------------------- */ + +static void rna_def_storage_node_geometry(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + 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); + 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); + RNA_def_property_string_sdna(prop, NULL, "colname"); + RNA_def_property_ui_text(prop, "Vertex Color Layer", ""); +} + + +/* -- 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_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); prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "id"); @@ -78,38 +356,54 @@ static void rna_def_shader_node_material(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF); RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse"); - /* XXX add specular, negate normal */ + 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); + 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"); } +static void def_sh_mapping(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= def_node(brna, id); + + 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", ""); +} + +static void def_sh_geometry(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, "NodeGeometry"); + RNA_def_property_ui_text(prop, "Settings", ""); +} + +/* -- Compositor Nodes ------------------------------------------------------ */ + +/* -- Texture Nodes --------------------------------------------------------- */ + +/* -------------------------------------------------------------------------- */ + static void rna_def_shader_node(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem node_type_items[] ={ - {SH_NODE_OUTPUT, "OUTPUT", "Output", ""}, - {SH_NODE_MATERIAL, "MATERIAL", "Material", ""}, - {SH_NODE_RGB, "RGB", "RGB", ""}, - {SH_NODE_VALUE, "VALUE", "Value", ""}, - {SH_NODE_MIX_RGB, "MIX_RGB", "Mix RGB", ""}, - {SH_NODE_VALTORGB, "VALUE_TO_RGB", "Value to RGB", ""}, - {SH_NODE_RGBTOBW, "RGB_TO_BW", "RGB to BW", ""}, - {SH_NODE_TEXTURE, "TEXTURE", "Texture", ""}, - {SH_NODE_NORMAL, "NORMAL", "Normal", ""}, - {SH_NODE_GEOMETRY, "GEOMETRY", "Geometry", ""}, - {SH_NODE_MAPPING, "MAPPING", "Mapping", ""}, - {SH_NODE_CURVE_VEC, "VECTOR_CURVES", "Vector Curves", ""}, - {SH_NODE_CURVE_RGB, "RGB_CURVES", "RGB Curves", ""}, - {SH_NODE_CAMERA, "CAMERA", "Camera", ""}, - {SH_NODE_MATH, "MATH", "Math", ""}, - {SH_NODE_VECT_MATH, "VECTOR_MATH", "Vector Math", ""}, - {SH_NODE_SQUEEZE, "SQUEEZE", "Squeeze", ""}, - {SH_NODE_MATERIAL_EXT, "MATERIAL_EXTENDED", "Material Extended", ""}, - {SH_NODE_INVERT, "INVERT", "Invert", ""}, - {SH_NODE_SEPRGB, "SEPARATE_RGB", "Seperate RGB", ""}, - {SH_NODE_COMBRGB, "COMBINE_RGB", "Combine RGB", ""}, - {SH_NODE_HUE_SAT, "HUE_SATURATION", "Hue/Saturation", ""}, - {NODE_DYNAMIC, "SCRIPT", "Script", ""}, - {0, NULL, NULL, NULL}}; + EnumPropertyItem *node_type_items; + + node_type_items = alloc_node_type_items(Category_ShaderNode); srna= RNA_def_struct(brna, "ShaderNode", "Node"); RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node."); @@ -120,11 +414,48 @@ static void rna_def_shader_node(BlenderRNA *brna) RNA_def_property_enum_items(prop, node_type_items); RNA_def_property_ui_text(prop, "Type", ""); - /* specific types */ - rna_def_shader_node_output(brna); - rna_def_shader_node_material(brna); + /* Shader storage types */ + rna_def_storage_node_geometry(brna); +} + +static void rna_def_compositor_node(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + EnumPropertyItem *node_type_items; + + node_type_items = alloc_node_type_items(Category_CompositorNode); + + 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); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_items(prop, node_type_items); + RNA_def_property_ui_text(prop, "Type", ""); +} + +static void rna_def_texture_node(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + EnumPropertyItem *node_type_items; + + node_type_items = alloc_node_type_items(Category_TextureNode); + + 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); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_items(prop, node_type_items); + RNA_def_property_ui_text(prop, "Type", ""); } +/* -------------------------------------------------------------------------- */ + static void rna_def_node(BlenderRNA *brna) { StructRNA *srna; @@ -161,11 +492,31 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Nodes", ""); } +static void define_simple_node(BlenderRNA *brna, int id) +{ + def_node(brna, id); +} + +static void define_specific_node(BlenderRNA *brna, int id, void (*func)(BlenderRNA*, int)) +{ + func(brna, id); +} + void RNA_def_nodetree(BlenderRNA *brna) { + init(); rna_def_nodetree(brna); rna_def_node(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 ? DefFunc : define_simple_node); + + #include "rna_nodetree_types.h" + + #undef DefNode } #endif diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h new file mode 100644 index 00000000000..00b7f7e62cb --- /dev/null +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -0,0 +1,131 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * 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 + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */ +DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" ) +DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" ) +DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) +DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "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_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", "" ) +DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" ) +DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" ) +DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" ) +DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" ) +DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" ) +DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze", "" ) +DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" ) +DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ) +DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" ) +DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" ) +DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) + +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_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_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_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_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_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) +DefNode( CompositorNode, CMP_NODE_SCALE, 0, "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_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_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_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( TextureNode, TEX_NODE_OUTPUT, 0, "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_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_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_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) +DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) +DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" ) +DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" ) +DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" ) +DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Compose", "" ) +DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Decompose", "" ) +DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Val to Nor", "" ) +DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" ) + diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 1f1c97ffc0c..c7b479f8e45 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -121,6 +121,43 @@ static void rna_def_color_ramp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Interpolation", ""); } +static void rna_def_texmapping(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "TexMapping", NULL); + RNA_def_struct_ui_text(srna, "Texture Mapping", "Mapping settings"); + + prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "loc"); + RNA_def_property_ui_text(prop, "Location", ""); + + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION); + RNA_def_property_float_sdna(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Rotation", ""); + + prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Scale", ""); + + prop= RNA_def_property(srna, "minimum", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "min"); + RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping"); + + prop= RNA_def_property(srna, "maximum", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping"); + + prop= RNA_def_property(srna, "has_minimum", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); + RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value"); + + prop= RNA_def_property(srna, "has_maximum", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); + RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value"); +} + static void rna_def_mtex(BlenderRNA *brna) { StructRNA *srna; @@ -506,6 +543,7 @@ void RNA_def_texture(BlenderRNA *brna) rna_def_environment_map(brna); rna_def_color_ramp(brna); rna_def_color_ramp_element(brna); + rna_def_texmapping(brna); } #endif |