2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008).
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_texture.c
31 #include "DNA_brush_types.h"
32 #include "DNA_lamp_types.h"
33 #include "DNA_material_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_texture_types.h"
36 #include "DNA_world_types.h"
37 #include "DNA_node_types.h"
38 #include "DNA_particle_types.h"
39 #include "DNA_scene_types.h" /* MAXFRAME only */
41 #include "BLI_utildefines.h"
44 #include "BKE_paint.h"
46 #include "RNA_define.h"
47 #include "RNA_enum_types.h"
49 #include "rna_internal.h"
55 static EnumPropertyItem texture_filter_items[] = {
56 {TXF_BOX, "BOX", 0, "Box", ""},
57 {TXF_EWA, "EWA", 0, "EWA", ""},
58 {TXF_FELINE, "FELINE", 0, "FELINE", ""},
59 {TXF_AREA, "AREA", 0, "Area", ""},
60 {0, NULL, 0, NULL, NULL}
64 EnumPropertyItem rna_enum_texture_type_items[] = {
65 {0, "NONE", 0, "None", ""},
66 {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"},
67 {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - create a cloud-like fractal noise texture"},
68 {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE,
69 "Distorted Noise", "Procedural - noise texture distorted by two noise algorithms"},
70 {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA,
71 "Environment Map", "Create a render of the environment mapped to a texture"},
72 {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allow for images or movies to be used as textures"},
73 {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", "Procedural - color texture based on trigonometric functions"},
74 {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", "Procedural - marble-like noise texture with wave generated bands"},
75 {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - highly flexible fractal noise texture"},
76 {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise",
77 "Procedural - random noise, gives a different result every time, for every frame, for every pixel"},
78 {TEX_OCEAN, "OCEAN", ICON_TEXTURE, "Ocean", "Use a texture generated by an Ocean modifier"},
79 {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""},
80 {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
81 {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"},
82 {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Create a 3D texture based on volumetric data"},
83 {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - wave generated bands or rings, with optional noise"},
84 {0, NULL, 0, NULL, NULL}
88 static EnumPropertyItem blend_type_items[] = {
89 {MTEX_BLEND, "MIX", 0, "Mix", ""},
90 {MTEX_ADD, "ADD", 0, "Add", ""},
91 {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""},
92 {MTEX_MUL, "MULTIPLY", 0, "Multiply", ""},
93 {MTEX_SCREEN, "SCREEN", 0, "Screen", ""},
94 {MTEX_OVERLAY, "OVERLAY", 0, "Overlay", ""},
95 {MTEX_DIFF, "DIFFERENCE", 0, "Difference", ""},
96 {MTEX_DIV, "DIVIDE", 0, "Divide", ""},
97 {MTEX_DARK, "DARKEN", 0, "Darken", ""},
98 {MTEX_LIGHT, "LIGHTEN", 0, "Lighten", ""},
99 {MTEX_BLEND_HUE, "HUE", 0, "Hue", ""},
100 {MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
101 {MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
102 {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
103 {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
104 {MTEX_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
105 {0, NULL, 0, NULL, NULL}
111 #include "MEM_guardedalloc.h"
113 #include "RNA_access.h"
115 #include "BKE_context.h"
116 #include "BKE_image.h"
117 #include "BKE_texture.h"
118 #include "BKE_main.h"
120 #include "DEG_depsgraph.h"
123 #include "ED_render.h"
125 static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
127 Tex *tex = (Tex *)ptr->data;
131 return &RNA_BlendTexture;
133 return &RNA_CloudsTexture;
135 return &RNA_DistortedNoiseTexture;
137 return &RNA_EnvironmentMapTexture;
139 return &RNA_ImageTexture;
141 return &RNA_MagicTexture;
143 return &RNA_MarbleTexture;
145 return &RNA_MusgraveTexture;
147 return &RNA_NoiseTexture;
148 case TEX_POINTDENSITY:
149 return &RNA_PointDensityTexture;
151 return &RNA_StucciTexture;
153 return &RNA_VoronoiTexture;
155 return &RNA_VoxelDataTexture;
157 return &RNA_WoodTexture;
159 return &RNA_OceanTexture;
165 static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
167 ID *id = ptr->id.data;
169 if (GS(id->name) == ID_TE) {
170 Tex *tex = ptr->id.data;
172 DEG_id_tag_update(&tex->id, 0);
173 WM_main_add_notifier(NC_TEXTURE, tex);
174 WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, NULL);
176 else if (GS(id->name) == ID_NT) {
177 bNodeTree *ntree = ptr->id.data;
178 ED_node_tag_update_nodetree(bmain, ntree, NULL);
182 static void rna_Texture_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
184 TexMapping *texmap = ptr->data;
185 BKE_texture_mapping_init(texmap);
186 rna_Texture_update(bmain, scene, ptr);
189 static void rna_Color_mapping_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
194 static void rna_Texture_voxeldata_update(Main *bmain, Scene *scene, PointerRNA *ptr)
196 Tex *tex = ptr->id.data;
199 rna_Texture_update(bmain, scene, ptr);
202 static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
204 Tex *tex = ptr->id.data;
206 if (tex->ima) { /* may be getting cleared too */
207 tex->ima->source = IMA_SRC_SEQUENCE;
209 rna_Texture_voxeldata_update(bmain, scene, ptr);
213 /* Used for Texture Properties, used (also) for/in Nodes */
214 static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
216 Tex *tex = ptr->id.data;
218 DEG_id_tag_update(&tex->id, 0);
219 WM_main_add_notifier(NC_TEXTURE | ND_NODES, tex);
222 static void rna_Texture_type_set(PointerRNA *ptr, int value)
224 Tex *tex = (Tex *)ptr->data;
226 BKE_texture_type_set(tex, value);
229 void rna_TextureSlot_update(bContext *C, PointerRNA *ptr)
231 ID *id = ptr->id.data;
233 DEG_id_tag_update(id, 0);
235 switch (GS(id->name)) {
237 WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id);
238 WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id);
241 WM_main_add_notifier(NC_WORLD, id);
244 WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id);
245 WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
249 Scene *scene = CTX_data_scene(C);
250 MTex *mtex = ptr->data;
251 SceneLayer *sl = CTX_data_scene_layer(C);
252 BKE_paint_invalidate_overlay_tex(scene, sl, mtex->tex);
253 WM_main_add_notifier(NC_BRUSH, id);
257 WM_main_add_notifier(NC_LINESTYLE, id);
261 MTex *mtex = ptr->data;
262 int recalc = OB_RECALC_DATA;
264 if (mtex->mapto & PAMAP_INIT)
265 recalc |= PSYS_RECALC_RESET;
266 if (mtex->mapto & PAMAP_CHILD)
267 recalc |= PSYS_RECALC_CHILD;
269 DEG_id_tag_update(id, recalc);
270 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
278 char *rna_TextureSlot_path(PointerRNA *ptr)
280 MTex *mtex = ptr->data;
282 /* if there is ID-data, resolve the path using the index instead of by name,
283 * since the name used is the name of the texture assigned, but the texture
284 * may be used multiple times in the same stack
287 if (GS(((ID *)ptr->id.data)->name) == ID_BR) {
288 return BLI_strdup("texture_slot");
294 /* find the 'textures' property of the ID-struct */
295 RNA_id_pointer_create(ptr->id.data, &id_ptr);
296 prop = RNA_struct_find_property(&id_ptr, "texture_slots");
298 /* get an iterator for this property, and try to find the relevant index */
300 int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
303 return BLI_sprintfN("texture_slots[%d]", index);
309 /* this is a compromise for the remaining cases... */
311 char name_esc[(sizeof(mtex->tex->id.name) - 2) * 2];
313 BLI_strescape(name_esc, mtex->tex->id.name + 2, sizeof(name_esc));
314 return BLI_sprintfN("texture_slots[\"%s\"]", name_esc);
317 return BLI_strdup("texture_slots[0]");
321 static int rna_TextureSlot_name_length(PointerRNA *ptr)
323 MTex *mtex = ptr->data;
326 return strlen(mtex->tex->id.name + 2);
331 static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
333 MTex *mtex = ptr->data;
336 strcpy(str, mtex->tex->id.name + 2);
341 static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
343 MTex *mtex = ptr->data;
344 Tex *tex = mtex->tex;
345 int cur = mtex->which_output;
348 bNodeTree *ntree = tex->nodetree;
351 for (node = ntree->nodes.first; node; node = node->next) {
352 if (node->type == TEX_NODE_OUTPUT) {
353 if (cur == node->custom1)
360 mtex->which_output = 0;
365 static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *UNUSED(C), PointerRNA *ptr,
366 PropertyRNA *UNUSED(prop), bool *r_free)
368 MTex *mtex = ptr->data;
369 Tex *tex = mtex->tex;
370 EnumPropertyItem *item = NULL;
374 bNodeTree *ntree = tex->nodetree;
376 EnumPropertyItem tmp = {0, "", 0, "", ""};
380 tmp.name = "Not Specified";
381 tmp.identifier = "NOT_SPECIFIED";
382 RNA_enum_item_add(&item, &totitem, &tmp);
384 for (node = ntree->nodes.first; node; node = node->next) {
385 if (node->type == TEX_NODE_OUTPUT) {
386 tmp.value = node->custom1;
387 tmp.name = ((TexNodeOutput *)node->storage)->name;
388 tmp.identifier = tmp.name;
389 RNA_enum_item_add(&item, &totitem, &tmp);
395 RNA_enum_item_end(&item, &totitem);
401 static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value)
403 Tex *tex = (Tex *)ptr->data;
405 if (value) tex->flag |= TEX_COLORBAND;
406 else tex->flag &= ~TEX_COLORBAND;
408 if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
409 tex->coba = add_colorband(false);
412 static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr)
414 Tex *tex = (Tex *)ptr->data;
416 if (tex->use_nodes) {
419 if (tex->nodetree == NULL)
420 ED_node_texture_default(C, tex);
423 rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr);
426 static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value)
428 Tex *tex = (Tex *)ptr->data;
430 if (value) tex->imaflag |= TEX_MIPMAP;
431 else tex->imaflag &= ~TEX_MIPMAP;
434 static void rna_Envmap_update_generic(Main *bmain, Scene *scene, PointerRNA *ptr)
436 Tex *tex = ptr->id.data;
438 ED_preview_kill_jobs(bmain->wm.first, bmain);
439 BKE_texture_envmap_free_data(tex->env);
441 rna_Texture_update(bmain, scene, ptr);
444 static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr)
446 PointDensity *pd = ptr->data;
447 Object *ob = pd->object;
448 ParticleSystem *psys = NULL;
452 psys = BLI_findlink(&ob->particlesystem, pd->psys - 1);
454 RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
458 static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
460 PointDensity *pd = ptr->data;
461 Object *ob = pd->object;
463 if (ob && value.id.data == ob)
464 pd->psys = BLI_findindex(&ob->particlesystem, value.data) + 1;
467 static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr))
469 return BLI_sprintfN("point_density");
472 static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr))
474 return BLI_sprintfN("voxel_data");
477 static char *rna_OceanTex_path(PointerRNA *UNUSED(ptr))
479 return BLI_sprintfN("ocean");
484 static void rna_def_texmapping(BlenderRNA *brna)
486 static EnumPropertyItem prop_mapping_items[] = {
487 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
488 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
489 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
490 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
491 {0, NULL, 0, NULL, NULL}
494 static EnumPropertyItem prop_vect_type_items[] = {
495 {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"},
496 {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
497 {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
498 {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
499 {0, NULL, 0, NULL, NULL}
502 static EnumPropertyItem prop_xyz_mapping_items[] = {
503 {0, "NONE", 0, "None", ""},
504 {1, "X", 0, "X", ""},
505 {2, "Y", 0, "Y", ""},
506 {3, "Z", 0, "Z", ""},
507 {0, NULL, 0, NULL, NULL}
513 srna = RNA_def_struct(brna, "TexMapping", NULL);
514 RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
516 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
517 RNA_def_property_enum_sdna(prop, NULL, "type");
518 RNA_def_property_enum_items(prop, prop_vect_type_items);
519 RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
520 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
522 prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
523 RNA_def_property_float_sdna(prop, NULL, "loc");
524 RNA_def_property_ui_text(prop, "Location", "");
525 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
526 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
528 /* Not PROP_XYZ, this is now in radians, no more degrees */
529 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
530 RNA_def_property_float_sdna(prop, NULL, "rot");
531 RNA_def_property_ui_text(prop, "Rotation", "");
532 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
534 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
535 RNA_def_property_float_sdna(prop, NULL, "size");
536 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
537 RNA_def_property_ui_text(prop, "Scale", "");
538 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
540 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
541 RNA_def_property_float_sdna(prop, NULL, "min");
542 RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
543 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
545 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
546 RNA_def_property_float_sdna(prop, NULL, "max");
547 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
548 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
550 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
551 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
552 RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
553 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
555 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
556 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
557 RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
558 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
560 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
561 RNA_def_property_enum_sdna(prop, NULL, "projx");
562 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
563 RNA_def_property_ui_text(prop, "X Mapping", "");
564 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
566 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
567 RNA_def_property_enum_sdna(prop, NULL, "projy");
568 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
569 RNA_def_property_ui_text(prop, "Y Mapping", "");
570 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
572 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
573 RNA_def_property_enum_sdna(prop, NULL, "projz");
574 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
575 RNA_def_property_ui_text(prop, "Z Mapping", "");
576 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
578 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
579 RNA_def_property_enum_items(prop, prop_mapping_items);
580 RNA_def_property_ui_text(prop, "Mapping", "");
581 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
584 static void rna_def_colormapping(BlenderRNA *brna)
589 srna = RNA_def_struct(brna, "ColorMapping", NULL);
590 RNA_def_struct_ui_text(srna, "Color Mapping", "Color mapping settings");
592 prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
593 RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMAP_USE_RAMP);
594 RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
595 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
597 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
598 RNA_def_property_pointer_sdna(prop, NULL, "coba");
599 RNA_def_property_struct_type(prop, "ColorRamp");
600 RNA_def_property_ui_text(prop, "Color Ramp", "");
601 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
603 prop = RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
604 RNA_def_property_float_sdna(prop, NULL, "bright");
605 RNA_def_property_range(prop, 0, 2);
606 RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
607 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
609 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
610 RNA_def_property_range(prop, 0.0, 5);
611 RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
612 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
614 prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
615 RNA_def_property_range(prop, 0, 2);
616 RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
617 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
619 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
620 RNA_def_property_enum_items(prop, blend_type_items);
621 RNA_def_property_ui_text(prop, "Blend Type", "Mode used to mix with texture output color");
622 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
624 prop = RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
625 RNA_def_property_array(prop, 3);
626 RNA_def_property_ui_text(prop, "Color", "Blend color to mix with texture output color");
627 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
629 prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
630 RNA_def_property_ui_text(prop, "Blend Factor", "");
631 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
634 static void rna_def_mtex(BlenderRNA *brna)
639 static EnumPropertyItem output_node_items[] = {
640 {0, "DUMMY", 0, "Dummy", ""},
641 {0, NULL, 0, NULL, NULL}
644 srna = RNA_def_struct(brna, "TextureSlot", NULL);
645 RNA_def_struct_sdna(srna, "MTex");
646 RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
647 RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
648 RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
650 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
651 RNA_def_property_pointer_sdna(prop, NULL, "tex");
652 RNA_def_property_struct_type(prop, "Texture");
653 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
654 RNA_def_property_ui_text(prop, "Texture", "Texture data-block used by this texture slot");
655 RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
657 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
658 RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
659 RNA_def_property_ui_text(prop, "Name", "Texture slot name");
660 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
661 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
662 RNA_def_struct_name_property(srna, prop);
663 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
666 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
667 RNA_def_property_float_sdna(prop, NULL, "ofs");
668 RNA_def_property_ui_range(prop, -10, 10, 10, RNA_TRANSLATION_PREC_DEFAULT);
669 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
670 RNA_def_property_ui_text(prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations");
671 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
673 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
674 RNA_def_property_float_sdna(prop, NULL, "size");
675 RNA_def_property_flag(prop, PROP_PROPORTIONAL | PROP_CONTEXT_UPDATE);
676 RNA_def_property_ui_range(prop, -100, 100, 10, 2);
677 RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes");
678 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
680 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
681 RNA_def_property_float_sdna(prop, NULL, "r");
682 RNA_def_property_array(prop, 3);
683 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
684 RNA_def_property_ui_text(prop, "Color",
685 "Default color for textures that don't return RGB or when RGB to intensity is enabled");
686 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
688 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
689 RNA_def_property_enum_sdna(prop, NULL, "blendtype");
690 RNA_def_property_enum_items(prop, blend_type_items);
691 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
692 RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
693 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
695 prop = RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE);
696 RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_STENCIL);
697 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
698 RNA_def_property_ui_text(prop, "Stencil", "Use this texture as a blending value on the next texture");
699 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
701 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
702 RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEGATIVE);
703 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
704 RNA_def_property_ui_text(prop, "Negate", "Invert the values of the texture to reverse its effect");
705 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
707 prop = RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE);
708 RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_RGBTOINT);
709 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
710 RNA_def_property_ui_text(prop, "RGB to Intensity", "Convert texture RGB values to intensity (gray) values");
711 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
713 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
714 RNA_def_property_float_sdna(prop, NULL, "def_var");
715 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
716 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
717 RNA_def_property_ui_text(prop, "Default Value",
718 "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
719 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
721 prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
722 RNA_def_property_enum_sdna(prop, NULL, "which_output");
723 RNA_def_property_enum_items(prop, output_node_items);
724 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
725 RNA_def_property_enum_funcs(prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
726 RNA_def_property_ui_text(prop, "Output Node", "Which output node to use, for node-based textures");
727 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
730 static void rna_def_filter_common(StructRNA *srna)
734 prop = RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
735 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
736 RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
737 RNA_def_property_ui_text(prop, "MIP Map", "Use auto-generated MIP maps for the image");
738 RNA_def_property_update(prop, 0, "rna_Texture_update");
740 prop = RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
741 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
742 RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps");
743 RNA_def_property_update(prop, 0, "rna_Texture_update");
745 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
746 RNA_def_property_enum_sdna(prop, NULL, "texfilter");
747 RNA_def_property_enum_items(prop, texture_filter_items);
748 RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
749 RNA_def_property_update(prop, 0, "rna_Texture_update");
751 prop = RNA_def_property(srna, "filter_lightprobes", PROP_INT, PROP_NONE);
752 RNA_def_property_int_sdna(prop, NULL, "afmax");
753 RNA_def_property_range(prop, 1, 256);
754 RNA_def_property_ui_text(prop, "Filter Probes",
755 "Maximum number of samples (higher gives less blur at distant/oblique angles, "
756 "but is also slower)");
757 RNA_def_property_update(prop, 0, "rna_Texture_update");
759 prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
760 RNA_def_property_int_sdna(prop, NULL, "afmax");
761 RNA_def_property_range(prop, 1, 256);
762 RNA_def_property_ui_text(prop, "Filter Eccentricity",
763 "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
764 "but is also slower)");
765 RNA_def_property_update(prop, 0, "rna_Texture_update");
767 prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
768 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
769 RNA_def_property_ui_text(prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
770 RNA_def_property_update(prop, 0, "rna_Texture_update");
772 prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
773 RNA_def_property_float_sdna(prop, NULL, "filtersize");
774 RNA_def_property_range(prop, 0.1, 50.0);
775 RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 2);
776 RNA_def_property_ui_text(prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation");
777 RNA_def_property_update(prop, 0, "rna_Texture_update");
780 static void rna_def_environment_map(BlenderRNA *brna)
785 static EnumPropertyItem prop_source_items[] = {
786 {ENV_STATIC, "STATIC", 0, "Static", "Calculate environment map only once"},
787 {ENV_ANIM, "ANIMATED", 0, "Animated", "Calculate environment map at each rendering"},
788 {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Load a saved environment map image from disk"},
789 {0, NULL, 0, NULL, NULL}
792 static EnumPropertyItem prop_mapping_items[] = {
793 {ENV_CUBE, "CUBE", 0, "Cube", "Use environment map with six cube sides"},
794 {ENV_PLANE, "PLANE", 0, "Plane", "Only one side is rendered, with Z axis pointing in direction of image"},
795 {0, NULL, 0, NULL, NULL}
798 srna = RNA_def_struct(brna, "EnvironmentMap", NULL);
799 RNA_def_struct_sdna(srna, "EnvMap");
800 RNA_def_struct_ui_text(srna, "EnvironmentMap",
801 "Environment map created by the renderer and cached for subsequent renders");
803 prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
804 RNA_def_property_enum_sdna(prop, NULL, "stype");
805 RNA_def_property_enum_items(prop, prop_source_items);
806 RNA_def_property_ui_text(prop, "Source", "");
807 RNA_def_property_update(prop, 0, "rna_Envmap_update_generic");
809 prop = RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE);
810 RNA_def_property_pointer_sdna(prop, NULL, "object");
811 RNA_def_property_ui_text(prop, "Viewpoint Object", "Object to use as the environment map's viewpoint location");
812 RNA_def_property_flag(prop, PROP_EDITABLE);
813 RNA_def_property_update(prop, 0, "rna_Texture_update");
815 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
816 RNA_def_property_enum_sdna(prop, NULL, "type");
817 RNA_def_property_enum_items(prop, prop_mapping_items);
818 RNA_def_property_ui_text(prop, "Mapping", "");
819 RNA_def_property_update(prop, 0, "rna_Texture_update");
821 prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
822 RNA_def_property_float_sdna(prop, NULL, "clipsta");
823 RNA_def_property_range(prop, 0.001, FLT_MAX);
824 RNA_def_property_ui_range(prop, 0.01, 50, 100, 2);
825 RNA_def_property_ui_text(prop, "Clip Start", "Objects nearer than this are not visible to map");
826 RNA_def_property_update(prop, 0, "rna_Texture_update");
828 prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
829 RNA_def_property_float_sdna(prop, NULL, "clipend");
830 RNA_def_property_range(prop, 0.01, FLT_MAX);
831 RNA_def_property_ui_range(prop, 0.10, 20000, 100, 2);
832 RNA_def_property_ui_text(prop, "Clip End", "Objects further than this are not visible to map");
833 RNA_def_property_update(prop, 0, "rna_Texture_update");
835 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
836 RNA_def_property_float_sdna(prop, NULL, "viewscale");
837 RNA_def_property_range(prop, 0.1, 5.0);
838 RNA_def_property_ui_range(prop, 0.5, 1.5, 1, 2);
839 RNA_def_property_ui_text(prop, "Zoom", "");
840 RNA_def_property_update(prop, 0, "rna_Texture_update");
842 prop = RNA_def_property(srna, "layers_ignore", PROP_BOOLEAN, PROP_LAYER_MEMBER);
843 RNA_def_property_boolean_sdna(prop, NULL, "notlay", 1);
844 RNA_def_property_array(prop, 20);
845 RNA_def_property_ui_text(prop, "Ignore Layers",
846 "Hide objects on these layers when generating the Environment Map");
847 RNA_def_property_update(prop, 0, "rna_Texture_update");
849 prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
850 RNA_def_property_int_sdna(prop, NULL, "cuberes");
851 RNA_def_property_range(prop, 50, 4096);
852 RNA_def_property_ui_text(prop, "Resolution", "Pixel resolution of the rendered environment map");
853 RNA_def_property_update(prop, 0, "rna_Texture_update");
855 prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
856 RNA_def_property_range(prop, 0, 5);
857 RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects)");
858 RNA_def_property_update(prop, 0, "rna_Texture_update");
860 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, 0);
861 RNA_def_property_boolean_sdna(prop, NULL, "ok", 2);
862 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
863 RNA_def_property_ui_text(prop, "Validity", "True if this map is ready for use, False if it needs rendering");
865 RNA_api_environment_map(srna);
868 static EnumPropertyItem prop_noise_basis_items[] = {
869 {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original",
870 "Noise algorithm - Blender original: Smooth interpolated noise"},
871 {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin",
872 "Noise algorithm - Original Perlin: Smooth interpolated noise"},
873 {TEX_NEWPERLIN, "IMPROVED_PERLIN", 0, "Improved Perlin",
874 "Noise algorithm - Improved Perlin: Smooth interpolated noise"},
875 {TEX_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1",
876 "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"},
877 {TEX_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2",
878 "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"},
879 {TEX_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3",
880 "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"},
881 {TEX_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4",
882 "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"},
883 {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"},
884 {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle",
885 "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
886 {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise",
887 "Noise algorithm - Cell Noise: Square cell tessellation"},
888 {0, NULL, 0, NULL, NULL}
891 static EnumPropertyItem prop_noise_type[] = {
892 {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
893 {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
894 {0, NULL, 0, NULL, NULL}
898 static void rna_def_texture_clouds(BlenderRNA *brna)
903 static EnumPropertyItem prop_clouds_stype[] = {
904 {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""},
905 {TEX_COLOR, "COLOR", 0, "Color", ""},
906 {0, NULL, 0, NULL, NULL}
909 srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
910 RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
911 RNA_def_struct_sdna(srna, "Tex");
913 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
914 RNA_def_property_float_sdna(prop, NULL, "noisesize");
915 RNA_def_property_range(prop, 0.0001, FLT_MAX);
916 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
917 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
918 RNA_def_property_update(prop, 0, "rna_Texture_update");
920 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
921 RNA_def_property_int_sdna(prop, NULL, "noisedepth");
922 RNA_def_property_range(prop, 0, 30);
923 RNA_def_property_ui_range(prop, 0, 24, 0, 2);
924 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
925 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
927 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
928 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
929 RNA_def_property_enum_items(prop, prop_noise_basis_items);
930 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
931 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
933 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
934 RNA_def_property_enum_sdna(prop, NULL, "noisetype");
935 RNA_def_property_enum_items(prop, prop_noise_type);
936 RNA_def_property_ui_text(prop, "Noise Type", "");
937 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
939 prop = RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
940 RNA_def_property_enum_sdna(prop, NULL, "stype");
941 RNA_def_property_enum_items(prop, prop_clouds_stype);
942 RNA_def_property_ui_text(prop, "Color", "Determine whether Noise returns grayscale or RGB values");
943 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
945 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
946 RNA_def_property_range(prop, 0.001, 0.1);
947 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
948 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
949 RNA_def_property_update(prop, 0, "rna_Texture_update");
952 static void rna_def_texture_wood(BlenderRNA *brna)
957 static EnumPropertyItem prop_wood_stype[] = {
958 {TEX_BAND, "BANDS", 0, "Bands", "Use standard wood texture in bands"},
959 {TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"},
960 {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"},
961 {TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Add noise to rings"},
962 {0, NULL, 0, NULL, NULL}
965 static EnumPropertyItem prop_wood_noisebasis2[] = {
966 {TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"},
967 {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
968 {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
969 {0, NULL, 0, NULL, NULL}
972 srna = RNA_def_struct(brna, "WoodTexture", "Texture");
973 RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
974 RNA_def_struct_sdna(srna, "Tex");
976 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
977 RNA_def_property_float_sdna(prop, NULL, "noisesize");
978 RNA_def_property_range(prop, 0.0001, FLT_MAX);
979 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
980 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
981 RNA_def_property_update(prop, 0, "rna_Texture_update");
983 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
984 RNA_def_property_float_sdna(prop, NULL, "turbul");
985 RNA_def_property_range(prop, 0.0001, FLT_MAX);
986 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
987 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
988 RNA_def_property_update(prop, 0, "rna_Texture_update");
990 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
991 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
992 RNA_def_property_enum_items(prop, prop_noise_basis_items);
993 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
994 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
996 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
997 RNA_def_property_enum_sdna(prop, NULL, "noisetype");
998 RNA_def_property_enum_items(prop, prop_noise_type);
999 RNA_def_property_ui_text(prop, "Noise Type", "");
1000 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1002 prop = RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
1003 RNA_def_property_enum_sdna(prop, NULL, "stype");
1004 RNA_def_property_enum_items(prop, prop_wood_stype);
1005 RNA_def_property_ui_text(prop, "Pattern", "");
1006 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1008 prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
1009 RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
1010 RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
1011 RNA_def_property_ui_text(prop, "Noise Basis 2", "");
1012 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1014 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1015 RNA_def_property_range(prop, 0.001, 0.1);
1016 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1017 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1018 RNA_def_property_update(prop, 0, "rna_Texture_update");
1022 static void rna_def_texture_marble(BlenderRNA *brna)
1027 static EnumPropertyItem prop_marble_stype[] = {
1028 {TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"},
1029 {TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"},
1030 {TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"},
1031 {0, NULL, 0, NULL, NULL}
1034 static EnumPropertyItem prop_marble_noisebasis2[] = {
1035 {TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"},
1036 {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
1037 {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
1038 {0, NULL, 0, NULL, NULL}
1041 srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
1042 RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
1043 RNA_def_struct_sdna(srna, "Tex");
1045 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1046 RNA_def_property_float_sdna(prop, NULL, "noisesize");
1047 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1048 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
1049 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1050 RNA_def_property_update(prop, 0, "rna_Texture_update");
1052 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
1053 RNA_def_property_float_sdna(prop, NULL, "turbul");
1054 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1055 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
1056 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
1057 RNA_def_property_update(prop, 0, "rna_Texture_update");
1059 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
1060 RNA_def_property_int_sdna(prop, NULL, "noisedepth");
1061 RNA_def_property_range(prop, 0, 30);
1062 RNA_def_property_ui_range(prop, 0, 24, 0, 2);
1063 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
1064 RNA_def_property_update(prop, 0, "rna_Texture_update");
1066 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
1067 RNA_def_property_enum_sdna(prop, NULL, "noisetype");
1068 RNA_def_property_enum_items(prop, prop_noise_type);
1069 RNA_def_property_ui_text(prop, "Noise Type", "");
1070 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1072 prop = RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
1073 RNA_def_property_enum_sdna(prop, NULL, "stype");
1074 RNA_def_property_enum_items(prop, prop_marble_stype);
1075 RNA_def_property_ui_text(prop, "Pattern", "");
1076 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1078 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1079 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
1080 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1081 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1082 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1084 prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
1085 RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
1086 RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
1087 RNA_def_property_ui_text(prop, "Noise Basis 2", "");
1088 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1090 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1091 RNA_def_property_range(prop, 0.001, 0.1);
1092 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1093 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1094 RNA_def_property_update(prop, 0, "rna_Texture_update");
1098 static void rna_def_texture_magic(BlenderRNA *brna)
1103 srna = RNA_def_struct(brna, "MagicTexture", "Texture");
1104 RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
1105 RNA_def_struct_sdna(srna, "Tex");
1107 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
1108 RNA_def_property_float_sdna(prop, NULL, "turbul");
1109 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1110 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
1111 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
1112 RNA_def_property_update(prop, 0, "rna_Texture_update");
1114 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
1115 RNA_def_property_int_sdna(prop, NULL, "noisedepth");
1116 RNA_def_property_range(prop, 0, 30);
1117 RNA_def_property_ui_range(prop, 0, 24, 0, 2);
1118 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the noise");
1119 RNA_def_property_update(prop, 0, "rna_Texture_update");
1122 static void rna_def_texture_blend(BlenderRNA *brna)
1127 static EnumPropertyItem prop_blend_progression[] = {
1128 {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"},
1129 {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
1130 {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
1131 {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
1132 {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
1133 {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
1134 "Create a quadratic progression in the shape of a sphere"},
1135 {TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
1136 {0, NULL, 0, NULL, NULL}
1139 static const EnumPropertyItem prop_flip_axis_items[] = {
1140 {0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
1141 {TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
1142 {0, NULL, 0, NULL, NULL}
1145 srna = RNA_def_struct(brna, "BlendTexture", "Texture");
1146 RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
1147 RNA_def_struct_sdna(srna, "Tex");
1149 prop = RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
1150 RNA_def_property_enum_sdna(prop, NULL, "stype");
1151 RNA_def_property_enum_items(prop, prop_blend_progression);
1152 RNA_def_property_ui_text(prop, "Progression", "Style of the color blending");
1153 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1155 prop = RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
1156 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
1157 RNA_def_property_enum_items(prop, prop_flip_axis_items);
1158 RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
1159 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1163 static void rna_def_texture_stucci(BlenderRNA *brna)
1168 static EnumPropertyItem prop_stucci_stype[] = {
1169 {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"},
1170 {TEX_WALLIN, "WALL_IN", 0, "Wall in", "Create Dimples"},
1171 {TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"},
1172 {0, NULL, 0, NULL, NULL}
1175 srna = RNA_def_struct(brna, "StucciTexture", "Texture");
1176 RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
1177 RNA_def_struct_sdna(srna, "Tex");
1179 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
1180 RNA_def_property_float_sdna(prop, NULL, "turbul");
1181 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1182 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
1183 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
1184 RNA_def_property_update(prop, 0, "rna_Texture_update");
1186 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1187 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
1188 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1189 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1190 RNA_def_property_update(prop, 0, "rna_Texture_update");
1192 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1193 RNA_def_property_float_sdna(prop, NULL, "noisesize");
1194 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1195 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
1196 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1197 RNA_def_property_update(prop, 0, "rna_Texture_update");
1199 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
1200 RNA_def_property_enum_sdna(prop, NULL, "noisetype");
1201 RNA_def_property_enum_items(prop, prop_noise_type);
1202 RNA_def_property_ui_text(prop, "Noise Type", "");
1203 RNA_def_property_update(prop, 0, "rna_Texture_update");
1205 prop = RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
1206 RNA_def_property_enum_sdna(prop, NULL, "stype");
1207 RNA_def_property_enum_items(prop, prop_stucci_stype);
1208 RNA_def_property_ui_text(prop, "Pattern", "");
1209 RNA_def_property_update(prop, 0, "rna_Texture_update");
1212 static void rna_def_texture_noise(BlenderRNA *brna)
1216 srna = RNA_def_struct(brna, "NoiseTexture", "Texture");
1217 RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
1218 RNA_def_struct_sdna(srna, "Tex");
1221 static void rna_def_texture_image(BlenderRNA *brna)
1226 static EnumPropertyItem prop_image_extension[] = {
1227 {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
1228 {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
1229 {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube",
1230 "Clip to cubic-shaped area around the image and set exterior pixels as transparent"},
1231 {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
1232 {TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
1233 {0, NULL, 0, NULL, NULL}
1236 srna = RNA_def_struct(brna, "ImageTexture", "Texture");
1237 RNA_def_struct_ui_text(srna, "Image Texture", "");
1238 RNA_def_struct_sdna(srna, "Tex");
1240 prop = RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
1241 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
1242 RNA_def_property_ui_text(prop, "Interpolation", "Interpolate pixels using selected filter");
1243 RNA_def_property_update(prop, 0, "rna_Texture_update");
1245 /* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */
1246 prop = RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
1247 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_IMAROT);
1248 RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
1249 RNA_def_property_update(prop, 0, "rna_Texture_update");
1251 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
1252 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA);
1253 RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image");
1254 RNA_def_property_update(prop, 0, "rna_Texture_update");
1256 prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
1257 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA);
1258 RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image");
1259 RNA_def_property_update(prop, 0, "rna_Texture_update");
1261 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
1262 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA);
1263 RNA_def_property_ui_text(prop, "Invert Alpha", "Invert all the alpha values in the image");
1264 RNA_def_property_update(prop, 0, "rna_Texture_update");
1266 rna_def_filter_common(srna);
1268 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
1269 RNA_def_property_enum_sdna(prop, NULL, "extend");
1270 RNA_def_property_enum_items(prop, prop_image_extension);
1271 RNA_def_property_ui_text(prop, "Extension", "How the image is extrapolated past its original bounds");
1272 RNA_def_property_update(prop, 0, "rna_Texture_update");
1274 prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
1275 RNA_def_property_int_sdna(prop, NULL, "xrepeat");
1276 RNA_def_property_range(prop, 1, 512);
1277 RNA_def_property_ui_text(prop, "Repeat X", "Repetition multiplier in the X direction");
1278 RNA_def_property_update(prop, 0, "rna_Texture_update");
1280 prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
1281 RNA_def_property_int_sdna(prop, NULL, "yrepeat");
1282 RNA_def_property_range(prop, 1, 512);
1283 RNA_def_property_ui_text(prop, "Repeat Y", "Repetition multiplier in the Y direction");
1284 RNA_def_property_update(prop, 0, "rna_Texture_update");
1286 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1287 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_XMIR);
1288 RNA_def_property_ui_text(prop, "Mirror X", "Mirror the image repetition on the X direction");
1289 RNA_def_property_update(prop, 0, "rna_Texture_update");
1291 prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
1292 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_YMIR);
1293 RNA_def_property_ui_text(prop, "Mirror Y", "Mirror the image repetition on the Y direction");
1294 RNA_def_property_update(prop, 0, "rna_Texture_update");
1296 prop = RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
1297 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_ODD);
1298 RNA_def_property_ui_text(prop, "Checker Odd", "Odd checker tiles");
1299 RNA_def_property_update(prop, 0, "rna_Texture_update");
1301 prop = RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
1302 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_EVEN);
1303 RNA_def_property_ui_text(prop, "Checker Even", "Even checker tiles");
1304 RNA_def_property_update(prop, 0, "rna_Texture_update");
1306 prop = RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
1307 RNA_def_property_float_sdna(prop, NULL, "checkerdist");
1308 RNA_def_property_range(prop, 0.0, 0.99);
1309 RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 2);
1310 RNA_def_property_ui_text(prop, "Checker Distance", "Distance between checker tiles");
1311 RNA_def_property_update(prop, 0, "rna_Texture_update");
1315 /* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
1316 * perhaps a new subtype could be added?
1317 * --I actually used single values for this, maybe change later with a RNA_Rect thing? */
1318 prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
1319 RNA_def_property_float_sdna(prop, NULL, "cropxmin");
1320 RNA_def_property_array(prop, 4);
1321 RNA_def_property_range(prop, -10, 10);
1322 RNA_def_property_ui_text(prop, "Crop Rectangle", "");
1323 RNA_def_property_update(prop, 0, "rna_Texture_update");
1327 prop = RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
1328 RNA_def_property_float_sdna(prop, NULL, "cropxmin");
1329 RNA_def_property_range(prop, -10.0, 10.0);
1330 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1331 RNA_def_property_ui_text(prop, "Crop Minimum X", "Minimum X value to crop the image");
1332 RNA_def_property_update(prop, 0, "rna_Texture_update");
1334 prop = RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
1335 RNA_def_property_float_sdna(prop, NULL, "cropymin");
1336 RNA_def_property_range(prop, -10.0, 10.0);
1337 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1338 RNA_def_property_ui_text(prop, "Crop Minimum Y", "Minimum Y value to crop the image");
1339 RNA_def_property_update(prop, 0, "rna_Texture_update");
1341 prop = RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
1342 RNA_def_property_float_sdna(prop, NULL, "cropxmax");
1343 RNA_def_property_range(prop, -10.0, 10.0);
1344 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1345 RNA_def_property_ui_text(prop, "Crop Maximum X", "Maximum X value to crop the image");
1346 RNA_def_property_update(prop, 0, "rna_Texture_update");
1348 prop = RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
1349 RNA_def_property_float_sdna(prop, NULL, "cropymax");
1350 RNA_def_property_range(prop, -10.0, 10.0);
1351 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1352 RNA_def_property_ui_text(prop, "Crop Maximum Y", "Maximum Y value to crop the image");
1353 RNA_def_property_update(prop, 0, "rna_Texture_update");
1355 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1356 RNA_def_property_pointer_sdna(prop, NULL, "ima");
1357 RNA_def_property_struct_type(prop, "Image");
1358 RNA_def_property_flag(prop, PROP_EDITABLE);
1359 RNA_def_property_ui_text(prop, "Image", "");
1360 RNA_def_property_update(prop, 0, "rna_Texture_update");
1362 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
1363 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1364 RNA_def_property_ui_text(prop, "Image User",
1365 "Parameters defining which layer, pass and frame of the image is displayed");
1366 RNA_def_property_update(prop, 0, "rna_Texture_update");
1369 prop = RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
1370 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
1371 RNA_def_property_ui_text(prop, "Normal Map", "Use image RGB values for normal mapping");
1372 RNA_def_property_update(prop, 0, "rna_Texture_update");
1374 /* Derivative Map */
1375 prop = RNA_def_property(srna, "use_derivative_map", PROP_BOOLEAN, PROP_NONE);
1376 RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_DERIVATIVEMAP);
1377 RNA_def_property_ui_text(prop, "Derivative Map", "Use red and green as derivative values");
1378 RNA_def_property_update(prop, 0, "rna_Texture_update");
1381 static void rna_def_texture_environment_map(BlenderRNA *brna)
1386 srna = RNA_def_struct(brna, "EnvironmentMapTexture", "Texture");
1387 RNA_def_struct_ui_text(srna, "Environment Map", "Environment map texture");
1388 RNA_def_struct_sdna(srna, "Tex");
1390 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1391 RNA_def_property_pointer_sdna(prop, NULL, "ima");
1392 RNA_def_property_struct_type(prop, "Image");
1393 RNA_def_property_flag(prop, PROP_EDITABLE);
1394 RNA_def_property_ui_text(prop, "Image", "Source image file to read the environment map from");
1395 RNA_def_property_update(prop, 0, "rna_Envmap_update_generic");
1397 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
1398 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1399 RNA_def_property_ui_text(prop, "Image User",
1400 "Parameters defining which layer, pass and frame of the image is displayed");
1401 RNA_def_property_update(prop, 0, "rna_Texture_update");
1403 rna_def_filter_common(srna);
1405 prop = RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE);
1406 RNA_def_property_pointer_sdna(prop, NULL, "env");
1407 RNA_def_property_struct_type(prop, "EnvironmentMap");
1408 RNA_def_property_ui_text(prop, "Environment Map", "Get the environment map associated with this texture");
1409 RNA_def_property_update(prop, 0, "rna_Texture_update");
1412 static void rna_def_texture_musgrave(BlenderRNA *brna)
1417 static EnumPropertyItem prop_musgrave_type[] = {
1418 {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Use Perlin noise as a basis"},
1419 {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal",
1420 "Use Perlin noise with inflection as a basis"},
1421 {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal",
1422 "Use Perlin noise as a basis, with extended controls"},
1423 {TEX_FBM, "FBM", 0, "fBM", "Fractal Brownian Motion, use Brownian noise as a basis"},
1424 {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
1425 {0, NULL, 0, NULL, NULL}
1428 srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
1429 RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
1430 RNA_def_struct_sdna(srna, "Tex");
1432 prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
1433 RNA_def_property_enum_sdna(prop, NULL, "stype");
1434 RNA_def_property_enum_items(prop, prop_musgrave_type);
1435 RNA_def_property_ui_text(prop, "Type", "Fractal noise algorithm");
1436 RNA_def_property_update(prop, 0, "rna_Texture_update");
1438 prop = RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
1439 RNA_def_property_float_sdna(prop, NULL, "mg_H");
1440 RNA_def_property_range(prop, 0.0001, 2);
1441 RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
1442 RNA_def_property_update(prop, 0, "rna_Texture_update");
1444 prop = RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
1445 RNA_def_property_float_sdna(prop, NULL, "mg_lacunarity");
1446 RNA_def_property_range(prop, 0, 6);
1447 RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
1448 RNA_def_property_update(prop, 0, "rna_Texture_update");
1450 prop = RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
1451 RNA_def_property_float_sdna(prop, NULL, "mg_octaves");
1452 RNA_def_property_range(prop, 0, 8);
1453 RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
1454 RNA_def_property_update(prop, 0, "rna_Texture_update");
1456 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
1457 RNA_def_property_float_sdna(prop, NULL, "mg_offset");
1458 RNA_def_property_range(prop, 0, 6);
1459 RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
1460 RNA_def_property_update(prop, 0, "rna_Texture_update");
1462 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
1463 RNA_def_property_float_sdna(prop, NULL, "mg_gain");
1464 RNA_def_property_range(prop, 0, 6);
1465 RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
1466 RNA_def_property_update(prop, 0, "rna_Texture_update");
1468 prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
1469 RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
1470 RNA_def_property_range(prop, 0, 10);
1471 RNA_def_property_ui_text(prop, "Noise Intensity", "Intensity of the noise");
1472 RNA_def_property_update(prop, 0, "rna_Texture_update");
1474 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1475 RNA_def_property_float_sdna(prop, NULL, "noisesize");
1476 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1477 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
1478 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1479 RNA_def_property_update(prop, 0, "rna_Texture_update");
1481 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1482 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
1483 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1484 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1485 RNA_def_property_update(prop, 0, "rna_Texture_update");
1487 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1488 RNA_def_property_range(prop, 0.001, 0.1);
1489 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1490 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1491 RNA_def_property_update(prop, 0, "rna_Texture_update");
1494 static void rna_def_texture_voronoi(BlenderRNA *brna)
1499 static EnumPropertyItem prop_distance_metric_items[] = {
1500 {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "sqrt(x*x+y*y+z*z)"},
1501 {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "(x*x+y*y+z*z)"},
1502 {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan",
1503 "The length of the distance in axial directions"},
1504 {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev",
1505 "The length of the longest Axial journey"},
1506 {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2",
1507 "Set Minkowski variable to 0.5"},
1508 {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4",
1509 "Set Minkowski variable to 4"},
1510 {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkowski",
1511 "Use the Minkowski function to calculate distance "
1512 "(exponent value determines the shape of the boundaries)"},
1513 {0, NULL, 0, NULL, NULL}
1516 static EnumPropertyItem prop_coloring_items[] = {
1517 /* XXX: OK names / descriptions? */
1518 {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
1519 {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"},
1520 {TEX_COL2, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F1"},
1521 {TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity",
1522 "Multiply position and outline by intensity"},
1523 {0, NULL, 0, NULL, NULL}
1526 srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
1527 RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
1528 RNA_def_struct_sdna(srna, "Tex");
1530 prop = RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
1531 RNA_def_property_float_sdna(prop, NULL, "vn_w1");
1532 RNA_def_property_range(prop, -2, 2);
1533 RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
1534 RNA_def_property_update(prop, 0, "rna_Texture_update");
1536 prop = RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
1537 RNA_def_property_float_sdna(prop, NULL, "vn_w2");
1538 RNA_def_property_range(prop, -2, 2);
1539 RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
1540 RNA_def_property_update(prop, 0, "rna_Texture_update");
1542 prop = RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
1543 RNA_def_property_float_sdna(prop, NULL, "vn_w3");
1544 RNA_def_property_range(prop, -2, 2);
1545 RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
1546 RNA_def_property_update(prop, 0, "rna_Texture_update");
1548 prop = RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
1549 RNA_def_property_float_sdna(prop, NULL, "vn_w4");
1550 RNA_def_property_range(prop, -2, 2);
1551 RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
1552 RNA_def_property_update(prop, 0, "rna_Texture_update");
1554 prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
1555 RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
1556 RNA_def_property_range(prop, 0.01, 10);
1557 RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
1558 RNA_def_property_update(prop, 0, "rna_Texture_update");
1560 prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
1561 RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
1562 RNA_def_property_enum_items(prop, prop_distance_metric_items);
1563 RNA_def_property_ui_text(prop, "Distance Metric",
1564 "Algorithm used to calculate distance of sample points to feature points");
1565 RNA_def_property_update(prop, 0, "rna_Texture_update");
1567 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
1568 RNA_def_property_enum_sdna(prop, NULL, "vn_coltype");
1569 RNA_def_property_enum_items(prop, prop_coloring_items);
1570 RNA_def_property_ui_text(prop, "Coloring", "");
1571 RNA_def_property_update(prop, 0, "rna_Texture_update");
1573 prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
1574 RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
1575 RNA_def_property_range(prop, 0.01, 10);
1576 RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
1577 RNA_def_property_update(prop, 0, "rna_Texture_update");
1579 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1580 RNA_def_property_float_sdna(prop, NULL, "noisesize");
1581 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1582 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
1583 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1584 RNA_def_property_update(prop, 0, "rna_Texture_update");
1586 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1587 RNA_def_property_range(prop, 0.001, 0.1);
1588 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1589 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1590 RNA_def_property_update(prop, 0, "rna_Texture_update");
1593 static void rna_def_texture_distorted_noise(BlenderRNA *brna)
1598 srna = RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
1599 RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
1600 RNA_def_struct_sdna(srna, "Tex");
1602 prop = RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
1603 RNA_def_property_float_sdna(prop, NULL, "dist_amount");
1604 RNA_def_property_range(prop, 0, 10);
1605 RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
1606 RNA_def_property_update(prop, 0, "rna_Texture_update");
1608 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1609 RNA_def_property_float_sdna(prop, NULL, "noisesize");
1610 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1611 RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
1612 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1613 RNA_def_property_update(prop, 0, "rna_Texture_update");
1615 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1616 RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
1617 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1618 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1619 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1621 prop = RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
1622 RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
1623 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1624 RNA_def_property_ui_text(prop, "Noise Distortion", "Noise basis for the distortion");
1625 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1627 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1628 RNA_def_property_range(prop, 0.001, 0.1);
1629 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1630 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1631 RNA_def_property_update(prop, 0, "rna_Texture_update");
1634 static void rna_def_texture_pointdensity(BlenderRNA *brna)
1639 static EnumPropertyItem point_source_items[] = {
1640 {TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"},
1641 {TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"},
1642 /*{TEX_PD_FILE, "FILE", 0, "File", ""}, */
1643 {0, NULL, 0, NULL, NULL}
1646 static EnumPropertyItem particle_cache_items[] = {
1647 {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Emit Object Location", ""},
1648 {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Emit Object Space", ""},
1649 {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""},
1650 {0, NULL, 0, NULL, NULL}
1653 static EnumPropertyItem vertex_cache_items[] = {
1654 {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Object Location", ""},
1655 {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Object Space", ""},
1656 {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""},
1657 {0, NULL, 0, NULL, NULL}
1660 static EnumPropertyItem falloff_items[] = {
1661 {TEX_PD_FALLOFF_STD, "STANDARD", 0, "Standard", ""},
1662 {TEX_PD_FALLOFF_SMOOTH, "SMOOTH", 0, "Smooth", ""},
1663 {TEX_PD_FALLOFF_SOFT, "SOFT", 0, "Soft", ""},
1664 {TEX_PD_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", "Density is constant within lookup radius"},
1665 {TEX_PD_FALLOFF_ROOT, "ROOT", 0, "Root", ""},
1666 {TEX_PD_FALLOFF_PARTICLE_AGE, "PARTICLE_AGE", 0, "Particle Age", ""},
1667 {TEX_PD_FALLOFF_PARTICLE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", ""},
1668 {0, NULL, 0, NULL, NULL}
1671 static EnumPropertyItem particle_color_source_items[] = {
1672 {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""},
1673 {TEX_PD_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", "Lifetime mapped as 0.0 - 1.0 intensity"},
1674 {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed",
1675 "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"},
1676 {TEX_PD_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "XYZ velocity mapped to RGB colors"},
1677 {0, NULL, 0, NULL, NULL}
1680 static EnumPropertyItem vertex_color_source_items[] = {
1681 {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""},
1682 {TEX_PD_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
1683 {TEX_PD_COLOR_VERTWEIGHT, "VERTEX_WEIGHT", 0, "Vertex Weight", "Vertex group weight"},
1684 {TEX_PD_COLOR_VERTNOR, "VERTEX_NORMAL", 0, "Vertex Normal", "XYZ normal vector mapped to RGB colors"},
1685 {0, NULL, 0, NULL, NULL}
1688 static EnumPropertyItem turbulence_influence_items[] = {
1689 {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static",
1690 "Noise patterns will remain unchanged, faster and suitable for stills"},
1691 {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity",
1692 "Turbulent noise driven by particle velocity"},
1693 {TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age",
1694 "Turbulent noise driven by the particle's age between birth and death"},
1695 {TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"},
1696 {0, NULL, 0, NULL, NULL}
1699 srna = RNA_def_struct(brna, "PointDensity", NULL);
1700 RNA_def_struct_sdna(srna, "PointDensity");
1701 RNA_def_struct_ui_text(srna, "PointDensity", "Point density settings");
1702 RNA_def_struct_path_func(srna, "rna_PointDensity_path");
1704 prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
1705 RNA_def_property_enum_sdna(prop, NULL, "source");
1706 RNA_def_property_enum_items(prop, point_source_items);
1707 RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
1708 RNA_def_property_update(prop, 0, "rna_Texture_update");
1710 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1711 RNA_def_property_pointer_sdna(prop, NULL, "object");
1712 RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
1713 RNA_def_property_flag(prop, PROP_EDITABLE);
1714 RNA_def_property_update(prop, 0, "rna_Texture_update");
1716 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
1717 RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
1718 RNA_def_property_struct_type(prop, "ParticleSystem");
1719 RNA_def_property_pointer_funcs(prop, "rna_PointDensity_psys_get", "rna_PointDensity_psys_set", NULL, NULL);
1720 RNA_def_property_flag(prop, PROP_EDITABLE);
1721 RNA_def_property_update(prop, 0, "rna_Texture_update");
1723 prop = RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE);
1724 RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space");
1725 RNA_def_property_enum_items(prop, particle_cache_items);
1726 RNA_def_property_ui_text(prop, "Particle Cache", "Coordinate system to cache particles in");
1727 RNA_def_property_update(prop, 0, "rna_Texture_update");
1729 prop = RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE);
1730 RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space");
1731 RNA_def_property_enum_items(prop, vertex_cache_items);
1732 RNA_def_property_ui_text(prop, "Vertices Cache", "Coordinate system to cache vertices in");
1733 RNA_def_property_update(prop, 0, "rna_Texture_update");
1735 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
1736 RNA_def_property_float_sdna(prop, NULL, "radius");
1737 RNA_def_property_range(prop, 0.001, FLT_MAX);
1738 RNA_def_property_ui_text(prop, "Radius", "Radius from the shaded sample to look for points within");
1739 RNA_def_property_update(prop, 0, "rna_Texture_update");
1741 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
1742 RNA_def_property_enum_sdna(prop, NULL, "falloff_type");
1743 RNA_def_property_enum_items(prop, falloff_items);
1744 RNA_def_property_ui_text(prop, "Falloff", "Method of attenuating density by distance from the point");
1745 RNA_def_property_update(prop, 0, "rna_Texture_update");
1747 prop = RNA_def_property(srna, "falloff_soft", PROP_FLOAT, PROP_NONE);
1748 RNA_def_property_float_sdna(prop, NULL, "falloff_softness");
1749 RNA_def_property_range(prop, 0.01, FLT_MAX);
1750 RNA_def_property_ui_text(prop, "Softness", "Softness of the 'soft' falloff option");
1751 RNA_def_property_update(prop, 0, "rna_Texture_update");
1753 prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
1754 RNA_def_property_enum_sdna(prop, NULL, "color_source");
1755 RNA_def_property_enum_items(prop, particle_color_source_items);
1756 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
1757 RNA_def_property_update(prop, 0, "rna_Texture_update");
1759 prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
1760 RNA_def_property_enum_sdna(prop, NULL, "ob_color_source");
1761 RNA_def_property_enum_items(prop, vertex_color_source_items);
1762 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
1763 RNA_def_property_update(prop, 0, "rna_Texture_update");
1765 prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
1766 RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
1767 RNA_def_property_update(prop, 0, "rna_Texture_update");
1769 prop = RNA_def_property(srna, "speed_scale", PROP_FLOAT, PROP_NONE);
1770 RNA_def_property_float_sdna(prop, NULL, "speed_scale");
1771 RNA_def_property_range(prop, 0.001, 100.0);
1772 RNA_def_property_ui_text(prop, "Scale", "Multiplier to bring particle speed within an acceptable range");
1773 RNA_def_property_update(prop, 0, "rna_Texture_update");
1775 prop = RNA_def_property(srna, "falloff_speed_scale", PROP_FLOAT, PROP_NONE);
1776 RNA_def_property_float_sdna(prop, NULL, "falloff_speed_scale");
1777 RNA_def_property_range(prop, 0.001, 100.0);
1778 RNA_def_property_ui_text(prop, "Velocity Scale", "Multiplier to bring particle speed within an acceptable range");
1779 RNA_def_property_update(prop, 0, "rna_Texture_update");
1782 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
1783 RNA_def_property_pointer_sdna(prop, NULL, "coba");
1784 RNA_def_property_struct_type(prop, "ColorRamp");
1785 RNA_def_property_ui_text(prop, "Color Ramp", "");
1786 RNA_def_property_update(prop, 0, "rna_Texture_update");
1788 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NEVER_NULL);
1789 RNA_def_property_pointer_sdna(prop, NULL, "falloff_curve");
1790 RNA_def_property_struct_type(prop, "CurveMapping");
1791 RNA_def_property_ui_text(prop, "Falloff Curve", "");
1792 RNA_def_property_update(prop, 0, "rna_Texture_update");
1794 prop = RNA_def_property(srna, "use_falloff_curve", PROP_BOOLEAN, PROP_NONE);
1795 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_FALLOFF_CURVE);
1796 RNA_def_property_ui_text(prop, "Falloff Curve", "Use a custom falloff curve");
1797 RNA_def_property_update(prop, 0, "rna_Texture_update");
1800 prop = RNA_def_property(srna, "use_turbulence", PROP_BOOLEAN, PROP_NONE);
1801 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_TURBULENCE);
1802 RNA_def_property_ui_text(prop, "Turbulence", "Add directed noise to the density at render-time");
1803 RNA_def_property_update(prop, 0, "rna_Texture_update");
1805 prop = RNA_def_property(srna, "turbulence_scale", PROP_FLOAT, PROP_NONE);
1806 RNA_def_property_float_sdna(prop, NULL, "noise_size");
1807 RNA_def_property_range(prop, 0.01, FLT_MAX);
1808 RNA_def_property_ui_text(prop, "Size", "Scale of the added turbulent noise");
1809 RNA_def_property_update(prop, 0, "rna_Texture_update");
1811 prop = RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE);
1812 RNA_def_property_float_sdna(prop, NULL, "noise_fac");
1813 RNA_def_property_range(prop, 0.01, FLT_MAX);
1814 RNA_def_property_ui_text(prop, "Turbulence Strength", "Strength of the added turbulent noise");
1815 RNA_def_property_update(prop, 0, "rna_Texture_update");
1817 prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
1818 RNA_def_property_int_sdna(prop, NULL, "noise_depth");
1819 RNA_def_property_range(prop, 0, 30);
1820 RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
1821 RNA_def_property_update(prop, 0, "rna_Texture_update");
1823 prop = RNA_def_property(srna, "turbulence_influence", PROP_ENUM, PROP_NONE);
1824 RNA_def_property_enum_sdna(prop, NULL, "noise_influence");
1825 RNA_def_property_enum_items(prop, turbulence_influence_items);
1826 RNA_def_property_ui_text(prop, "Turbulence Influence", "Method for driving added turbulent noise");
1827 RNA_def_property_update(prop, 0, "rna_Texture_update");
1829 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1830 RNA_def_property_enum_sdna(prop, NULL, "noise_basis");
1831 RNA_def_property_enum_items(prop, prop_noise_basis_items);
1832 RNA_def_property_ui_text(prop, "Noise Basis", "Noise formula used for turbulence");
1833 RNA_def_property_update(prop, 0, "rna_Texture_update");
1836 srna = RNA_def_struct(brna, "PointDensityTexture", "Texture");
1837 RNA_def_struct_sdna(srna, "Tex");
1838 RNA_def_struct_ui_text(srna, "Point Density", "Settings for the Point Density texture");
1840 prop = RNA_def_property(srna, "point_density", PROP_POINTER, PROP_NONE);
1841 RNA_def_property_pointer_sdna(prop, NULL, "pd");
1842 RNA_def_property_struct_type(prop, "PointDensity");
1843 RNA_def_property_ui_text(prop, "Point Density", "The point density settings associated with this texture");
1844 RNA_def_property_update(prop, 0, "rna_Texture_update");
1847 static void rna_def_texture_voxeldata(BlenderRNA *brna)
1852 static EnumPropertyItem interpolation_type_items[] = {
1853 {TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor",
1854 "No interpolation, fast but blocky and low quality"},
1855 {TEX_VD_LINEAR, "TRILINEAR", 0, "Linear", "Good smoothness and speed"},
1856 {TEX_VD_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Mid-range quality and speed"},
1857 {TEX_VD_TRICUBIC_CATROM, "TRICUBIC_CATROM", 0, "Cubic Catmull-Rom", "High quality interpolation, but slower"},
1858 {TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline",
1859 "Smoothed high quality interpolation, but slower"},
1860 {0, NULL, 0, NULL, NULL}
1863 static EnumPropertyItem file_format_items[] = {
1864 {TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"},
1865 {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit grayscale binary data"},
1866 /*{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, */
1867 {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence",
1868 "Generate voxels from a sequence of image slices"},
1869 {TEX_VD_SMOKE, "SMOKE", 0, "Smoke", "Render voxels from a Blender smoke simulation"},
1870 {TEX_VD_HAIR, "HAIR", 0, "Hair", "Render voxels from a Blender hair simulation"},
1871 {0, NULL, 0, NULL, NULL}
1874 static EnumPropertyItem voxeldata_extension[] = {
1875 {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
1876 {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
1877 {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
1878 {0, NULL, 0, NULL, NULL}
1881 static EnumPropertyItem smoked_type_items[] = {
1882 {TEX_VD_SMOKEDENSITY, "SMOKEDENSITY", 0, "Smoke", "Use smoke density and color as texture data"},
1883 {TEX_VD_SMOKEFLAME, "SMOKEFLAME", 0, "Flame", "Use flame temperature as texture data"},
1884 {TEX_VD_SMOKEHEAT, "SMOKEHEAT", 0, "Heat", "Use smoke heat as texture data. Values from -2.0 to 2.0 are used"},
1885 {TEX_VD_SMOKEVEL, "SMOKEVEL", 0, "Velocity", "Use smoke velocity as texture data"},
1886 {0, NULL, 0, NULL, NULL}
1889 static EnumPropertyItem hair_type_items[] = {
1890 {TEX_VD_HAIRDENSITY, "HAIRDENSITY", 0, "Density", "Use hair density as texture data"},
1891 {TEX_VD_HAIRRESTDENSITY, "HAIRRESTDENSITY", 0, "Rest Density", "Use hair rest density as texture data"},
1892 {TEX_VD_HAIRVELOCITY, "HAIRVELOCITY", 0, "Velocity", "Use hair velocity as texture data"},
1893 {TEX_VD_HAIRENERGY, "HAIRENERGY", 0, "Energy", "Use potential hair energy as texture data"},
1894 {0, NULL, 0, NULL, NULL}
1897 srna = RNA_def_struct(brna, "VoxelData", NULL);
1898 RNA_def_struct_sdna(srna, "VoxelData");
1899 RNA_def_struct_ui_text(srna, "VoxelData", "Voxel data settings");
1900 RNA_def_struct_path_func(srna, "rna_VoxelData_path");
1902 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
1903 RNA_def_property_enum_sdna(prop, NULL, "interp_type");
1904 RNA_def_property_enum_items(prop, interpolation_type_items);
1905 RNA_def_property_ui_text(prop, "Interpolation", "Method to interpolate/smooth values between voxel cells");
1906 RNA_def_property_update(prop, 0, "rna_Texture_update");
1908 prop = RNA_def_property(srna, "smoke_data_type", PROP_ENUM, PROP_NONE);
1909 RNA_def_property_enum_sdna(prop, NULL, "smoked_type");
1910 RNA_def_property_enum_items(prop, smoked_type_items);
1911 RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
1912 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1914 prop = RNA_def_property(srna, "hair_data_type", PROP_ENUM, PROP_NONE);
1915 RNA_def_property_enum_sdna(prop, NULL, "hair_type");
1916 RNA_def_property_enum_items(prop, hair_type_items);
1917 RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
1918 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1920 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
1921 RNA_def_property_enum_sdna(prop, NULL, "extend");
1922 RNA_def_property_enum_items(prop, voxeldata_extension);
1923 RNA_def_property_ui_text(prop, "Extension", "How the texture is extrapolated past its original bounds");
1924 RNA_def_property_update(prop, 0, "rna_Texture_update");
1926 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
1927 RNA_def_property_float_sdna(prop, NULL, "int_multiplier");
1928 RNA_def_property_range(prop, 0.01, FLT_MAX);
1929 RNA_def_property_ui_text(prop, "Intensity", "Multiplier for intensity values");
1930 RNA_def_property_update(prop, 0, "rna_Texture_update");
1932 prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
1933 RNA_def_property_enum_sdna(prop, NULL, "file_format");
1934 RNA_def_property_enum_items(prop, file_format_items);
1935 RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render");
1936 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1938 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1939 RNA_def_property_string_sdna(prop, NULL, "source_path");
1940 RNA_def_property_ui_text(prop, "Source Path", "The external source data file to use");
1941 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1943 prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
1944 RNA_def_property_int_sdna(prop, NULL, "resol");
1945 RNA_def_property_range(prop, 1, 100000);
1946 RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid");
1947 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1949 prop = RNA_def_property(srna, "use_still_frame", PROP_BOOLEAN, PROP_NONE);
1950 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_VD_STILL);
1951 RNA_def_property_ui_text(prop, "Still Frame Only", "Always render a still frame from the voxel data sequence");
1952 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1954 prop = RNA_def_property(srna, "still_frame", PROP_INT, PROP_NONE);
1955 RNA_def_property_int_sdna(prop, NULL, "still_frame");
1956 RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
1957 RNA_def_property_ui_text(prop, "Still Frame Number", "The frame number to always use");
1958 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1960 prop = RNA_def_property(srna, "domain_object", PROP_POINTER, PROP_NONE);
1961 RNA_def_property_pointer_sdna(prop, NULL, "object");
1962 RNA_def_property_ui_text(prop, "Domain Object", "Object used as the smoke simulation domain");
1963 RNA_def_property_flag(prop, PROP_EDITABLE);
1964 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1967 srna = RNA_def_struct(brna, "VoxelDataTexture", "Texture");
1968 RNA_def_struct_sdna(srna, "Tex");
1969 RNA_def_struct_ui_text(srna, "Voxel Data", "Settings for the Voxel Data texture");
1971 prop = RNA_def_property(srna, "voxel_data", PROP_POINTER, PROP_NONE);
1972 RNA_def_property_pointer_sdna(prop, NULL, "vd");
1973 RNA_def_property_struct_type(prop, "VoxelData");
1974 RNA_def_property_ui_text(prop, "Voxel Data", "The voxel data associated with this texture");
1975 RNA_def_property_update(prop, 0, "rna_Texture_update");
1977 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1978 RNA_def_property_pointer_sdna(prop, NULL, "ima");
1979 RNA_def_property_struct_type(prop, "Image");
1980 RNA_def_property_flag(prop, PROP_EDITABLE);
1981 RNA_def_property_ui_text(prop, "Image", "");
1982 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_image_update");
1984 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
1985 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1986 RNA_def_property_ui_text(prop, "Image User",
1987 "Parameters defining which layer, pass and frame of the image is displayed");
1988 RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
1991 static void rna_def_texture_ocean(BlenderRNA *brna)
1996 static EnumPropertyItem ocean_output_items[] = {
1997 {TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Output XYZ displacement in RGB channels"},
1998 /*{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"}, *//* these are in nor channel now */
1999 {TEX_OCN_FOAM, "FOAM", 0, "Foam", "Output Foam (wave overlap) amount in single channel"},
2000 {TEX_OCN_JPLUS, "JPLUS", 0, "Eigenvalues", "Positive Eigenvalues"},
2001 {TEX_OCN_EMINUS, "EMINUS", 0, "Eigenvectors (-)", "Negative Eigenvectors"},
2002 {TEX_OCN_EPLUS, "EPLUS", 0, "Eigenvectors (+)", "Positive Eigenvectors"},
2003 {0, NULL, 0, NULL, NULL}
2006 srna = RNA_def_struct(brna, "OceanTexData", NULL);
2007 RNA_def_struct_sdna(srna, "OceanTex");
2008 RNA_def_struct_ui_text(srna, "Ocean", "Ocean Texture settings");
2009 RNA_def_struct_path_func(srna, "rna_OceanTex_path");
2011 prop = RNA_def_property(srna, "output", PROP_ENUM, PROP_NONE);
2012 RNA_def_property_enum_sdna(prop, NULL, "output");
2013 RNA_def_property_enum_items(prop, ocean_output_items);
2014 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2015 RNA_def_property_ui_text(prop, "Output", "The data that is output by the texture");
2016 RNA_def_property_update(prop, 0, "rna_Texture_update");
2018 prop = RNA_def_property(srna, "ocean_object", PROP_POINTER, PROP_NONE);
2019 RNA_def_property_pointer_sdna(prop, NULL, "object");
2020 RNA_def_property_ui_text(prop, "Modifier Object", "Object containing the ocean modifier");
2021 RNA_def_property_flag(prop, PROP_EDITABLE);
2022 RNA_def_property_update(prop, 0, "rna_Texture_update");
2024 srna = RNA_def_struct(brna, "OceanTexture", "Texture");
2025 RNA_def_struct_sdna(srna, "Tex");
2026 RNA_def_struct_ui_text(srna, "Ocean", "Settings for the Ocean texture");
2028 prop = RNA_def_property(srna, "ocean", PROP_POINTER, PROP_NONE);
2029 RNA_def_property_pointer_sdna(prop, NULL, "ot");
2030 RNA_def_property_struct_type(prop, "OceanTexData");
2031 RNA_def_property_ui_text(prop, "Ocean", "The ocean data associated with this texture");
2032 RNA_def_property_update(prop, 0, "rna_Texture_update");
2035 static void rna_def_texture(BlenderRNA *brna)
2040 srna = RNA_def_struct(brna, "Texture", "ID");
2041 RNA_def_struct_sdna(srna, "Tex");
2042 RNA_def_struct_ui_text(srna, "Texture", "Texture data-block used by materials, lamps, worlds and brushes");
2043 RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
2044 RNA_def_struct_refine_func(srna, "rna_Texture_refine");
2046 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2047 /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2048 RNA_def_property_enum_sdna(prop, NULL, "type");
2049 RNA_def_property_enum_items(prop, rna_enum_texture_type_items);
2050 RNA_def_property_enum_funcs(prop, NULL, "rna_Texture_type_set", NULL);
2051 RNA_def_property_ui_text(prop, "Type", "");
2052 RNA_def_property_update(prop, 0, "rna_Texture_update");
2054 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
2055 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TEX_NO_CLAMP);
2056 RNA_def_property_ui_text(prop, "Clamp", "Set negative texture RGB and intensity values to zero, for some uses like displacement this option can be disabled to get the full range");
2057 RNA_def_property_update(prop, 0, "rna_Texture_update");
2059 prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
2060 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
2061 RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
2062 RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
2063 RNA_def_property_update(prop, 0, "rna_Texture_update");
2065 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
2066 RNA_def_property_pointer_sdna(prop, NULL, "coba");
2067 RNA_def_property_struct_type(prop, "ColorRamp");
2068 RNA_def_property_ui_text(prop, "Color Ramp", "");
2069 RNA_def_property_update(prop, 0, "rna_Texture_update");
2071 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
2072 RNA_def_property_float_sdna(prop, NULL, "bright");
2073 RNA_def_property_range(prop, 0, 2);
2074 RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
2075 RNA_def_property_update(prop, 0, "rna_Texture_update");
2077 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
2078 RNA_def_property_range(prop, 0.0, 5);
2079 RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
2080 RNA_def_property_update(prop, 0, "rna_Texture_update");
2082 prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
2083 RNA_def_property_range(prop, 0, 2);
2084 RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
2085 RNA_def_property_update(prop, 0, "rna_Texture_update");
2088 prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
2089 RNA_def_property_float_sdna(prop, NULL, "rfac");
2090 RNA_def_property_range(prop, 0, 2);
2091 RNA_def_property_ui_text(prop, "Factor Red", "");
2092 RNA_def_property_update(prop, 0, "rna_Texture_update");
2094 prop = RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
2095 RNA_def_property_float_sdna(prop, NULL, "gfac");
2096 RNA_def_property_range(prop, 0, 2);
2097 RNA_def_property_ui_text(prop, "Factor Green", "");
2098 RNA_def_property_update(prop, 0, "rna_Texture_update");
2100 prop = RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
2101 RNA_def_property_float_sdna(prop, NULL, "bfac");
2102 RNA_def_property_range(prop, 0, 2);
2103 RNA_def_property_ui_text(prop, "Factor Blue", "");
2104 RNA_def_property_update(prop, 0, "rna_Texture_update");
2106 /* Alpha for preview render */
2107 prop = RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
2108 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PRV_ALPHA);
2109 RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
2110 RNA_def_property_update(prop, 0, "rna_Texture_update");
2113 prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
2114 RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
2115 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2116 RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
2117 RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update");
2119 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
2120 RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
2121 RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
2122 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
2124 rna_def_animdata_common(srna);
2126 /* specific types */
2127 rna_def_texture_clouds(brna);
2128 rna_def_texture_wood(brna);
2129 rna_def_texture_marble(brna);
2130 rna_def_texture_magic(brna);
2131 rna_def_texture_blend(brna);
2132 rna_def_texture_stucci(brna);
2133 rna_def_texture_noise(brna);
2134 rna_def_texture_image(brna);
2135 rna_def_texture_environment_map(brna);
2136 rna_def_texture_musgrave(brna);
2137 rna_def_texture_voronoi(brna);
2138 rna_def_texture_distorted_noise(brna);
2139 rna_def_texture_pointdensity(brna);
2140 rna_def_texture_voxeldata(brna);
2141 rna_def_texture_ocean(brna);
2142 /* XXX add more types here .. */
2144 RNA_api_texture(srna);
2147 void RNA_def_texture(BlenderRNA *brna)
2149 rna_def_texture(brna);
2151 rna_def_environment_map(brna);
2152 rna_def_texmapping(brna);
2153 rna_def_colormapping(brna);