Blender  V2.59
rna_texture.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_texture.c 37447 2011-06-13 12:03:05Z ton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008).
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <float.h>
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033 
00034 #include "RNA_define.h"
00035 
00036 #include "rna_internal.h"
00037 
00038 #include "DNA_brush_types.h"
00039 #include "DNA_lamp_types.h"
00040 #include "DNA_material_types.h"
00041 #include "DNA_object_types.h"
00042 #include "DNA_texture_types.h"
00043 #include "DNA_world_types.h"
00044 #include "DNA_node_types.h"
00045 #include "DNA_particle_types.h"
00046 #include "DNA_scene_types.h" /* MAXFRAME only */
00047 
00048 #include "BKE_node.h"
00049 
00050 EnumPropertyItem texture_filter_items[] = {
00051         {TXF_BOX, "BOX", 0, "Box", ""},
00052         {TXF_EWA, "EWA", 0, "EWA", ""},
00053         {TXF_FELINE, "FELINE", 0, "FELINE", ""},
00054         {TXF_AREA, "AREA", 0, "Area", ""},
00055         {0, NULL, 0, NULL, NULL}};
00056 
00057 EnumPropertyItem texture_type_items[] = {
00058         {0, "NONE", 0, "None", ""},
00059         {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - Creates a ramp texture"},
00060         {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - Creates a cloud-like fractal noise texture"},
00061         {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", "Procedural - Noise texture distorted by two noise algorithms"},
00062         {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", "Creates a render of the environment mapped to a texture"},
00063         {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allows for images or movies to be used as textures"},
00064         {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", "Procedural - Color texture based on trigonometric functions"},
00065         {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", "Procedural - Marble-like noise texture with wave generated bands"},
00066         {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - Highly flexible fractal noise texture"},
00067         {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", "Procedural - Random noise, gives a different result every time, for every frame, for every pixel"},
00068         //{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, /* Nothing yet */
00069         {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""},
00070         {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - Creates a fractal noise texture"},
00071         {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - Creates cell-like patterns based on Worley noise"},
00072         {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Creates a 3d texture based on volumetric data"},
00073         {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - Wave generated bands or rings, with optional noise"},
00074         {0, NULL, 0, NULL, NULL}};
00075 
00076 #ifdef RNA_RUNTIME
00077 
00078 #include "MEM_guardedalloc.h"
00079 
00080 #include "RNA_access.h"
00081 
00082 #include "BKE_depsgraph.h"
00083 #include "BKE_image.h"
00084 #include "BKE_texture.h"
00085 #include "BKE_main.h"
00086 
00087 #include "ED_node.h"
00088 
00089 #include "WM_api.h"
00090 #include "WM_types.h"
00091 
00092 static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
00093 {
00094         Tex *tex= (Tex*)ptr->data;
00095 
00096         switch(tex->type) {
00097                 case TEX_BLEND:
00098                         return &RNA_BlendTexture; 
00099                 case TEX_CLOUDS:
00100                         return &RNA_CloudsTexture;
00101                 case TEX_DISTNOISE:
00102                         return &RNA_DistortedNoiseTexture;
00103                 case TEX_ENVMAP:
00104                         return &RNA_EnvironmentMapTexture;
00105                 case TEX_IMAGE:
00106                         return &RNA_ImageTexture;
00107                 case TEX_MAGIC:
00108                         return &RNA_MagicTexture;
00109                 case TEX_MARBLE:
00110                         return &RNA_MarbleTexture;
00111                 case TEX_MUSGRAVE:
00112                         return &RNA_MusgraveTexture;
00113                 case TEX_NOISE:
00114                         return &RNA_NoiseTexture;
00115                 case TEX_PLUGIN:
00116                         return &RNA_PluginTexture;
00117                 case TEX_POINTDENSITY:
00118                         return &RNA_PointDensityTexture;
00119                 case TEX_STUCCI:
00120                         return &RNA_StucciTexture;
00121                 case TEX_VORONOI:
00122                         return &RNA_VoronoiTexture;
00123                 case TEX_VOXELDATA:
00124                         return &RNA_VoxelDataTexture;
00125                 case TEX_WOOD:
00126                         return &RNA_WoodTexture;
00127                 default:
00128                         return &RNA_Texture;
00129         }
00130 }
00131 
00132 static void rna_Texture_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00133 {
00134         Tex *tex= ptr->id.data;
00135 
00136         DAG_id_tag_update(&tex->id, 0);
00137         WM_main_add_notifier(NC_TEXTURE, tex);
00138         WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, NULL);
00139 }
00140 
00141 static void rna_Texture_voxeldata_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00142 {
00143         Tex *tex= ptr->id.data;
00144         
00145         tex->vd->ok = 0;
00146         rna_Texture_update(bmain, scene, ptr);
00147 }
00148 
00149 static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00150 {
00151         Tex *tex= ptr->id.data;
00152         
00153         if(tex->ima) { /* may be getting cleared too */
00154                 tex->ima->source = IMA_SRC_SEQUENCE;
00155         }
00156         rna_Texture_voxeldata_update(bmain, scene, ptr);
00157 }
00158 
00159 
00160 /* Used for Texture Properties, used (also) for/in Nodes */
00161 static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00162 {
00163         Tex *tex= ptr->id.data;
00164 
00165         DAG_id_tag_update(&tex->id, 0);
00166         WM_main_add_notifier(NC_TEXTURE|ND_NODES, tex);
00167 }
00168 
00169 static void rna_Texture_type_set(PointerRNA *ptr, int value)
00170 {
00171         Tex *tex= (Tex*)ptr->data;
00172         
00173         tex_set_type(tex, value);
00174 }
00175 
00176 void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00177 {
00178         ID *id= ptr->id.data;
00179 
00180         DAG_id_tag_update(id, 0);
00181 
00182         switch(GS(id->name)) {
00183                 case ID_MA: 
00184                         WM_main_add_notifier(NC_MATERIAL|ND_SHADING, id);
00185                         WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
00186                         break;
00187                 case ID_WO: 
00188                         WM_main_add_notifier(NC_WORLD, id);
00189                         break;
00190                 case ID_LA: 
00191                         WM_main_add_notifier(NC_LAMP|ND_LIGHTING, id);
00192                         break;
00193                 case ID_BR: 
00194                         WM_main_add_notifier(NC_BRUSH, id);
00195                         break;
00196                 case ID_PA:
00197                 {
00198                         MTex *mtex= ptr->data;
00199                         int recalc = OB_RECALC_DATA;
00200 
00201                         if(mtex->mapto & PAMAP_INIT)
00202                                 recalc |= PSYS_RECALC_RESET;
00203                         if(mtex->mapto & PAMAP_CHILD)
00204                                 recalc |= PSYS_RECALC_CHILD;
00205 
00206                         DAG_id_tag_update(id, recalc);
00207                         WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00208                         break;
00209                 }
00210         }
00211 }
00212 
00213 char *rna_TextureSlot_path(PointerRNA *ptr)
00214 {
00215         MTex *mtex= ptr->data;
00216         
00217         /* if there is ID-data, resolve the path using the index instead of by name,
00218          * since the name used is the name of the texture assigned, but the texture
00219          * may be used multiple times in the same stack
00220          */
00221         if (ptr->id.data) {
00222                 PointerRNA id_ptr;
00223                 PropertyRNA *prop;
00224                 
00225                 /* find the 'textures' property of the ID-struct */
00226                 RNA_id_pointer_create(ptr->id.data, &id_ptr);
00227                 prop= RNA_struct_find_property(&id_ptr, "texture_slots");
00228                 
00229                 /* get an iterator for this property, and try to find the relevant index */
00230                 if (prop) {
00231                         int index= RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
00232                         
00233                         if (index >= 0)
00234                                 return BLI_sprintfN("texture_slots[%d]", index);
00235                 }
00236         }
00237         
00238         /* this is a compromise for the remaining cases... */
00239         if (mtex->tex)
00240                 return BLI_sprintfN("texture_slots[\"%s\"]", mtex->tex->id.name+2);
00241         else
00242                 return BLI_strdup("texture_slots[0]");
00243 }
00244 
00245 static int rna_TextureSlot_name_length(PointerRNA *ptr)
00246 {
00247         MTex *mtex= ptr->data;
00248 
00249         if(mtex->tex)
00250                 return strlen(mtex->tex->id.name+2);
00251         
00252         return 0;
00253 }
00254 
00255 static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
00256 {
00257         MTex *mtex= ptr->data;
00258 
00259         if(mtex->tex)
00260                 strcpy(str, mtex->tex->id.name+2);
00261         else
00262                 strcpy(str, "");
00263 }
00264 
00265 static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
00266 {
00267         MTex *mtex= ptr->data;
00268         Tex *tex= mtex->tex;
00269         int cur= mtex->which_output;
00270         
00271         if(tex) {
00272                 bNodeTree *ntree= tex->nodetree;
00273                 bNode *node;
00274                 if(ntree) {
00275                         for(node= ntree->nodes.first; node; node= node->next) {
00276                                 if(node->type == TEX_NODE_OUTPUT) {
00277                                         if(cur == node->custom1)
00278                                                 return cur;
00279                                 }
00280                         }
00281                 }
00282         }
00283         
00284         mtex->which_output= 0;
00285         return 0;
00286 }
00287 
00288 
00289 static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
00290 {
00291         MTex *mtex= ptr->data;
00292         Tex *tex= mtex->tex;
00293         EnumPropertyItem *item= NULL;
00294         int totitem= 0;
00295         
00296         if(tex) {
00297                 bNodeTree *ntree= tex->nodetree;
00298                 if(ntree) {
00299                         EnumPropertyItem tmp= {0, "", 0, "", ""};
00300                         bNode *node;
00301                         
00302                         tmp.value = 0;
00303                         tmp.name = "Not Specified";
00304                         tmp.identifier = "NOT_SPECIFIED";
00305                         RNA_enum_item_add(&item, &totitem, &tmp);
00306                         
00307                         for(node= ntree->nodes.first; node; node= node->next) {
00308                                 if(node->type == TEX_NODE_OUTPUT) {
00309                                         tmp.value= node->custom1;
00310                                         tmp.name= ((TexNodeOutput*)node->storage)->name;
00311                                         tmp.identifier = tmp.name;
00312                                         RNA_enum_item_add(&item, &totitem, &tmp);
00313                                 }
00314                         }
00315                 }
00316         }
00317         
00318         RNA_enum_item_end(&item, &totitem);
00319         *free = 1;
00320 
00321         return item;
00322 }
00323 
00324 static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value)
00325 {
00326         Tex *tex= (Tex*)ptr->data;
00327 
00328         if(value) tex->flag |= TEX_COLORBAND;
00329         else tex->flag &= ~TEX_COLORBAND;
00330 
00331         if((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
00332                 tex->coba= add_colorband(0);
00333 }
00334 
00335 static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v)
00336 {
00337         Tex *tex= (Tex*)ptr->data;
00338         
00339         tex->use_nodes = v;
00340         tex->type = 0;
00341         
00342         if(v && tex->nodetree==NULL)
00343                 ED_node_texture_default(tex);
00344 }
00345 
00346 static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value)
00347 {
00348         Tex *tex= (Tex*)ptr->data;
00349 
00350         if(value) tex->imaflag |= TEX_MIPMAP;
00351         else tex->imaflag &= ~TEX_MIPMAP;
00352 }
00353 
00354 static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00355 {
00356         Tex *tex= ptr->id.data;
00357         
00358         if (tex->env)
00359                 BKE_free_envmapdata(tex->env);
00360         
00361         rna_Texture_update(bmain, scene, ptr);
00362 }
00363 
00364 static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr)
00365 {
00366         PointDensity *pd= ptr->data;
00367         Object *ob= pd->object;
00368         ParticleSystem *psys= NULL;
00369         PointerRNA value;
00370 
00371         if(ob && pd->psys)
00372                 psys= BLI_findlink(&ob->particlesystem, pd->psys-1);
00373 
00374         RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
00375         return value;
00376 }
00377 
00378 static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
00379 {
00380         PointDensity *pd= ptr->data;
00381         Object *ob= pd->object;
00382 
00383         if(ob && value.id.data == ob)
00384                 pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1;
00385 }
00386 
00387 static char *rna_PointDensity_path(PointerRNA *ptr)
00388 {
00389         return BLI_sprintfN("point_density");
00390 }
00391 
00392 static char *rna_VoxelData_path(PointerRNA *ptr)
00393 {
00394         return BLI_sprintfN("voxel_data");
00395 }
00396 
00397 #else
00398 
00399 static void rna_def_texmapping(BlenderRNA *brna)
00400 {
00401         StructRNA *srna;
00402         PropertyRNA *prop;
00403         
00404         srna= RNA_def_struct(brna, "TexMapping", NULL);
00405         RNA_def_struct_ui_text(srna, "Texture Mapping", "Mapping settings");
00406 
00407         prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
00408         RNA_def_property_float_sdna(prop, NULL, "loc");
00409         RNA_def_property_ui_text(prop, "Location", "");
00410         RNA_def_property_update(prop, 0, "rna_Texture_update");
00411         
00412         prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
00413         RNA_def_property_float_sdna(prop, NULL, "rot");
00414         RNA_def_property_ui_text(prop, "Rotation", "");
00415         RNA_def_property_update(prop, 0, "rna_Texture_update");
00416         
00417         prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
00418         RNA_def_property_float_sdna(prop, NULL, "size");
00419         RNA_def_property_ui_text(prop, "Scale", "");
00420         RNA_def_property_update(prop, 0, "rna_Texture_update");
00421         
00422         prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
00423         RNA_def_property_float_sdna(prop, NULL, "min");
00424         RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
00425         RNA_def_property_update(prop, 0, "rna_Texture_update");
00426         
00427         prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
00428         RNA_def_property_float_sdna(prop, NULL, "max");
00429         RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
00430         RNA_def_property_update(prop, 0, "rna_Texture_update");
00431         
00432         prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
00433         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
00434         RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
00435         RNA_def_property_update(prop, 0, "rna_Texture_update");
00436         
00437         prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
00438         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
00439         RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
00440         RNA_def_property_update(prop, 0, "rna_Texture_update");
00441 }
00442 
00443 static void rna_def_mtex(BlenderRNA *brna)
00444 {
00445         StructRNA *srna;
00446         PropertyRNA *prop;
00447 
00448         static EnumPropertyItem prop_blend_type_items[] = {
00449                 {MTEX_BLEND, "MIX", 0, "Mix", ""},
00450                 {MTEX_ADD, "ADD", 0, "Add", ""},
00451                 {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""},
00452                 {MTEX_MUL, "MULTIPLY", 0, "Multiply", ""},
00453                 {MTEX_SCREEN, "SCREEN", 0, "Screen", ""},
00454                 {MTEX_OVERLAY, "OVERLAY", 0, "Overlay", ""},
00455                 {MTEX_DIFF, "DIFFERENCE", 0, "Difference", ""},
00456                 {MTEX_DIV, "DIVIDE", 0, "Divide", ""},
00457                 {MTEX_DARK, "DARKEN", 0, "Darken", ""},
00458                 {MTEX_LIGHT, "LIGHTEN", 0, "Lighten", ""},
00459                 {MTEX_BLEND_HUE, "HUE", 0, "Hue", ""},
00460                 {MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
00461                 {MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
00462                 {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
00463                 {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, 
00464                 {MTEX_LIN_LIGHT    , "LINEAR_LIGHT", 0, "Linear Light", ""}, 
00465                 {0, NULL, 0, NULL, NULL}};
00466 
00467         static EnumPropertyItem output_node_items[] = {
00468                 {0, "DUMMY", 0, "Dummy", ""},
00469                 {0, NULL, 0, NULL, NULL}};
00470                 
00471         srna= RNA_def_struct(brna, "TextureSlot", NULL);
00472         RNA_def_struct_sdna(srna, "MTex");
00473         RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
00474         RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
00475         RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
00476 
00477         prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
00478         RNA_def_property_pointer_sdna(prop, NULL, "tex");
00479         RNA_def_property_struct_type(prop, "Texture");
00480         RNA_def_property_flag(prop, PROP_EDITABLE);
00481         RNA_def_property_ui_text(prop, "Texture", "Texture datablock used by this texture slot");
00482         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00483 
00484         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00485         RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
00486         RNA_def_property_ui_text(prop, "Name", "Texture slot name");
00487         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00488         RNA_def_struct_name_property(srna, prop);
00489         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00490 
00491         /* mapping */
00492         prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
00493         RNA_def_property_float_sdna(prop, NULL, "ofs");
00494         RNA_def_property_ui_range(prop, -10, 10, 10, 2);
00495         RNA_def_property_ui_text(prop, "Offset", "Fine tunes texture mapping X, Y and Z locations");
00496         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00497 
00498         prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
00499         RNA_def_property_float_sdna(prop, NULL, "size");
00500         RNA_def_property_ui_range(prop, -100, 100, 10, 2);
00501         RNA_def_property_ui_text(prop, "Size", "Sets scaling for the texture's X, Y and Z sizes");
00502         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00503 
00504         prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
00505         RNA_def_property_float_sdna(prop, NULL, "r");
00506         RNA_def_property_array(prop, 3);
00507         RNA_def_property_ui_text(prop, "Color", "The default color for textures that don't return RGB or when RGB to intensity is enabled");
00508         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00509 
00510         prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
00511         RNA_def_property_enum_sdna(prop, NULL, "blendtype");
00512         RNA_def_property_enum_items(prop, prop_blend_type_items);
00513         RNA_def_property_ui_text(prop, "Blend Type", "The mode used to apply the texture");
00514         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00515 
00516         prop= RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE);
00517         RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_STENCIL);
00518         RNA_def_property_ui_text(prop, "Stencil", "Use this texture as a blending value on the next texture");
00519         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00520 
00521         prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
00522         RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEGATIVE);
00523         RNA_def_property_ui_text(prop, "Negate", "Inverts the values of the texture to reverse its effect");
00524         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00525 
00526         prop= RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE);
00527         RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_RGBTOINT);
00528         RNA_def_property_ui_text(prop, "RGB to Intensity", "Converts texture RGB values to intensity (gray) values");
00529         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00530 
00531         prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
00532         RNA_def_property_float_sdna(prop, NULL, "def_var");
00533         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00534         RNA_def_property_ui_text(prop, "Default Value", "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
00535         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00536         
00537         prop= RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
00538         RNA_def_property_enum_sdna(prop, NULL, "which_output");
00539         RNA_def_property_enum_items(prop, output_node_items);
00540         RNA_def_property_enum_funcs(prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
00541         RNA_def_property_ui_text(prop, "Output Node", "Which output node to use, for node-based textures");
00542         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00543 }
00544 
00545 static void rna_def_filter_common(StructRNA *srna) 
00546 {
00547         PropertyRNA *prop;
00548         
00549         prop= RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
00550         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
00551         RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
00552         RNA_def_property_ui_text(prop, "MIP Map", "Uses auto-generated MIP maps for the image");
00553         RNA_def_property_update(prop, 0, "rna_Texture_update");
00554         
00555         prop= RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
00556         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
00557         RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Uses Gauss filter to sample down MIP maps");
00558         RNA_def_property_update(prop, 0, "rna_Texture_update");
00559         
00560         prop= RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
00561         RNA_def_property_enum_sdna(prop, NULL, "texfilter");
00562         RNA_def_property_enum_items(prop, texture_filter_items);
00563         RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
00564         RNA_def_property_update(prop, 0, "rna_Texture_update");
00565         
00566         prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE);
00567         RNA_def_property_int_sdna(prop, NULL, "afmax");
00568         RNA_def_property_range(prop, 1, 256);
00569         RNA_def_property_ui_text(prop, "Filter Probes", "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower");
00570         RNA_def_property_update(prop, 0, "rna_Texture_update");
00571         
00572         prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
00573         RNA_def_property_int_sdna(prop, NULL, "afmax");
00574         RNA_def_property_range(prop, 1, 256);
00575         RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower");
00576         RNA_def_property_update(prop, 0, "rna_Texture_update");
00577 
00578         prop= RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
00579         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
00580         RNA_def_property_ui_text(prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
00581         RNA_def_property_update(prop, 0, "rna_Texture_update");
00582 
00583         prop= RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
00584         RNA_def_property_float_sdna(prop, NULL, "filtersize");
00585         RNA_def_property_range(prop, 0.1, 50.0);
00586         RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 0.2);
00587         RNA_def_property_ui_text(prop, "Filter Size", "Multiplies the filter size used by MIP Map and Interpolation");
00588         RNA_def_property_update(prop, 0, "rna_Texture_update");
00589 }
00590 
00591 static void rna_def_environment_map(BlenderRNA *brna)
00592 {
00593         StructRNA *srna;
00594         PropertyRNA *prop;
00595 
00596         static EnumPropertyItem prop_source_items[] = {
00597                 {ENV_STATIC, "STATIC", 0, "Static", "Calculates environment map only once"},
00598                 {ENV_ANIM, "ANIMATED", 0, "Animated", "Calculates environment map at each rendering"},
00599                 {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Loads a saved environment map image from disk"},
00600                 {0, NULL, 0, NULL, NULL}};
00601         
00602         static EnumPropertyItem prop_mapping_items[] = {
00603                 {ENV_CUBE, "CUBE", 0, "Cube", "Use environment map with six cube sides"},
00604                 {ENV_PLANE, "PLANE", 0, "Plane", "Only one side is rendered, with Z axis pointing in direction of image"},
00605                 {0, NULL, 0, NULL, NULL}};
00606 
00607         srna= RNA_def_struct(brna, "EnvironmentMap", NULL);
00608         RNA_def_struct_sdna(srna, "EnvMap");
00609         RNA_def_struct_ui_text(srna, "EnvironmentMap", "Environment map created by the renderer and cached for subsequent renders");
00610         
00611         prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
00612         RNA_def_property_enum_sdna(prop, NULL, "stype");
00613         RNA_def_property_enum_items(prop, prop_source_items);
00614         RNA_def_property_ui_text(prop, "Source", "");
00615         RNA_def_property_update(prop, 0, "rna_Envmap_source_update");
00616 
00617         prop= RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE);
00618         RNA_def_property_pointer_sdna(prop, NULL, "object");
00619         RNA_def_property_ui_text(prop, "Viewpoint Object", "Object to use as the environment map's viewpoint location");
00620         RNA_def_property_flag(prop, PROP_EDITABLE);
00621         RNA_def_property_update(prop, 0, "rna_Texture_update");
00622         
00623         prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
00624         RNA_def_property_enum_sdna(prop, NULL, "type");
00625         RNA_def_property_enum_items(prop, prop_mapping_items);
00626         RNA_def_property_ui_text(prop, "Mapping", "");
00627         RNA_def_property_update(prop, 0, "rna_Texture_update");
00628 
00629         prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
00630         RNA_def_property_float_sdna(prop, NULL, "clipsta");
00631         RNA_def_property_range(prop, 0.001, FLT_MAX);
00632         RNA_def_property_ui_range(prop, 0.01, 50, 100, 2);
00633         RNA_def_property_ui_text(prop, "Clip Start", "Objects nearer than this are not visible to map");
00634         RNA_def_property_update(prop, 0, "rna_Texture_update");
00635 
00636         prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
00637         RNA_def_property_float_sdna(prop, NULL, "clipend");
00638         RNA_def_property_range(prop, 0.01, FLT_MAX);
00639         RNA_def_property_ui_range(prop, 0.10, 20000, 100, 2);
00640         RNA_def_property_ui_text(prop, "Clip End", "Objects further than this are not visible to map");
00641         RNA_def_property_update(prop, 0, "rna_Texture_update");
00642 
00643         prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
00644         RNA_def_property_float_sdna(prop, NULL, "viewscale");
00645         RNA_def_property_range(prop, 0.1, 5.0);
00646         RNA_def_property_ui_range(prop, 0.5, 1.5, 1, 2);
00647         RNA_def_property_ui_text(prop, "Zoom", "");
00648         RNA_def_property_update(prop, 0, "rna_Texture_update");
00649 
00650         prop= RNA_def_property(srna, "layers_ignore", PROP_BOOLEAN, PROP_LAYER_MEMBER);
00651         RNA_def_property_boolean_sdna(prop, NULL, "notlay", 1);
00652         RNA_def_property_array(prop, 20);
00653         RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map");
00654         RNA_def_property_update(prop, 0, "rna_Texture_update");
00655         
00656         prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
00657         RNA_def_property_int_sdna(prop, NULL, "cuberes");
00658         RNA_def_property_range(prop, 50, 4096);
00659         RNA_def_property_ui_text(prop, "Resolution", "Pixel resolution of the rendered environment map");
00660         RNA_def_property_update(prop, 0, "rna_Texture_update");
00661 
00662         prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
00663         RNA_def_property_range(prop, 0, 5);
00664         RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects.)");
00665         RNA_def_property_update(prop, 0, "rna_Texture_update");
00666 }
00667 
00668 static EnumPropertyItem prop_noise_basis_items[] = {
00669         {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original", "Noise algorithm - Blender original: Smooth interpolated noise"},
00670         {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin", "Noise algorithm - Original Perlin: Smooth interpolated noise"},
00671         {TEX_NEWPERLIN, "IMPROVED_PERLIN", 0, "Improved Perlin", "Noise algorithm - Improved Perlin: Smooth interpolated noise"},
00672         {TEX_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"},
00673         {TEX_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2", "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"},
00674         {TEX_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3", "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"},
00675         {TEX_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4", "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"},
00676         {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"},
00677         {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
00678         {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", "Noise algorithm - Cell Noise: Square cell tessallation"},
00679         {0, NULL, 0, NULL, NULL}};
00680 
00681 static EnumPropertyItem prop_noise_type[] = {
00682         {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
00683         {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
00684         {0, NULL, 0, NULL, NULL}};
00685 
00686 
00687 static void rna_def_texture_clouds(BlenderRNA *brna)
00688 {
00689         StructRNA *srna;
00690         PropertyRNA *prop;
00691 
00692         static EnumPropertyItem prop_clouds_stype[] = {
00693         {TEX_DEFAULT, "GREYSCALE", 0, "Greyscale", ""},
00694         {TEX_COLOR, "COLOR", 0, "Color", ""},
00695         {0, NULL, 0, NULL, NULL}};
00696 
00697         srna= RNA_def_struct(brna, "CloudsTexture", "Texture");
00698         RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
00699         RNA_def_struct_sdna(srna, "Tex");
00700 
00701         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
00702         RNA_def_property_float_sdna(prop, NULL, "noisesize");
00703         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00704         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
00705         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
00706         RNA_def_property_update(prop, 0, "rna_Texture_update");
00707 
00708         prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
00709         RNA_def_property_int_sdna(prop, NULL, "noisedepth");
00710         RNA_def_property_range(prop, 0, 30);
00711         RNA_def_property_ui_range(prop, 0, 24, 0, 2);
00712         RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
00713         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00714 
00715         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
00716         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
00717         RNA_def_property_enum_items(prop, prop_noise_basis_items);
00718         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
00719         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00720 
00721         prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
00722         RNA_def_property_enum_sdna(prop, NULL, "noisetype");
00723         RNA_def_property_enum_items(prop, prop_noise_type);
00724         RNA_def_property_ui_text(prop, "Noise Type", "");
00725         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00726 
00727         prop= RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
00728         RNA_def_property_enum_sdna(prop, NULL, "stype");
00729         RNA_def_property_enum_items(prop, prop_clouds_stype);
00730         RNA_def_property_ui_text(prop, "Color", "Determines whether Noise returns grayscale or RGB values");
00731         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00732 
00733         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
00734         RNA_def_property_range(prop, 0.001, 0.1);
00735         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
00736         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
00737         RNA_def_property_update(prop, 0, "rna_Texture_update");
00738 }
00739 
00740 static void rna_def_texture_wood(BlenderRNA *brna)
00741 {
00742         StructRNA *srna;
00743         PropertyRNA *prop;
00744 
00745         static EnumPropertyItem prop_wood_stype[] = {
00746         {TEX_BAND, "BANDS", 0, "Bands", "Uses standard wood texture in bands"},
00747         {TEX_RING, "RINGS", 0, "Rings", "Uses wood texture in rings"},
00748         {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Adds noise to standard wood"},
00749         {TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Adds noise to rings"},
00750         {0, NULL, 0, NULL, NULL}};
00751 
00752         static EnumPropertyItem prop_wood_noisebasis2[] = {
00753         {TEX_SIN, "SIN", 0, "Sine", "Uses a sine wave to produce bands"},
00754         {TEX_SAW, "SAW", 0, "Saw", "Uses a saw wave to produce bands"},
00755         {TEX_TRI, "TRI", 0, "Tri", "Uses a triangle wave to produce bands"},
00756         {0, NULL, 0, NULL, NULL}};
00757 
00758         srna= RNA_def_struct(brna, "WoodTexture", "Texture");
00759         RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
00760         RNA_def_struct_sdna(srna, "Tex");
00761 
00762         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
00763         RNA_def_property_float_sdna(prop, NULL, "noisesize");
00764         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00765         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
00766         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
00767         RNA_def_property_update(prop, 0, "rna_Texture_update");
00768 
00769         prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
00770         RNA_def_property_float_sdna(prop, NULL, "turbul");
00771         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00772         RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
00773         RNA_def_property_ui_text(prop, "Turbulence", "Sets the turbulence of the bandnoise and ringnoise types");
00774         RNA_def_property_update(prop, 0, "rna_Texture_update");
00775 
00776         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
00777         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
00778         RNA_def_property_enum_items(prop, prop_noise_basis_items);
00779         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
00780         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00781 
00782         prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
00783         RNA_def_property_enum_sdna(prop, NULL, "noisetype");
00784         RNA_def_property_enum_items(prop, prop_noise_type);
00785         RNA_def_property_ui_text(prop, "Noise Type", "");
00786         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00787 
00788         prop= RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
00789         RNA_def_property_enum_sdna(prop, NULL, "stype");
00790         RNA_def_property_enum_items(prop, prop_wood_stype);
00791         RNA_def_property_ui_text(prop, "Pattern", "");
00792         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00793 
00794         prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
00795         RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
00796         RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
00797         RNA_def_property_ui_text(prop, "Noise Basis 2", "");
00798         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00799 
00800         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
00801         RNA_def_property_range(prop, 0.001, 0.1);
00802         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
00803         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
00804         RNA_def_property_update(prop, 0, "rna_Texture_update");
00805 
00806 }
00807 
00808 static void rna_def_texture_marble(BlenderRNA *brna)
00809 {
00810         StructRNA *srna;
00811         PropertyRNA *prop;
00812 
00813         static EnumPropertyItem prop_marble_stype[] = {
00814         {TEX_SOFT, "SOFT", 0, "Soft", "Uses soft marble"},
00815         {TEX_SHARP, "SHARP", 0, "Sharp", "Uses more clearly defined marble"},
00816         {TEX_SHARPER, "SHARPER", 0, "Sharper", "Uses very clearly defined marble"},
00817         {0, NULL, 0, NULL, NULL}};
00818 
00819         static EnumPropertyItem prop_marble_noisebasis2[] = {
00820         {TEX_SIN, "SIN", 0, "Sin", "Uses a sine wave to produce bands"},
00821         {TEX_SAW, "SAW", 0, "Saw", "Uses a saw wave to produce bands"},
00822         {TEX_TRI, "TRI", 0, "Tri", "Uses a triangle wave to produce bands"},
00823         {0, NULL, 0, NULL, NULL}};
00824 
00825         srna= RNA_def_struct(brna, "MarbleTexture", "Texture");
00826         RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
00827         RNA_def_struct_sdna(srna, "Tex");
00828 
00829         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
00830         RNA_def_property_float_sdna(prop, NULL, "noisesize");
00831         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00832         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
00833         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
00834         RNA_def_property_update(prop, 0, "rna_Texture_update");
00835 
00836         prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
00837         RNA_def_property_float_sdna(prop, NULL, "turbul");
00838         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00839         RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
00840         RNA_def_property_ui_text(prop, "Turbulence", "Sets the turbulence of the bandnoise and ringnoise types");
00841         RNA_def_property_update(prop, 0, "rna_Texture_update");
00842 
00843         prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
00844         RNA_def_property_int_sdna(prop, NULL, "noisedepth");
00845         RNA_def_property_range(prop, 0, 30);
00846         RNA_def_property_ui_range(prop, 0, 24, 0, 2);
00847         RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
00848         RNA_def_property_update(prop, 0, "rna_Texture_update");
00849 
00850         prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
00851         RNA_def_property_enum_sdna(prop, NULL, "noisetype");
00852         RNA_def_property_enum_items(prop, prop_noise_type);
00853         RNA_def_property_ui_text(prop, "Noise Type", "");
00854         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00855 
00856         prop= RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
00857         RNA_def_property_enum_sdna(prop, NULL, "stype");
00858         RNA_def_property_enum_items(prop, prop_marble_stype);
00859         RNA_def_property_ui_text(prop, "Pattern", "");
00860         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00861         
00862         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
00863         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
00864         RNA_def_property_enum_items(prop, prop_noise_basis_items);
00865         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
00866         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00867 
00868         prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
00869         RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
00870         RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
00871         RNA_def_property_ui_text(prop, "Noise Basis 2", "");
00872         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00873 
00874         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
00875         RNA_def_property_range(prop, 0.001, 0.1);
00876         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
00877         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
00878         RNA_def_property_update(prop, 0, "rna_Texture_update");
00879 
00880 }
00881 
00882 static void rna_def_texture_magic(BlenderRNA *brna)
00883 {
00884         StructRNA *srna;
00885         PropertyRNA *prop;
00886 
00887         srna= RNA_def_struct(brna, "MagicTexture", "Texture");
00888         RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
00889         RNA_def_struct_sdna(srna, "Tex");
00890 
00891         prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
00892         RNA_def_property_float_sdna(prop, NULL, "turbul");
00893         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00894         RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
00895         RNA_def_property_ui_text(prop, "Turbulence", "Sets the turbulence of the bandnoise and ringnoise types");
00896         RNA_def_property_update(prop, 0, "rna_Texture_update");
00897 
00898         prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
00899         RNA_def_property_int_sdna(prop, NULL, "noisedepth");
00900         RNA_def_property_range(prop, 0, 30);
00901         RNA_def_property_ui_range(prop, 0, 24, 0, 2);
00902         RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
00903         RNA_def_property_update(prop, 0, "rna_Texture_update");
00904 }
00905 
00906 static void rna_def_texture_blend(BlenderRNA *brna)
00907 {
00908         StructRNA *srna;
00909         PropertyRNA *prop;
00910 
00911         static EnumPropertyItem prop_blend_progression[] = {
00912                 {TEX_LIN, "LINEAR", 0, "Linear", "Creates a linear progression"},
00913                 {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Creates a quadratic progression"},
00914                 {TEX_EASE, "EASING", 0, "Easing", "Creates a progression easing from one step to the next"},
00915                 {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Creates a diagonal progression"},
00916                 {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Creates a spherical progression"},
00917                 {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Creates a quadratic progression in the shape of a sphere"},
00918                 {TEX_RAD, "RADIAL", 0, "Radial", "Creates a radial progression"},
00919                 {0, NULL, 0, NULL, NULL}};
00920 
00921         static const EnumPropertyItem prop_flip_axis_items[]= {
00922                 {0, "HORIZONTAL", 0, "Horizontal", "Flips the texture's X and Y axis"},
00923                 {TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flips the texture's X and Y axis"},
00924                 {0, NULL, 0, NULL, NULL}};
00925 
00926         srna= RNA_def_struct(brna, "BlendTexture", "Texture");
00927         RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
00928         RNA_def_struct_sdna(srna, "Tex");
00929 
00930         prop= RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
00931         RNA_def_property_enum_sdna(prop, NULL, "stype");
00932         RNA_def_property_enum_items(prop, prop_blend_progression);
00933         RNA_def_property_ui_text(prop, "Progression", "Sets the style of the color blending");
00934         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00935 
00936         prop= RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
00937         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00938         RNA_def_property_enum_items(prop, prop_flip_axis_items);
00939         RNA_def_property_ui_text(prop, "Flip Axis", "Flips the texture's X and Y axis");
00940         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
00941 
00942 }
00943 
00944 static void rna_def_texture_stucci(BlenderRNA *brna)
00945 {
00946         StructRNA *srna;
00947         PropertyRNA *prop;
00948 
00949         static EnumPropertyItem prop_stucci_stype[] = {
00950         {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Uses standard stucci"},
00951         {TEX_WALLIN, "WALL_IN", 0, "Wall in", "Creates Dimples"},
00952         {TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Creates Ridges"},
00953         {0, NULL, 0, NULL, NULL}};
00954 
00955         srna= RNA_def_struct(brna, "StucciTexture", "Texture");
00956         RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
00957         RNA_def_struct_sdna(srna, "Tex");
00958 
00959         prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
00960         RNA_def_property_float_sdna(prop, NULL, "turbul");
00961         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00962         RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
00963         RNA_def_property_ui_text(prop, "Turbulence", "Sets the turbulence of the bandnoise and ringnoise types");
00964         RNA_def_property_update(prop, 0, "rna_Texture_update");
00965         
00966         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
00967         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
00968         RNA_def_property_enum_items(prop, prop_noise_basis_items);
00969         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
00970         RNA_def_property_update(prop, 0, "rna_Texture_update");
00971 
00972         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
00973         RNA_def_property_float_sdna(prop, NULL, "noisesize");
00974         RNA_def_property_range(prop, 0.0001, FLT_MAX);
00975         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
00976         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
00977         RNA_def_property_update(prop, 0, "rna_Texture_update");
00978 
00979         prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
00980         RNA_def_property_enum_sdna(prop, NULL, "noisetype");
00981         RNA_def_property_enum_items(prop, prop_noise_type);
00982         RNA_def_property_ui_text(prop, "Noise Type", "");
00983         RNA_def_property_update(prop, 0, "rna_Texture_update");
00984 
00985         prop= RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
00986         RNA_def_property_enum_sdna(prop, NULL, "stype");
00987         RNA_def_property_enum_items(prop, prop_stucci_stype);
00988         RNA_def_property_ui_text(prop, "Pattern", "");
00989         RNA_def_property_update(prop, 0, "rna_Texture_update");
00990 }
00991 
00992 static void rna_def_texture_noise(BlenderRNA *brna)
00993 {
00994         StructRNA *srna;
00995 
00996         srna= RNA_def_struct(brna, "NoiseTexture", "Texture");
00997         RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
00998         RNA_def_struct_sdna(srna, "Tex");
00999 }
01000 
01001 static void rna_def_texture_image(BlenderRNA *brna)
01002 {
01003         StructRNA *srna;
01004         PropertyRNA *prop;
01005 
01006         static EnumPropertyItem prop_image_extension[] = {
01007                 {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"},
01008                 {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"},
01009                 {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube", "Clips to cubic-shaped area around the image and sets exterior pixels as transparent"},
01010                 {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"},
01011                 {TEX_CHECKER, "CHECKER", 0, "Checker", "Causes the image to repeat in checker board pattern"},
01012                 {0, NULL, 0, NULL, NULL}};
01013 
01014         srna= RNA_def_struct(brna, "ImageTexture", "Texture");
01015         RNA_def_struct_ui_text(srna, "Image Texture", "");
01016         RNA_def_struct_sdna(srna, "Tex");
01017 
01018         prop= RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
01019         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
01020         RNA_def_property_ui_text(prop, "Interpolation", "Interpolates pixels using selected filter");
01021         RNA_def_property_update(prop, 0, "rna_Texture_update");
01022 
01023         /* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */
01024         prop= RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
01025         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_IMAROT);
01026         RNA_def_property_ui_text(prop, "Flip Axis", "Flips the texture's X and Y axis");
01027         RNA_def_property_update(prop, 0, "rna_Texture_update");
01028 
01029         prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
01030         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA);
01031         RNA_def_property_ui_text(prop, "Use Alpha", "Uses the alpha channel information in the image");
01032         RNA_def_property_update(prop, 0, "rna_Texture_update");
01033 
01034         prop= RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
01035         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA);
01036         RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculates an alpha channel based on RGB values in the image");
01037         RNA_def_property_update(prop, 0, "rna_Texture_update");
01038 
01039         prop= RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
01040         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA);
01041         RNA_def_property_ui_text(prop, "Invert Alpha", "Inverts all the alpha values in the image");
01042         RNA_def_property_update(prop, 0, "rna_Texture_update");
01043 
01044         rna_def_filter_common(srna);
01045 
01046         prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
01047         RNA_def_property_enum_sdna(prop, NULL, "extend");
01048         RNA_def_property_enum_items(prop, prop_image_extension);
01049         RNA_def_property_ui_text(prop, "Extension", "Sets how the image is extrapolated past its original bounds");
01050         RNA_def_property_update(prop, 0, "rna_Texture_update");
01051 
01052         prop= RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
01053         RNA_def_property_int_sdna(prop, NULL, "xrepeat");
01054         RNA_def_property_range(prop, 1, 512);
01055         RNA_def_property_ui_text(prop, "Repeat X", "Sets a repetition multiplier in the X direction");
01056         RNA_def_property_update(prop, 0, "rna_Texture_update");
01057 
01058         prop= RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
01059         RNA_def_property_int_sdna(prop, NULL, "yrepeat");
01060         RNA_def_property_range(prop, 1, 512);
01061         RNA_def_property_ui_text(prop, "Repeat Y", "Sets a repetition multiplier in the Y direction");
01062         RNA_def_property_update(prop, 0, "rna_Texture_update");
01063 
01064         prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
01065         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_XMIR);
01066         RNA_def_property_ui_text(prop, "Mirror X", "Mirrors the image repetition on the X direction");
01067         RNA_def_property_update(prop, 0, "rna_Texture_update");
01068 
01069         prop= RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
01070         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_YMIR);
01071         RNA_def_property_ui_text(prop, "Mirror Y", "Mirrors the image repetition on the Y direction");
01072         RNA_def_property_update(prop, 0, "rna_Texture_update");
01073 
01074         prop= RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
01075         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_ODD);
01076         RNA_def_property_ui_text(prop, "Checker Odd", "Sets odd checker tiles");
01077         RNA_def_property_update(prop, 0, "rna_Texture_update");
01078 
01079         prop= RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
01080         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_EVEN);
01081         RNA_def_property_ui_text(prop, "Checker Even", "Sets even checker tiles");
01082         RNA_def_property_update(prop, 0, "rna_Texture_update");
01083 
01084         prop= RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
01085         RNA_def_property_float_sdna(prop, NULL, "checkerdist");
01086         RNA_def_property_range(prop, 0.0, 0.99);
01087         RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 0.01);
01088         RNA_def_property_ui_text(prop, "Checker Distance", "Sets distance between checker tiles");
01089         RNA_def_property_update(prop, 0, "rna_Texture_update");
01090 
01091 #if 0
01092 
01093         /* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
01094         perhaps a new subtype could be added? 
01095         --I actually used single values for this, maybe change later with a RNA_Rect thing? */
01096         prop= RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
01097         RNA_def_property_float_sdna(prop, NULL, "cropxmin");
01098         RNA_def_property_array(prop, 4);
01099         RNA_def_property_range(prop, -10, 10);
01100         RNA_def_property_ui_text(prop, "Crop Rectangle", "");
01101         RNA_def_property_update(prop, 0, "rna_Texture_update");
01102 
01103 #endif
01104 
01105         prop= RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
01106         RNA_def_property_float_sdna(prop, NULL, "cropxmin");
01107         RNA_def_property_range(prop, -10.0, 10.0);
01108         RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
01109         RNA_def_property_ui_text(prop, "Crop Minimum X", "Sets minimum X value to crop the image");
01110         RNA_def_property_update(prop, 0, "rna_Texture_update");
01111 
01112         prop= RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
01113         RNA_def_property_float_sdna(prop, NULL, "cropymin");
01114         RNA_def_property_range(prop, -10.0, 10.0);
01115         RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
01116         RNA_def_property_ui_text(prop, "Crop Minimum Y", "Sets minimum Y value to crop the image");
01117         RNA_def_property_update(prop, 0, "rna_Texture_update");
01118 
01119         prop= RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
01120         RNA_def_property_float_sdna(prop, NULL, "cropxmax");
01121         RNA_def_property_range(prop, -10.0, 10.0);
01122         RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
01123         RNA_def_property_ui_text(prop, "Crop Maximum X", "Sets maximum X value to crop the image");
01124         RNA_def_property_update(prop, 0, "rna_Texture_update");
01125 
01126         prop= RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
01127         RNA_def_property_float_sdna(prop, NULL, "cropymax");
01128         RNA_def_property_range(prop, -10.0, 10.0);
01129         RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
01130         RNA_def_property_ui_text(prop, "Crop Maximum Y", "Sets maximum Y value to crop the image");
01131         RNA_def_property_update(prop, 0, "rna_Texture_update");
01132 
01133         prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
01134         RNA_def_property_pointer_sdna(prop, NULL, "ima");
01135         RNA_def_property_struct_type(prop, "Image");
01136         RNA_def_property_flag(prop, PROP_EDITABLE);
01137         RNA_def_property_ui_text(prop, "Image", "");
01138         RNA_def_property_update(prop, 0, "rna_Texture_update");
01139 
01140         prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
01141         RNA_def_property_pointer_sdna(prop, NULL, "iuser");
01142         RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
01143         RNA_def_property_update(prop, 0, "rna_Texture_update");
01144 
01145         /* Normal Map */
01146         prop= RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
01147         RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
01148         RNA_def_property_ui_text(prop, "Normal Map", "Uses image RGB values for normal mapping");
01149         RNA_def_property_update(prop, 0, "rna_Texture_update");
01150 }
01151 
01152 static void rna_def_texture_plugin(BlenderRNA *brna)
01153 {
01154         StructRNA *srna;
01155 
01156         srna= RNA_def_struct(brna, "PluginTexture", "Texture");
01157         RNA_def_struct_ui_text(srna, "Plugin", "External plugin texture");
01158         RNA_def_struct_sdna(srna, "Tex");
01159 
01160         /* XXX: todo */
01161 }
01162 
01163 static void rna_def_texture_environment_map(BlenderRNA *brna)
01164 {
01165         StructRNA *srna;
01166         PropertyRNA *prop;
01167 
01168         srna= RNA_def_struct(brna, "EnvironmentMapTexture", "Texture");
01169         RNA_def_struct_ui_text(srna, "Environment Map", "Environment map texture");
01170         RNA_def_struct_sdna(srna, "Tex");
01171 
01172         prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
01173         RNA_def_property_pointer_sdna(prop, NULL, "ima");
01174         RNA_def_property_struct_type(prop, "Image");
01175         RNA_def_property_flag(prop, PROP_EDITABLE);
01176         RNA_def_property_ui_text(prop, "Image", "Source image file to read the environment map from");
01177         RNA_def_property_update(prop, 0, "rna_Texture_update");
01178         
01179         prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
01180         RNA_def_property_pointer_sdna(prop, NULL, "iuser");
01181         RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
01182         RNA_def_property_update(prop, 0, "rna_Texture_update");
01183 
01184         rna_def_filter_common(srna);
01185         
01186         prop= RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE);
01187         RNA_def_property_pointer_sdna(prop, NULL, "env");
01188         RNA_def_property_struct_type(prop, "EnvironmentMap");
01189         RNA_def_property_ui_text(prop, "Environment Map", "Gets the environment map associated with this texture");
01190         RNA_def_property_update(prop, 0, "rna_Texture_update");
01191 }
01192 
01193 static void rna_def_texture_musgrave(BlenderRNA *brna)
01194 {
01195         StructRNA *srna;
01196         PropertyRNA *prop;
01197 
01198         static EnumPropertyItem prop_musgrave_type[] = {
01199                 {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Fractal noise algorithm. Multifractal: Uses Perlin noise as a basis"},
01200                 {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", "Fractal noise algorithm. Ridged Multifractal: Uses Perlin noise with inflection as a basis"},
01201                 {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", "Fractal noise algorithm.Hybrid Multifractal: Uses Perlin noise as a basis, with extended controls"},
01202                 {TEX_FBM, "FBM", 0, "fBM", "Fractal noise algorithm. Fractal Brownian Motion: Uses Brownian noise as a basis"},
01203                 {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Fractal noise algorithm. Hetero Terrain: similar to multifractal"},
01204                 {0, NULL, 0, NULL, NULL}};
01205 
01206         srna= RNA_def_struct(brna, "MusgraveTexture", "Texture");
01207         RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
01208         RNA_def_struct_sdna(srna, "Tex");
01209 
01210         prop= RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
01211         RNA_def_property_enum_sdna(prop, NULL, "stype");
01212         RNA_def_property_enum_items(prop, prop_musgrave_type);
01213         RNA_def_property_ui_text(prop, "Type", "");
01214         RNA_def_property_update(prop, 0, "rna_Texture_update");
01215 
01216         prop= RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
01217         RNA_def_property_float_sdna(prop, NULL, "mg_H");
01218         RNA_def_property_range(prop, 0.0001, 2);
01219         RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
01220         RNA_def_property_update(prop, 0, "rna_Texture_update");
01221 
01222         prop= RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
01223         RNA_def_property_float_sdna(prop, NULL, "mg_lacunarity");
01224         RNA_def_property_range(prop, 0, 6);
01225         RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
01226         RNA_def_property_update(prop, 0, "rna_Texture_update");
01227 
01228         prop= RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
01229         RNA_def_property_float_sdna(prop, NULL, "mg_octaves");
01230         RNA_def_property_range(prop, 0, 8);
01231         RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
01232         RNA_def_property_update(prop, 0, "rna_Texture_update");
01233 
01234         prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
01235         RNA_def_property_float_sdna(prop, NULL, "mg_offset");
01236         RNA_def_property_range(prop, 0, 6);
01237         RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
01238         RNA_def_property_update(prop, 0, "rna_Texture_update");
01239 
01240         prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
01241         RNA_def_property_float_sdna(prop, NULL, "mg_gain");
01242         RNA_def_property_range(prop, 0, 6);
01243         RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
01244         RNA_def_property_update(prop, 0, "rna_Texture_update");
01245 
01246         prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
01247         RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
01248         RNA_def_property_range(prop, 0, 10);
01249         RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
01250         RNA_def_property_update(prop, 0, "rna_Texture_update");
01251 
01252         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
01253         RNA_def_property_float_sdna(prop, NULL, "noisesize");
01254         RNA_def_property_range(prop, 0.0001, FLT_MAX);
01255         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
01256         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
01257         RNA_def_property_update(prop, 0, "rna_Texture_update");
01258 
01259         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
01260         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
01261         RNA_def_property_enum_items(prop, prop_noise_basis_items);
01262         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
01263         RNA_def_property_update(prop, 0, "rna_Texture_update");
01264 
01265         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
01266         RNA_def_property_range(prop, 0.001, 0.1);
01267         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
01268         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
01269         RNA_def_property_update(prop, 0, "rna_Texture_update");
01270 }
01271 
01272 static void rna_def_texture_voronoi(BlenderRNA *brna)
01273 {
01274         StructRNA *srna;
01275         PropertyRNA *prop;
01276 
01277         static EnumPropertyItem prop_distance_metric_items[] = {
01278                 {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "Algorithm used to calculate distance of sample points to feature points. Actual Distance: sqrt(x*x+y*y+z*z)"},
01279                 {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "Algorithm used to calculate distance of sample points to feature points. Distance squared: (x*x+y*y+z*z)"},
01280                 {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Algorithm used to calculate distance of sample points to feature points. Manhattan: The length of the distance in axial directions"},
01281                 {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Algorithm used to calculate distance of sample points to feature points. Chebychev: The length of the longest Axial journey"},
01282                 {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", "Algorithm used to calculate distance of sample points to feature points. Minovsky 1/2: Sets Minkovsky variable to 0.5"},
01283                 {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4", "Algorithm used to calculate distance of sample points to feature points. Minkovsky 4: Sets Minkovsky variable to 4"},
01284                 {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", "Algorithm used to calculate distance of sample points to feature points. Minkovsky: Uses the Minkowsky function to calculate distance. Exponent value determines the shape of the boundaries"},
01285                 {0, NULL, 0, NULL, NULL}};
01286 
01287         static EnumPropertyItem prop_coloring_items[] = {
01288                 /* XXX: OK names / descriptions? */
01289                 {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
01290                 {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"},
01291                 {TEX_COL2, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F.1"},
01292                 {TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity", "Multiply position and outline by intensity"},
01293                 {0, NULL, 0, NULL, NULL}};
01294 
01295         srna= RNA_def_struct(brna, "VoronoiTexture", "Texture");
01296         RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
01297         RNA_def_struct_sdna(srna, "Tex");
01298 
01299         prop= RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
01300         RNA_def_property_float_sdna(prop, NULL, "vn_w1");
01301         RNA_def_property_range(prop, -2, 2);
01302         RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
01303         RNA_def_property_update(prop, 0, "rna_Texture_update");
01304         
01305         prop= RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
01306         RNA_def_property_float_sdna(prop, NULL, "vn_w2");
01307         RNA_def_property_range(prop, -2, 2);
01308         RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
01309         RNA_def_property_update(prop, 0, "rna_Texture_update");
01310         
01311         prop= RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
01312         RNA_def_property_float_sdna(prop, NULL, "vn_w3");
01313         RNA_def_property_range(prop, -2, 2);
01314         RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
01315         RNA_def_property_update(prop, 0, "rna_Texture_update");
01316         
01317         prop= RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
01318         RNA_def_property_float_sdna(prop, NULL, "vn_w4");
01319         RNA_def_property_range(prop, -2, 2);
01320         RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
01321         RNA_def_property_update(prop, 0, "rna_Texture_update");
01322 
01323         prop= RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
01324         RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
01325         RNA_def_property_range(prop, 0.01, 10);
01326         RNA_def_property_ui_text(prop, "Minkovsky Exponent", "Minkovsky exponent");
01327         RNA_def_property_update(prop, 0, "rna_Texture_update");
01328 
01329         prop= RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
01330         RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
01331         RNA_def_property_enum_items(prop, prop_distance_metric_items);
01332         RNA_def_property_ui_text(prop, "Distance Metric", "");
01333         RNA_def_property_update(prop, 0, "rna_Texture_update");
01334 
01335         prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
01336         RNA_def_property_enum_sdna(prop, NULL, "vn_coltype");
01337         RNA_def_property_enum_items(prop, prop_coloring_items);
01338         RNA_def_property_ui_text(prop, "Coloring", "");
01339         RNA_def_property_update(prop, 0, "rna_Texture_update");
01340 
01341         prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
01342         RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
01343         RNA_def_property_range(prop, 0.01, 10);
01344         RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
01345         RNA_def_property_update(prop, 0, "rna_Texture_update");
01346 
01347         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
01348         RNA_def_property_float_sdna(prop, NULL, "noisesize");
01349         RNA_def_property_range(prop, 0.0001, FLT_MAX);
01350         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
01351         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
01352         RNA_def_property_update(prop, 0, "rna_Texture_update");
01353 
01354         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
01355         RNA_def_property_range(prop, 0.001, 0.1);
01356         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
01357         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
01358         RNA_def_property_update(prop, 0, "rna_Texture_update");
01359 }
01360 
01361 static void rna_def_texture_distorted_noise(BlenderRNA *brna)
01362 {
01363         StructRNA *srna;
01364         PropertyRNA *prop;
01365 
01366         srna= RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
01367         RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
01368         RNA_def_struct_sdna(srna, "Tex");
01369 
01370         prop= RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
01371         RNA_def_property_float_sdna(prop, NULL, "dist_amount");
01372         RNA_def_property_range(prop, 0, 10);
01373         RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
01374         RNA_def_property_update(prop, 0, "rna_Texture_update");
01375 
01376         prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
01377         RNA_def_property_float_sdna(prop, NULL, "noisesize");
01378         RNA_def_property_range(prop, 0.0001, FLT_MAX);
01379         RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
01380         RNA_def_property_ui_text(prop, "Noise Size", "Sets scaling for noise input");
01381         RNA_def_property_update(prop, 0, "rna_Texture_update");
01382 
01383         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
01384         RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
01385         RNA_def_property_enum_items(prop, prop_noise_basis_items);
01386         RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence");
01387         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
01388 
01389         prop= RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
01390         RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
01391         RNA_def_property_enum_items(prop, prop_noise_basis_items);
01392         RNA_def_property_ui_text(prop, "Noise Distortion", "Sets the noise basis for the distortion");
01393         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
01394 
01395         prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
01396         RNA_def_property_range(prop, 0.001, 0.1);
01397         RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
01398         RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
01399         RNA_def_property_update(prop, 0, "rna_Texture_update");
01400 }
01401 
01402 static void rna_def_texture_pointdensity(BlenderRNA *brna)
01403 {
01404         StructRNA *srna;
01405         PropertyRNA *prop;
01406         
01407         static EnumPropertyItem point_source_items[] = {
01408                 {TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"},
01409                 {TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"},
01410                 //{TEX_PD_FILE, "FILE", 0 , "File", ""},
01411                 {0, NULL, 0, NULL, NULL}};
01412         
01413         static EnumPropertyItem particle_cache_items[] = {
01414                 {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Emit Object Location", ""},
01415                 {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Emit Object Space", ""},
01416                 {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""},
01417                 {0, NULL, 0, NULL, NULL}};
01418                 
01419         static EnumPropertyItem vertice_cache_items[] = {
01420                 {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Object Location", ""},
01421                 {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Object Space", ""},
01422                 {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""},
01423                 {0, NULL, 0, NULL, NULL}};
01424 
01425         static EnumPropertyItem falloff_items[] = {
01426                 {TEX_PD_FALLOFF_STD, "STANDARD", 0, "Standard", ""},
01427                 {TEX_PD_FALLOFF_SMOOTH, "SMOOTH", 0, "Smooth", ""},
01428                 {TEX_PD_FALLOFF_SOFT, "SOFT", 0, "Soft", ""},
01429                 {TEX_PD_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", "Density is constant within lookup radius"},
01430                 {TEX_PD_FALLOFF_ROOT, "ROOT", 0, "Root", ""},
01431                 {TEX_PD_FALLOFF_PARTICLE_AGE, "PARTICLE_AGE", 0, "Particle Age", ""},
01432                 {TEX_PD_FALLOFF_PARTICLE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", ""},
01433                 {0, NULL, 0, NULL, NULL}};
01434         
01435         static EnumPropertyItem color_source_items[] = {
01436                 {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""},
01437                 {TEX_PD_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", "Lifetime mapped as 0.0 - 1.0 intensity"},
01438                 {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"},
01439                 {TEX_PD_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "XYZ velocity mapped to RGB colors"},
01440                 {0, NULL, 0, NULL, NULL}};
01441         
01442         static EnumPropertyItem turbulence_influence_items[] = {
01443                 {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"},
01444                 {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "Turbulent noise driven by particle velocity"},
01445                 {TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age", "Turbulent noise driven by the particle's age between birth and death"},
01446                 {TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"},
01447                 {0, NULL, 0, NULL, NULL}};
01448         
01449         srna= RNA_def_struct(brna, "PointDensity", NULL);
01450         RNA_def_struct_sdna(srna, "PointDensity");
01451         RNA_def_struct_ui_text(srna, "PointDensity", "Point density settings");
01452         RNA_def_struct_path_func(srna, "rna_PointDensity_path");
01453         
01454         prop= RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
01455         RNA_def_property_enum_sdna(prop, NULL, "source");
01456         RNA_def_property_enum_items(prop, point_source_items);
01457         RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
01458         RNA_def_property_update(prop, 0, "rna_Texture_update");
01459         
01460         prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
01461         RNA_def_property_pointer_sdna(prop, NULL, "object");
01462         RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
01463         RNA_def_property_flag(prop, PROP_EDITABLE);
01464         RNA_def_property_update(prop, 0, "rna_Texture_update");
01465         
01466         prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
01467         RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
01468         RNA_def_property_struct_type(prop, "ParticleSystem");
01469         RNA_def_property_pointer_funcs(prop, "rna_PointDensity_psys_get", "rna_PointDensity_psys_set", NULL, NULL);
01470         RNA_def_property_flag(prop, PROP_EDITABLE);
01471         RNA_def_property_update(prop, 0, "rna_Texture_update");
01472         
01473         prop= RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE);
01474         RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space");
01475         RNA_def_property_enum_items(prop, particle_cache_items);
01476         RNA_def_property_ui_text(prop, "Particle Cache", "Co-ordinate system to cache particles in");
01477         RNA_def_property_update(prop, 0, "rna_Texture_update");
01478         
01479         prop= RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE);
01480         RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space");
01481         RNA_def_property_enum_items(prop, vertice_cache_items);
01482         RNA_def_property_ui_text(prop, "Vertices Cache", "Co-ordinate system to cache vertices in");
01483         RNA_def_property_update(prop, 0, "rna_Texture_update");
01484         
01485         prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
01486         RNA_def_property_float_sdna(prop, NULL, "radius");
01487         RNA_def_property_range(prop, 0.001, FLT_MAX);
01488         RNA_def_property_ui_text(prop, "Radius", "Radius from the shaded sample to look for points within");
01489         RNA_def_property_update(prop, 0, "rna_Texture_update");
01490         
01491         prop= RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
01492         RNA_def_property_enum_sdna(prop, NULL, "falloff_type");
01493         RNA_def_property_enum_items(prop, falloff_items);
01494         RNA_def_property_ui_text(prop, "Falloff", "Method of attenuating density by distance from the point");
01495         RNA_def_property_update(prop, 0, "rna_Texture_update");
01496         
01497         prop= RNA_def_property(srna, "falloff_soft", PROP_FLOAT, PROP_NONE);
01498         RNA_def_property_float_sdna(prop, NULL, "falloff_softness");
01499         RNA_def_property_range(prop, 0.01, FLT_MAX);
01500         RNA_def_property_ui_text(prop, "Softness", "Softness of the 'soft' falloff option");
01501         RNA_def_property_update(prop, 0, "rna_Texture_update");
01502         
01503         prop= RNA_def_property(srna, "color_source", PROP_ENUM, PROP_NONE);
01504         RNA_def_property_enum_sdna(prop, NULL, "color_source");
01505         RNA_def_property_enum_items(prop, color_source_items);
01506         RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
01507         RNA_def_property_update(prop, 0, "rna_Texture_update");
01508         
01509         prop= RNA_def_property(srna, "speed_scale", PROP_FLOAT, PROP_NONE);
01510         RNA_def_property_float_sdna(prop, NULL, "speed_scale");
01511         RNA_def_property_range(prop, 0.001, 100.0);
01512         RNA_def_property_ui_text(prop, "Scale", "Multiplier to bring particle speed within an acceptable range");
01513         RNA_def_property_update(prop, 0, "rna_Texture_update");
01514         
01515         prop= RNA_def_property(srna, "falloff_speed_scale", PROP_FLOAT, PROP_NONE);
01516         RNA_def_property_float_sdna(prop, NULL, "falloff_speed_scale");
01517         RNA_def_property_range(prop, 0.001, 100.0);
01518         RNA_def_property_ui_text(prop, "Velocity Scale", "Multiplier to bring particle speed within an acceptable range");
01519         RNA_def_property_update(prop, 0, "rna_Texture_update");
01520 
01521         
01522         prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
01523         RNA_def_property_pointer_sdna(prop, NULL, "coba");
01524         RNA_def_property_struct_type(prop, "ColorRamp");
01525         RNA_def_property_ui_text(prop, "Color Ramp", "");
01526         RNA_def_property_update(prop, 0, "rna_Texture_update");
01527 
01528         prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NEVER_NULL);
01529         RNA_def_property_pointer_sdna(prop, NULL, "falloff_curve");
01530         RNA_def_property_struct_type(prop, "CurveMapping");
01531         RNA_def_property_ui_text(prop, "Falloff Curve", "");
01532         RNA_def_property_update(prop, 0, "rna_Texture_update");
01533         
01534         prop= RNA_def_property(srna, "use_falloff_curve", PROP_BOOLEAN, PROP_NONE);
01535         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_FALLOFF_CURVE);
01536         RNA_def_property_ui_text(prop, "Falloff Curve", "Use a custom falloff curve");
01537         RNA_def_property_update(prop, 0, "rna_Texture_update");
01538 
01539         /* Turbulence */
01540         prop= RNA_def_property(srna, "use_turbulence", PROP_BOOLEAN, PROP_NONE);
01541         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_TURBULENCE);
01542         RNA_def_property_ui_text(prop, "Turbulence", "Add directed noise to the density at render-time");
01543         RNA_def_property_update(prop, 0, "rna_Texture_update");
01544         
01545         prop= RNA_def_property(srna, "turbulence_scale", PROP_FLOAT, PROP_NONE);
01546         RNA_def_property_float_sdna(prop, NULL, "noise_size");
01547         RNA_def_property_range(prop, 0.01, FLT_MAX);
01548         RNA_def_property_ui_text(prop, "Size", "Scale of the added turbulent noise");
01549         RNA_def_property_update(prop, 0, "rna_Texture_update");
01550         
01551         prop= RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE);
01552         RNA_def_property_float_sdna(prop, NULL, "noise_fac");
01553         RNA_def_property_range(prop, 0.01, FLT_MAX);
01554         RNA_def_property_update(prop, 0, "rna_Texture_update");
01555         
01556         prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
01557         RNA_def_property_int_sdna(prop, NULL, "noise_depth");
01558         RNA_def_property_range(prop, 0, 30);
01559         RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
01560         RNA_def_property_update(prop, 0, "rna_Texture_update");
01561         
01562         prop= RNA_def_property(srna, "turbulence_influence", PROP_ENUM, PROP_NONE);
01563         RNA_def_property_enum_sdna(prop, NULL, "noise_influence");
01564         RNA_def_property_enum_items(prop, turbulence_influence_items);
01565         RNA_def_property_ui_text(prop, "Turbulence Influence", "Method for driving added turbulent noise");
01566         RNA_def_property_update(prop, 0, "rna_Texture_update");
01567         
01568         prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
01569         RNA_def_property_enum_sdna(prop, NULL, "noise_basis");
01570         RNA_def_property_enum_items(prop, prop_noise_basis_items);
01571         RNA_def_property_ui_text(prop, "Noise Basis", "Noise formula used for turbulence");
01572         RNA_def_property_update(prop, 0, "rna_Texture_update");
01573 
01574 
01575         srna= RNA_def_struct(brna, "PointDensityTexture", "Texture");
01576         RNA_def_struct_sdna(srna, "Tex");
01577         RNA_def_struct_ui_text(srna, "Point Density", "Settings for the Point Density texture");
01578         
01579         prop= RNA_def_property(srna, "point_density", PROP_POINTER, PROP_NONE);
01580         RNA_def_property_pointer_sdna(prop, NULL, "pd");
01581         RNA_def_property_struct_type(prop, "PointDensity");
01582         RNA_def_property_ui_text(prop, "Point Density", "The point density settings associated with this texture");
01583         RNA_def_property_update(prop, 0, "rna_Texture_update");
01584 }
01585 
01586 static void rna_def_texture_voxeldata(BlenderRNA *brna)
01587 {
01588         StructRNA *srna;
01589         PropertyRNA *prop;
01590         
01591         static EnumPropertyItem interpolation_type_items[] = {
01592                 {TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor", "No interpolation, fast but blocky and low quality"},
01593                 {TEX_VD_LINEAR, "TRILINEAR", 0, "Linear", "Good smoothness and speed"},
01594                 {TEX_VD_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Mid-range quality and speed"},
01595                 {TEX_VD_TRICUBIC_CATROM, "TRICUBIC_CATROM", 0, "Cubic Catmull-Rom", "High quality interpolation, but slower"},
01596                 {TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline", "Smoothed high quality interpolation, but slower"},
01597                 {0, NULL, 0, NULL, NULL}};
01598 
01599         static EnumPropertyItem file_format_items[] = {
01600                 {TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"},
01601                 {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit greyscale binary data"},
01602                 //{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""},
01603                 {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence", "Generate voxels from a sequence of image slices"},
01604                 {TEX_VD_SMOKE, "SMOKE", 0, "Smoke", "Render voxels from a Blender smoke simulation"},
01605                 {0, NULL, 0, NULL, NULL}};
01606         
01607         static EnumPropertyItem voxeldata_extension[] = {
01608                 {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"},
01609                 {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"},
01610                 {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"},
01611                 {0, NULL, 0, NULL, NULL}};
01612 
01613         static EnumPropertyItem smoked_type_items[] = {
01614                 {TEX_VD_SMOKEDENSITY, "SMOKEDENSITY", 0, "Density", "Use smoke density as texture data"},
01615                 {TEX_VD_SMOKEHEAT, "SMOKEHEAT", 0, "Heat", "Use smoke heat as texture data. Values from -2.0 to 2.0 are used"},
01616                 {TEX_VD_SMOKEVEL, "SMOKEVEL", 0, "Velocity", "Use smoke velocity as texture data"},
01617                 {0, NULL, 0, NULL, NULL}};
01618 
01619         srna= RNA_def_struct(brna, "VoxelData", NULL);
01620         RNA_def_struct_sdna(srna, "VoxelData");
01621         RNA_def_struct_ui_text(srna, "VoxelData", "Voxel data settings");
01622         RNA_def_struct_path_func(srna, "rna_VoxelData_path");
01623         
01624         prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
01625         RNA_def_property_enum_sdna(prop, NULL, "interp_type");
01626         RNA_def_property_enum_items(prop, interpolation_type_items);
01627         RNA_def_property_ui_text(prop, "Interpolation", "Method to interpolate/smooth values between voxel cells");
01628         RNA_def_property_update(prop, 0, "rna_Texture_update");
01629 
01630         prop= RNA_def_property(srna, "smoke_data_type", PROP_ENUM, PROP_NONE);
01631         RNA_def_property_enum_sdna(prop, NULL, "smoked_type");
01632         RNA_def_property_enum_items(prop, smoked_type_items);
01633         RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
01634         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01635         
01636         prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
01637         RNA_def_property_enum_sdna(prop, NULL, "extend");
01638         RNA_def_property_enum_items(prop, voxeldata_extension);
01639         RNA_def_property_ui_text(prop, "Extension", "Sets how the texture is extrapolated past its original bounds");
01640         RNA_def_property_update(prop, 0, "rna_Texture_update");
01641         
01642         prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
01643         RNA_def_property_float_sdna(prop, NULL, "int_multiplier");
01644         RNA_def_property_range(prop, 0.01, FLT_MAX);
01645         RNA_def_property_ui_text(prop, "Intensity", "Multiplier for intensity values");
01646         RNA_def_property_update(prop, 0, "rna_Texture_update");
01647         
01648         prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
01649         RNA_def_property_enum_sdna(prop, NULL, "file_format");
01650         RNA_def_property_enum_items(prop, file_format_items);
01651         RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render  ");
01652         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01653         
01654         prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
01655         RNA_def_property_string_sdna(prop, NULL, "source_path");
01656         RNA_def_property_ui_text(prop, "Source Path", "The external source data file to use");
01657         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01658         
01659         prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
01660         RNA_def_property_int_sdna(prop, NULL, "resol");
01661         RNA_def_property_range(prop, 1, 100000);
01662         RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid");
01663         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01664         
01665         prop= RNA_def_property(srna, "use_still_frame", PROP_BOOLEAN, PROP_NONE);
01666         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_VD_STILL);
01667         RNA_def_property_ui_text(prop, "Still Frame Only", "Always render a still frame from the voxel data sequence");
01668         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01669         
01670         prop= RNA_def_property(srna, "still_frame", PROP_INT, PROP_NONE);
01671         RNA_def_property_int_sdna(prop, NULL, "still_frame");
01672         RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
01673         RNA_def_property_ui_text(prop, "Still Frame Number", "The frame number to always use");
01674         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01675         
01676         prop= RNA_def_property(srna, "domain_object", PROP_POINTER, PROP_NONE);
01677         RNA_def_property_pointer_sdna(prop, NULL, "object");
01678         RNA_def_property_ui_text(prop, "Domain Object", "Object used as the smoke simulation domain");
01679         RNA_def_property_flag(prop, PROP_EDITABLE);
01680         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01681 
01682         
01683         srna= RNA_def_struct(brna, "VoxelDataTexture", "Texture");
01684         RNA_def_struct_sdna(srna, "Tex");
01685         RNA_def_struct_ui_text(srna, "Voxel Data", "Settings for the Voxel Data texture");
01686         
01687         prop= RNA_def_property(srna, "voxel_data", PROP_POINTER, PROP_NONE);
01688         RNA_def_property_pointer_sdna(prop, NULL, "vd");
01689         RNA_def_property_struct_type(prop, "VoxelData");
01690         RNA_def_property_ui_text(prop, "Voxel Data", "The voxel data associated with this texture");
01691         RNA_def_property_update(prop, 0, "rna_Texture_update");
01692         
01693         prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
01694         RNA_def_property_pointer_sdna(prop, NULL, "ima");
01695         RNA_def_property_struct_type(prop, "Image");
01696         RNA_def_property_flag(prop, PROP_EDITABLE);
01697         RNA_def_property_ui_text(prop, "Image", "");
01698         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_image_update");
01699         
01700         prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
01701         RNA_def_property_pointer_sdna(prop, NULL, "iuser");
01702         RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
01703         RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
01704 }
01705 
01706 static void rna_def_texture(BlenderRNA *brna)
01707 {
01708         StructRNA *srna;
01709         PropertyRNA *prop;
01710 
01711         srna= RNA_def_struct(brna, "Texture", "ID");
01712         RNA_def_struct_sdna(srna, "Tex");
01713         RNA_def_struct_ui_text(srna, "Texture", "Texture datablock used by materials, lamps, worlds and brushes");
01714         RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
01715         RNA_def_struct_refine_func(srna, "rna_Texture_refine");
01716 
01717         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
01718         //RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01719         RNA_def_property_enum_sdna(prop, NULL, "type");
01720         RNA_def_property_enum_items(prop, texture_type_items);
01721         RNA_def_property_enum_funcs(prop, NULL, "rna_Texture_type_set", NULL);
01722         RNA_def_property_ui_text(prop, "Type", "");
01723         RNA_def_property_update(prop, 0, "rna_Texture_update");
01724         
01725         prop= RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
01726         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
01727         RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
01728         RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
01729         RNA_def_property_update(prop, 0, "rna_Texture_update");
01730 
01731         prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
01732         RNA_def_property_pointer_sdna(prop, NULL, "coba");
01733         RNA_def_property_struct_type(prop, "ColorRamp");
01734         RNA_def_property_ui_text(prop, "Color Ramp", "");
01735         RNA_def_property_update(prop, 0, "rna_Texture_update");
01736 
01737         prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
01738         RNA_def_property_float_sdna(prop, NULL, "bright");
01739         RNA_def_property_range(prop, 0, 2);
01740         RNA_def_property_ui_text(prop, "Brightness", "Adjusts the brightness of the texture");
01741         RNA_def_property_update(prop, 0, "rna_Texture_update");
01742 
01743         prop= RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
01744         RNA_def_property_range(prop, 0.01, 5);
01745         RNA_def_property_ui_text(prop, "Contrast", "Adjusts the contrast of the texture");
01746         RNA_def_property_update(prop, 0, "rna_Texture_update");
01747 
01748         prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
01749         RNA_def_property_range(prop, 0, 2);
01750         RNA_def_property_ui_text(prop, "Saturation", "Adjusts the saturation of colors in the texture");
01751         RNA_def_property_update(prop, 0, "rna_Texture_update");
01752         
01753         /* RGB Factor */
01754         prop= RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
01755         RNA_def_property_float_sdna(prop, NULL, "rfac");
01756         RNA_def_property_range(prop, 0, 2);
01757         RNA_def_property_ui_text(prop, "Factor Red", "");
01758         RNA_def_property_update(prop, 0, "rna_Texture_update");
01759         
01760         prop= RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
01761         RNA_def_property_float_sdna(prop, NULL, "gfac");
01762         RNA_def_property_range(prop, 0, 2);
01763         RNA_def_property_ui_text(prop, "Factor Green", "");
01764         RNA_def_property_update(prop, 0, "rna_Texture_update");
01765         
01766         prop= RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
01767         RNA_def_property_float_sdna(prop, NULL, "bfac");
01768         RNA_def_property_range(prop, 0, 2);
01769         RNA_def_property_ui_text(prop, "Factor Blue", "");
01770         RNA_def_property_update(prop, 0, "rna_Texture_update");
01771         
01772         /* Alpha for preview render */
01773         prop= RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
01774         RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PRV_ALPHA);
01775         RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
01776         RNA_def_property_update(prop, 0, "rna_Texture_update");
01777         
01778         /* nodetree */
01779         prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
01780         RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
01781         RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_nodes_set");
01782         RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
01783         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
01784         
01785         prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
01786         RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
01787         RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
01788         RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
01789         
01790         rna_def_animdata_common(srna);
01791 
01792         /* specific types */
01793         rna_def_texture_clouds(brna);
01794         rna_def_texture_wood(brna);
01795         rna_def_texture_marble(brna);
01796         rna_def_texture_magic(brna);
01797         rna_def_texture_blend(brna);
01798         rna_def_texture_stucci(brna);
01799         rna_def_texture_noise(brna);
01800         rna_def_texture_image(brna);
01801         rna_def_texture_plugin(brna);
01802         rna_def_texture_environment_map(brna);
01803         rna_def_texture_musgrave(brna);
01804         rna_def_texture_voronoi(brna);
01805         rna_def_texture_distorted_noise(brna);
01806         rna_def_texture_pointdensity(brna);
01807         rna_def_texture_voxeldata(brna);
01808         /* XXX add more types here .. */
01809 }
01810 
01811 void RNA_def_texture(BlenderRNA *brna)
01812 {
01813         rna_def_texture(brna);
01814         rna_def_mtex(brna);
01815         rna_def_environment_map(brna);
01816         rna_def_texmapping(brna);
01817 }
01818 
01819 #endif