Blender V4.5
rna_texture.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cfloat>
10#include <cstdlib>
11
12#include "DNA_texture_types.h"
13
14#include "BKE_paint.hh"
15
16#include "BLT_translation.hh"
17
18#include "RNA_define.hh"
19#include "RNA_enum_types.hh"
20
21#include "rna_internal.hh"
22
23#include "WM_api.hh"
24#include "WM_types.hh"
25
26#ifndef RNA_RUNTIME
28 {TXF_BOX, "BOX", 0, "Box", ""},
29 {TXF_EWA, "EWA", 0, "EWA", ""},
30 {TXF_FELINE, "FELINE", 0, "FELINE", ""},
31 {TXF_AREA, "AREA", 0, "Area", ""},
32 {0, nullptr, 0, nullptr, nullptr},
33};
34#endif
35
37 {0, "NONE", 0, "None", ""},
38 {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"},
40 "CLOUDS",
41 ICON_TEXTURE,
42 "Clouds",
43 "Procedural - create a cloud-like fractal noise texture"},
45 "DISTORTED_NOISE",
46 ICON_TEXTURE,
47 "Distorted Noise",
48 "Procedural - noise texture distorted by two noise algorithms"},
49 {TEX_IMAGE,
50 "IMAGE",
51 ICON_IMAGE_DATA,
52 "Image or Movie",
53 "Allow for images or movies to be used as textures"},
54 {TEX_MAGIC,
55 "MAGIC",
56 ICON_TEXTURE,
57 "Magic",
58 "Procedural - color texture based on trigonometric functions"},
60 "MARBLE",
61 ICON_TEXTURE,
62 "Marble",
63 "Procedural - marble-like noise texture with wave generated bands"},
65 "MUSGRAVE",
66 ICON_TEXTURE,
67 "Musgrave",
68 "Procedural - highly flexible fractal noise texture"},
69 {TEX_NOISE,
70 "NOISE",
71 ICON_TEXTURE,
72 "Noise",
73 "Procedural - random noise, gives a different result every time, for every frame, for every "
74 "pixel"},
75 {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
77 "VORONOI",
78 ICON_TEXTURE,
79 "Voronoi",
80 "Procedural - create cell-like patterns based on Worley noise"},
81 {TEX_WOOD,
82 "WOOD",
83 ICON_TEXTURE,
84 "Wood",
85 "Procedural - wave generated bands or rings, with optional noise"},
86 {0, nullptr, 0, nullptr, nullptr},
87};
88
89#ifndef RNA_RUNTIME
91 {MTEX_BLEND, "MIX", 0, "Mix", ""},
93 {MTEX_DARK, "DARKEN", 0, "Darken", ""},
94 {MTEX_MUL, "MULTIPLY", 0, "Multiply", ""},
96 {MTEX_LIGHT, "LIGHTEN", 0, "Lighten", ""},
97 {MTEX_SCREEN, "SCREEN", 0, "Screen", ""},
98 {MTEX_ADD, "ADD", 0, "Add", ""},
100 {MTEX_OVERLAY, "OVERLAY", 0, "Overlay", ""},
101 {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
102 {MTEX_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
104 {MTEX_DIFF, "DIFFERENCE", 0, "Difference", ""},
105 {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""},
106 {MTEX_DIV, "DIVIDE", 0, "Divide", ""},
108 {MTEX_BLEND_HUE, "HUE", 0, "Hue", ""},
109 {MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
110 {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
111 {MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
112 {0, nullptr, 0, nullptr, nullptr},
113};
114#endif
115
116#ifdef RNA_RUNTIME
117
118# include <fmt/format.h>
119
120# include "DNA_particle_types.h"
121
122# include "MEM_guardedalloc.h"
123
124# include "RNA_access.hh"
125
126# include "BKE_brush.hh"
127# include "BKE_colorband.hh"
128# include "BKE_context.hh"
129# include "BKE_image.hh"
130# include "BKE_main.hh"
131# include "BKE_main_invariants.hh"
132# include "BKE_node_legacy_types.hh"
133# include "BKE_node_runtime.hh"
134# include "BKE_node_tree_update.hh"
135# include "BKE_texture.h"
136
137# include "DEG_depsgraph.hh"
138# include "DEG_depsgraph_build.hh"
139
140# include "ED_node.hh"
141# include "ED_render.hh"
142
143static StructRNA *rna_Texture_refine(PointerRNA *ptr)
144{
145 Tex *tex = (Tex *)ptr->data;
146
147 switch (tex->type) {
148 case TEX_BLEND:
149 return &RNA_BlendTexture;
150 case TEX_CLOUDS:
151 return &RNA_CloudsTexture;
152 case TEX_DISTNOISE:
153 return &RNA_DistortedNoiseTexture;
154 case TEX_IMAGE:
155 return &RNA_ImageTexture;
156 case TEX_MAGIC:
157 return &RNA_MagicTexture;
158 case TEX_MARBLE:
159 return &RNA_MarbleTexture;
160 case TEX_MUSGRAVE:
161 return &RNA_MusgraveTexture;
162 case TEX_NOISE:
163 return &RNA_NoiseTexture;
164 case TEX_STUCCI:
165 return &RNA_StucciTexture;
166 case TEX_VORONOI:
167 return &RNA_VoronoiTexture;
168 case TEX_WOOD:
169 return &RNA_WoodTexture;
170 default:
171 return &RNA_Texture;
172 }
173}
174
175static void rna_Texture_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
176{
177 ID *id = ptr->owner_id;
178
179 if (GS(id->name) == ID_TE) {
180 Tex *tex = (Tex *)ptr->owner_id;
181
182 DEG_id_tag_update(&tex->id, 0);
186 }
187 else if (GS(id->name) == ID_NT) {
188 bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
189 BKE_main_ensure_invariants(*bmain, ntree->id);
190 }
191}
192
193static void rna_Texture_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
194{
195 ID *id = ptr->owner_id;
196 TexMapping *texmap = static_cast<TexMapping *>(ptr->data);
198
199 if (GS(id->name) == ID_NT) {
200 bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
201 /* Try to find and tag the node that this #TexMapping belongs to. */
202 for (bNode *node : ntree->all_nodes()) {
203 /* This assumes that the #TexMapping is stored at the beginning of the node storage. This is
204 * generally true, see #NodeTexBase. If the assumption happens to be false, there might be a
205 * missing update. */
206 if (node->storage == texmap) {
208 }
209 }
210 }
211
212 rna_Texture_update(bmain, scene, ptr);
213}
214
215static void rna_Color_mapping_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA * /*ptr*/)
216{
217 /* nothing to do */
218}
219
220/* Used for Texture Properties, used (also) for/in Nodes */
221static void rna_Texture_nodes_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
222{
223 Tex *tex = (Tex *)ptr->owner_id;
224
225 DEG_id_tag_update(&tex->id, 0);
228}
229
230static void rna_Texture_type_set(PointerRNA *ptr, int value)
231{
232 Tex *tex = (Tex *)ptr->data;
233
234 BKE_texture_type_set(tex, value);
235}
236
237void rna_TextureSlotTexture_update(bContext *C, PointerRNA *ptr)
238{
241}
242
244{
245 ID *id = ptr->owner_id;
246
247 DEG_id_tag_update(id, 0);
248
249 switch (GS(id->name)) {
250 case ID_MA:
253 break;
254 case ID_WO:
256 break;
257 case ID_LA:
260 break;
261 case ID_BR: {
262 Scene *scene = CTX_data_scene(C);
263 MTex *mtex = static_cast<MTex *>(ptr->data);
264 ViewLayer *view_layer = CTX_data_view_layer(C);
265 BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex);
266 BKE_brush_tag_unsaved_changes(reinterpret_cast<Brush *>(id));
268 break;
269 }
270 case ID_LS:
272 break;
273 case ID_PA: {
274 MTex *mtex = static_cast<MTex *>(ptr->data);
275 int recalc = ID_RECALC_GEOMETRY;
276
277 if (mtex->mapto & PAMAP_INIT) {
278 recalc |= ID_RECALC_PSYS_RESET;
279 }
280 if (mtex->mapto & PAMAP_CHILD) {
281 recalc |= ID_RECALC_PSYS_CHILD;
282 }
283
284 DEG_id_tag_update(id, recalc);
286 break;
287 }
288 default:
289 break;
290 }
291}
292
293std::optional<std::string> rna_TextureSlot_path(const PointerRNA *ptr)
294{
295 MTex *mtex = static_cast<MTex *>(ptr->data);
296
297 /* if there is ID-data, resolve the path using the index instead of by name,
298 * since the name used is the name of the texture assigned, but the texture
299 * may be used multiple times in the same stack
300 */
301 if (ptr->owner_id) {
302 if (GS(ptr->owner_id->name) == ID_BR) {
303 return "texture_slot";
304 }
305 else {
306 PropertyRNA *prop;
307
308 /* find the 'textures' property of the ID-struct */
309 PointerRNA id_ptr = RNA_id_pointer_create(ptr->owner_id);
310 prop = RNA_struct_find_property(&id_ptr, "texture_slots");
311
312 /* get an iterator for this property, and try to find the relevant index */
313 if (prop) {
314 int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
315
316 if (index != -1) {
317 return fmt::format("texture_slots[{}]", index);
318 }
319 }
320 }
321 }
322
323 /* this is a compromise for the remaining cases... */
324 if (mtex->tex) {
325 char name_esc[(sizeof(mtex->tex->id.name) - 2) * 2];
326
327 BLI_str_escape(name_esc, mtex->tex->id.name + 2, sizeof(name_esc));
328 return fmt::format("texture_slots[\"{}\"]", name_esc);
329 }
330
331 return "texture_slots[0]";
332}
333
334static int rna_TextureSlot_name_length(PointerRNA *ptr)
335{
336 MTex *mtex = static_cast<MTex *>(ptr->data);
337
338 if (mtex->tex) {
339 return strlen(mtex->tex->id.name + 2);
340 }
341
342 return 0;
343}
344
345static void rna_TextureSlot_name_get(PointerRNA *ptr, char *value)
346{
347 MTex *mtex = static_cast<MTex *>(ptr->data);
348
349 if (mtex->tex) {
350 strcpy(value, mtex->tex->id.name + 2);
351 }
352 else {
353 value[0] = '\0';
354 }
355}
356
357static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
358{
359 MTex *mtex = static_cast<MTex *>(ptr->data);
360 Tex *tex = mtex->tex;
361 int cur = mtex->which_output;
362
363 if (tex) {
364 bNodeTree *ntree = tex->nodetree;
365 bNode *node;
366 if (ntree) {
367 for (node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
368 if (node->type_legacy == TEX_NODE_OUTPUT) {
369 if (cur == node->custom1) {
370 return cur;
371 }
372 }
373 }
374 }
375 }
376
377 mtex->which_output = 0;
378 return 0;
379}
380
381static const EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext * /*C*/,
383 PropertyRNA * /*prop*/,
384 bool *r_free)
385{
386 MTex *mtex = static_cast<MTex *>(ptr->data);
387 Tex *tex = mtex->tex;
388 EnumPropertyItem *item = nullptr;
389 int totitem = 0;
390
391 if (tex) {
392 bNodeTree *ntree = tex->nodetree;
393 if (ntree) {
394 EnumPropertyItem tmp = {0, "", 0, "", ""};
395 bNode *node;
396
397 tmp.value = 0;
398 tmp.name = "Not Specified";
399 tmp.identifier = "NOT_SPECIFIED";
400 RNA_enum_item_add(&item, &totitem, &tmp);
401
402 for (node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
403 if (node->type_legacy == TEX_NODE_OUTPUT) {
404 tmp.value = node->custom1;
405 tmp.name = ((TexNodeOutput *)node->storage)->name;
406 tmp.identifier = tmp.name;
407 RNA_enum_item_add(&item, &totitem, &tmp);
408 }
409 }
410 }
411 }
412
413 RNA_enum_item_end(&item, &totitem);
414 *r_free = true;
415
416 return item;
417}
418
419static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, bool value)
420{
421 Tex *tex = (Tex *)ptr->data;
422
423 if (value) {
424 tex->flag |= TEX_COLORBAND;
425 }
426 else {
427 tex->flag &= ~TEX_COLORBAND;
428 }
429
430 if ((tex->flag & TEX_COLORBAND) && tex->coba == nullptr) {
431 tex->coba = BKE_colorband_add(false);
432 }
433}
434
435static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr)
436{
437 Tex *tex = (Tex *)ptr->data;
438
439 if (tex->use_nodes) {
440 tex->type = 0;
441
442 if (tex->nodetree == nullptr) {
444 }
445 }
446
447 rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr);
448}
449
450static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, bool value)
451{
452 Tex *tex = (Tex *)ptr->data;
453
454 if (value) {
455 tex->imaflag |= TEX_MIPMAP;
456 }
457 else {
458 tex->imaflag &= ~TEX_MIPMAP;
459 }
460}
461
462#else
463
465{
466 static const EnumPropertyItem prop_mapping_items[] = {
467 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
468 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
469 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
470 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
471 {0, nullptr, 0, nullptr, nullptr},
472 };
473
474 static const EnumPropertyItem prop_xyz_mapping_items[] = {
475 {0, "NONE", 0, "None", ""},
476 {1, "X", 0, "X", ""},
477 {2, "Y", 0, "Y", ""},
478 {3, "Z", 0, "Z", ""},
479 {0, nullptr, 0, nullptr, nullptr},
480 };
481
482 StructRNA *srna;
483 PropertyRNA *prop;
484
485 srna = RNA_def_struct(brna, "TexMapping", nullptr);
486 RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
487
488 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
489 RNA_def_property_enum_sdna(prop, nullptr, "type");
491 RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
492 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
493
494 prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
495 RNA_def_property_float_sdna(prop, nullptr, "loc");
496 RNA_def_property_ui_text(prop, "Location", "");
498 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
499
500 /* Not PROP_XYZ, this is now in radians, no more degrees */
501 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
502 RNA_def_property_float_sdna(prop, nullptr, "rot");
503 RNA_def_property_ui_text(prop, "Rotation", "");
505 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
506
507 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
508 RNA_def_property_float_sdna(prop, nullptr, "size");
510 RNA_def_property_ui_text(prop, "Scale", "");
511 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
512
513 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
514 RNA_def_property_float_sdna(prop, nullptr, "min");
515 RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
516 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
517
518 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
519 RNA_def_property_float_sdna(prop, nullptr, "max");
520 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
521 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
522
523 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
524 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MIN);
525 RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
526 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
527
528 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
529 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MAX);
530 RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
531 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
532
533 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
534 RNA_def_property_enum_sdna(prop, nullptr, "projx");
535 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
536 RNA_def_property_ui_text(prop, "X Mapping", "");
537 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
538
539 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
540 RNA_def_property_enum_sdna(prop, nullptr, "projy");
541 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
542 RNA_def_property_ui_text(prop, "Y Mapping", "");
543 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
544
545 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
546 RNA_def_property_enum_sdna(prop, nullptr, "projz");
547 RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
548 RNA_def_property_ui_text(prop, "Z Mapping", "");
549 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
550
551 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
552 RNA_def_property_enum_items(prop, prop_mapping_items);
553 RNA_def_property_ui_text(prop, "Mapping", "");
555 RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
556}
557
559{
560 StructRNA *srna;
561 PropertyRNA *prop;
562
563 srna = RNA_def_struct(brna, "ColorMapping", nullptr);
564 RNA_def_struct_ui_text(srna, "Color Mapping", "Color mapping settings");
565
566 prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
567 RNA_def_property_boolean_sdna(prop, nullptr, "flag", COLORMAP_USE_RAMP);
568 RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
569 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
570
571 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
572 RNA_def_property_pointer_sdna(prop, nullptr, "coba");
573 RNA_def_property_struct_type(prop, "ColorRamp");
574 RNA_def_property_ui_text(prop, "Color Ramp", "");
575 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
576
577 prop = RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
578 RNA_def_property_float_sdna(prop, nullptr, "bright");
579 RNA_def_property_range(prop, 0, 2);
580 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
581 RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
582 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
583
584 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
585 RNA_def_property_range(prop, 0.0, 5);
586 RNA_def_property_ui_range(prop, 0, 5, 1, 3);
587 RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
588 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
589
590 prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
591 RNA_def_property_range(prop, 0, 2);
592 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
593 RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
594 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
595
596 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
598 RNA_def_property_ui_text(prop, "Blend Type", "Mode used to mix with texture output color");
599 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
600
601 prop = RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
602 RNA_def_property_array(prop, 3);
603 RNA_def_property_ui_text(prop, "Color", "Blend color to mix with texture output color");
604 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
605
606 prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
607 RNA_def_property_ui_text(prop, "Blend Factor", "");
608 RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
609}
610
611static void rna_def_mtex(BlenderRNA *brna)
612{
613 StructRNA *srna;
614 PropertyRNA *prop;
615
616 srna = RNA_def_struct(brna, "TextureSlot", nullptr);
617 RNA_def_struct_sdna(srna, "MTex");
619 srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
620 RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
621 RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
622
623 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
624 RNA_def_property_pointer_sdna(prop, nullptr, "tex");
625 RNA_def_property_struct_type(prop, "Texture");
628 RNA_def_property_ui_text(prop, "Texture", "Texture data-block used by this texture slot");
629 RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlotTexture_update");
630
631 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
633 prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", nullptr);
634 RNA_def_property_ui_text(prop, "Name", "Texture slot name");
638 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
639
640 /* mapping */
641 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
642 RNA_def_property_float_sdna(prop, nullptr, "ofs");
646 prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations");
647 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
648
649 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
650 RNA_def_property_float_sdna(prop, nullptr, "size");
652 RNA_def_property_ui_range(prop, -100, 100, 10, 2);
653 RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes");
654 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
655
656 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
657 RNA_def_property_float_sdna(prop, nullptr, "r");
658 RNA_def_property_array(prop, 3);
661 prop,
662 "Color",
663 "Default color for textures that don't return RGB or when RGB to intensity is enabled");
664 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
665
666 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
667 RNA_def_property_enum_sdna(prop, nullptr, "blendtype");
670 RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
671 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
672
673 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
674 RNA_def_property_float_sdna(prop, nullptr, "def_var");
676 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
678 prop,
679 "Default Value",
680 "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
681 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
682
683 prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
684 RNA_def_property_enum_sdna(prop, nullptr, "which_output");
688 prop, "rna_TextureSlot_output_node_get", nullptr, "rna_TextureSlot_output_node_itemf");
690 prop, "Output Node", "Which output node to use, for node-based textures");
691 RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
692}
693
695{
696 PropertyRNA *prop;
697
698 prop = RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
699 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_MIPMAP);
700 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ImageTexture_mipmap_set");
701 RNA_def_property_ui_text(prop, "MIP Map", "Use auto-generated MIP maps for the image");
702 RNA_def_property_update(prop, 0, "rna_Texture_update");
703
704 prop = RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
705 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_GAUSS_MIP);
707 prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps");
708 RNA_def_property_update(prop, 0, "rna_Texture_update");
709
710 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
711 RNA_def_property_enum_sdna(prop, nullptr, "texfilter");
713 RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
714 RNA_def_property_update(prop, 0, "rna_Texture_update");
715
716 prop = RNA_def_property(srna, "filter_lightprobes", PROP_INT, PROP_NONE);
717 RNA_def_property_int_sdna(prop, nullptr, "afmax");
718 RNA_def_property_range(prop, 1, 256);
720 prop,
721 "Filter Probes",
722 "Maximum number of samples (higher gives less blur at distant/oblique angles, "
723 "but is also slower)");
724 RNA_def_property_update(prop, 0, "rna_Texture_update");
725
726 prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
727 RNA_def_property_int_sdna(prop, nullptr, "afmax");
728 RNA_def_property_range(prop, 1, 256);
730 prop,
731 "Filter Eccentricity",
732 "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
733 "but is also slower)");
734 RNA_def_property_update(prop, 0, "rna_Texture_update");
735
736 prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
737 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_FILTER_MIN);
739 prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
740 RNA_def_property_update(prop, 0, "rna_Texture_update");
741
742 prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
743 RNA_def_property_float_sdna(prop, nullptr, "filtersize");
744 RNA_def_property_range(prop, 0.1, 50.0);
745 RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 2);
747 prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation");
748 RNA_def_property_update(prop, 0, "rna_Texture_update");
749}
750
753 "BLENDER_ORIGINAL",
754 0,
755 "Blender Original",
756 "Noise algorithm - Blender original: Smooth interpolated noise"},
758 "ORIGINAL_PERLIN",
759 0,
760 "Original Perlin",
761 "Noise algorithm - Original Perlin: Smooth interpolated noise"},
763 "IMPROVED_PERLIN",
764 0,
765 "Improved Perlin",
766 "Noise algorithm - Improved Perlin: Smooth interpolated noise"},
768 "VORONOI_F1",
769 0,
770 "Voronoi F1",
771 "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"},
773 "VORONOI_F2",
774 0,
775 "Voronoi F2",
776 "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"},
778 "VORONOI_F3",
779 0,
780 "Voronoi F3",
781 "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"},
783 "VORONOI_F4",
784 0,
785 "Voronoi F4",
786 "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"},
787 {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"},
789 "VORONOI_CRACKLE",
790 0,
791 "Voronoi Crackle",
792 "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
794 "CELL_NOISE",
795 0,
796 "Cell Noise",
797 "Noise algorithm - Cell Noise: Square cell tessellation"},
798 {0, nullptr, 0, nullptr, nullptr},
799};
800
802 {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
803 {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
804 {0, nullptr, 0, nullptr, nullptr},
805};
806
808{
809 StructRNA *srna;
810 PropertyRNA *prop;
811
812 static const EnumPropertyItem prop_clouds_stype[] = {
813 {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""},
814 {TEX_COLOR, "COLOR", 0, "Color", ""},
815 {0, nullptr, 0, nullptr, nullptr},
816 };
817
818 srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
819 RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
820 RNA_def_struct_sdna(srna, "Tex");
821
822 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
823 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
824 RNA_def_property_range(prop, 0.0001, FLT_MAX);
825 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
826 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
827 RNA_def_property_update(prop, 0, "rna_Texture_update");
828
829 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
830 RNA_def_property_int_sdna(prop, nullptr, "noisedepth");
831 RNA_def_property_range(prop, 0, 30);
832 RNA_def_property_ui_range(prop, 0, 24, 1, 2);
833 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
834 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
835
836 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
837 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
839 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
840 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
841
842 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
843 RNA_def_property_enum_sdna(prop, nullptr, "noisetype");
845 RNA_def_property_ui_text(prop, "Noise Type", "");
846 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
847
848 prop = RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
849 RNA_def_property_enum_sdna(prop, nullptr, "stype");
850 RNA_def_property_enum_items(prop, prop_clouds_stype);
852 prop, "Color", "Determine whether Noise returns grayscale or RGB values");
853 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
854
855 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
856 RNA_def_property_range(prop, 0.001, 0.1);
857 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
858 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
859 RNA_def_property_update(prop, 0, "rna_Texture_update");
860}
861
863{
864 StructRNA *srna;
865 PropertyRNA *prop;
866
867 static const EnumPropertyItem prop_wood_stype[] = {
868 {TEX_BAND, "BANDS", 0, "Bands", "Use standard wood texture in bands"},
869 {TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"},
870 {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"},
871 {TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Add noise to rings"},
872 {0, nullptr, 0, nullptr, nullptr},
873 };
874
875 static const EnumPropertyItem prop_wood_noisebasis2[] = {
876 {TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"},
877 {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
878 {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
879 {0, nullptr, 0, nullptr, nullptr},
880 };
881
882 srna = RNA_def_struct(brna, "WoodTexture", "Texture");
883 RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
884 RNA_def_struct_sdna(srna, "Tex");
885
886 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
887 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
888 RNA_def_property_range(prop, 0.0001, FLT_MAX);
889 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
890 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
891 RNA_def_property_update(prop, 0, "rna_Texture_update");
892
893 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
894 RNA_def_property_float_sdna(prop, nullptr, "turbul");
895 RNA_def_property_range(prop, 0.0001, FLT_MAX);
896 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
897 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
898 RNA_def_property_update(prop, 0, "rna_Texture_update");
899
900 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
901 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
903 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
904 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
905
906 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
907 RNA_def_property_enum_sdna(prop, nullptr, "noisetype");
909 RNA_def_property_ui_text(prop, "Noise Type", "");
910 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
911
912 prop = RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
913 RNA_def_property_enum_sdna(prop, nullptr, "stype");
914 RNA_def_property_enum_items(prop, prop_wood_stype);
915 RNA_def_property_ui_text(prop, "Pattern", "");
917 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
918
919 prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
920 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis2");
921 RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
922 RNA_def_property_ui_text(prop, "Noise Basis 2", "");
923 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
924
925 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
926 RNA_def_property_range(prop, 0.001, 0.1);
927 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
928 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
929 RNA_def_property_update(prop, 0, "rna_Texture_update");
930}
931
933{
934 StructRNA *srna;
935 PropertyRNA *prop;
936
937 static const EnumPropertyItem prop_marble_stype[] = {
938 {TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"},
939 {TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"},
940 {TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"},
941 {0, nullptr, 0, nullptr, nullptr},
942 };
943
944 static const EnumPropertyItem prop_marble_noisebasis2[] = {
945 {TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"},
946 {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
947 {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
948 {0, nullptr, 0, nullptr, nullptr},
949 };
950
951 srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
952 RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
953 RNA_def_struct_sdna(srna, "Tex");
954
955 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
956 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
957 RNA_def_property_range(prop, 0.0001, FLT_MAX);
958 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
959 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
960 RNA_def_property_update(prop, 0, "rna_Texture_update");
961
962 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
963 RNA_def_property_float_sdna(prop, nullptr, "turbul");
964 RNA_def_property_range(prop, 0.0001, FLT_MAX);
965 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
966 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
967 RNA_def_property_update(prop, 0, "rna_Texture_update");
968
969 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
970 RNA_def_property_int_sdna(prop, nullptr, "noisedepth");
971 RNA_def_property_range(prop, 0, 30);
972 RNA_def_property_ui_range(prop, 0, 24, 1, 2);
973 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
974 RNA_def_property_update(prop, 0, "rna_Texture_update");
975
976 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
977 RNA_def_property_enum_sdna(prop, nullptr, "noisetype");
979 RNA_def_property_ui_text(prop, "Noise Type", "");
980 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
981
982 prop = RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
983 RNA_def_property_enum_sdna(prop, nullptr, "stype");
984 RNA_def_property_enum_items(prop, prop_marble_stype);
985 RNA_def_property_ui_text(prop, "Pattern", "");
987 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
988
989 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
990 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
992 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
993 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
994
995 prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
996 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis2");
997 RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
998 RNA_def_property_ui_text(prop, "Noise Basis 2", "");
999 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1000
1001 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1002 RNA_def_property_range(prop, 0.001, 0.1);
1003 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1004 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1005 RNA_def_property_update(prop, 0, "rna_Texture_update");
1006}
1007
1009{
1010 StructRNA *srna;
1011 PropertyRNA *prop;
1012
1013 srna = RNA_def_struct(brna, "MagicTexture", "Texture");
1014 RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
1015 RNA_def_struct_sdna(srna, "Tex");
1016
1017 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
1018 RNA_def_property_float_sdna(prop, nullptr, "turbul");
1019 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1020 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
1021 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
1022 RNA_def_property_update(prop, 0, "rna_Texture_update");
1023
1024 prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
1025 RNA_def_property_int_sdna(prop, nullptr, "noisedepth");
1026 RNA_def_property_range(prop, 0, 30);
1027 RNA_def_property_ui_range(prop, 0, 24, 1, 2);
1028 RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the noise");
1029 RNA_def_property_update(prop, 0, "rna_Texture_update");
1030}
1031
1033{
1034 StructRNA *srna;
1035 PropertyRNA *prop;
1036
1037 static const EnumPropertyItem prop_blend_progression[] = {
1038 {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"},
1039 {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
1040 {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
1041 {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
1042 {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
1043 {TEX_HALO,
1044 "QUADRATIC_SPHERE",
1045 0,
1046 "Quadratic Sphere",
1047 "Create a quadratic progression in the shape of a sphere"},
1048 {TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
1049 {0, nullptr, 0, nullptr, nullptr},
1050 };
1051
1052 static const EnumPropertyItem prop_flip_axis_items[] = {
1053 {0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
1054 {TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
1055 {0, nullptr, 0, nullptr, nullptr},
1056 };
1057
1058 srna = RNA_def_struct(brna, "BlendTexture", "Texture");
1059 RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
1060 RNA_def_struct_sdna(srna, "Tex");
1061
1062 prop = RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
1063 RNA_def_property_enum_sdna(prop, nullptr, "stype");
1064 RNA_def_property_enum_items(prop, prop_blend_progression);
1065 RNA_def_property_ui_text(prop, "Progression", "Style of the color blending");
1066 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1067
1068 prop = RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
1069 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1070 RNA_def_property_enum_items(prop, prop_flip_axis_items);
1071 RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
1072 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1073}
1074
1076{
1077 StructRNA *srna;
1078 PropertyRNA *prop;
1079
1080 static const EnumPropertyItem prop_stucci_stype[] = {
1081 {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"},
1082 {TEX_WALLIN, "WALL_IN", 0, "Wall In", "Create Dimples"},
1083 {TEX_WALLOUT, "WALL_OUT", 0, "Wall Out", "Create Ridges"},
1084 {0, nullptr, 0, nullptr, nullptr},
1085 };
1086
1087 srna = RNA_def_struct(brna, "StucciTexture", "Texture");
1088 RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
1089 RNA_def_struct_sdna(srna, "Tex");
1090
1091 prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
1092 RNA_def_property_float_sdna(prop, nullptr, "turbul");
1093 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1094 RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
1095 RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
1096 RNA_def_property_update(prop, 0, "rna_Texture_update");
1097
1098 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1099 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
1101 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1102 RNA_def_property_update(prop, 0, "rna_Texture_update");
1103
1104 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1105 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
1106 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1107 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
1108 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1109 RNA_def_property_update(prop, 0, "rna_Texture_update");
1110
1111 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
1112 RNA_def_property_enum_sdna(prop, nullptr, "noisetype");
1114 RNA_def_property_ui_text(prop, "Noise Type", "");
1115 RNA_def_property_update(prop, 0, "rna_Texture_update");
1116
1117 prop = RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
1118 RNA_def_property_enum_sdna(prop, nullptr, "stype");
1119 RNA_def_property_enum_items(prop, prop_stucci_stype);
1120 RNA_def_property_ui_text(prop, "Pattern", "");
1122 RNA_def_property_update(prop, 0, "rna_Texture_update");
1123}
1124
1126{
1127 StructRNA *srna;
1128
1129 srna = RNA_def_struct(brna, "NoiseTexture", "Texture");
1130 RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
1131 RNA_def_struct_sdna(srna, "Tex");
1132}
1133
1135{
1136 StructRNA *srna;
1137 PropertyRNA *prop;
1138
1139 static const EnumPropertyItem prop_image_extension[] = {
1140 {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
1141 {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
1142 {TEX_CLIPCUBE,
1143 "CLIP_CUBE",
1144 0,
1145 "Clip Cube",
1146 "Clip to cubic-shaped area around the image and set exterior pixels as transparent"},
1147 {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
1148 {TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
1149 {0, nullptr, 0, nullptr, nullptr},
1150 };
1151
1152 srna = RNA_def_struct(brna, "ImageTexture", "Texture");
1153 RNA_def_struct_ui_text(srna, "Image Texture", "");
1154 RNA_def_struct_sdna(srna, "Tex");
1155
1156 prop = RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
1157 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_INTERPOL);
1158 RNA_def_property_ui_text(prop, "Interpolation", "Interpolate pixels using selected filter");
1159 RNA_def_property_update(prop, 0, "rna_Texture_update");
1160
1161 /* XXX: I think flip_axis should be a generic Texture property,
1162 * enabled for all the texture types. */
1163 prop = RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
1164 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_IMAROT);
1165 RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
1166 RNA_def_property_update(prop, 0, "rna_Texture_update");
1167
1168 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
1169 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_USEALPHA);
1170 RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image");
1171 RNA_def_property_update(prop, 0, "rna_Texture_update");
1172
1173 prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
1174 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_CALCALPHA);
1176 prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image");
1177 RNA_def_property_update(prop, 0, "rna_Texture_update");
1178
1179 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
1180 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_NEGALPHA);
1181 RNA_def_property_ui_text(prop, "Invert Alpha", "Invert all the alpha values in the image");
1182 RNA_def_property_update(prop, 0, "rna_Texture_update");
1183
1185
1186 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
1187 RNA_def_property_enum_sdna(prop, nullptr, "extend");
1190 prop, "Extension", "How the image is extrapolated past its original bounds");
1192 RNA_def_property_update(prop, 0, "rna_Texture_update");
1193
1194 prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
1195 RNA_def_property_int_sdna(prop, nullptr, "xrepeat");
1196 RNA_def_property_range(prop, 1, 512);
1197 RNA_def_property_ui_text(prop, "Repeat X", "Repetition multiplier in the X direction");
1198 RNA_def_property_update(prop, 0, "rna_Texture_update");
1199
1200 prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
1201 RNA_def_property_int_sdna(prop, nullptr, "yrepeat");
1202 RNA_def_property_range(prop, 1, 512);
1203 RNA_def_property_ui_text(prop, "Repeat Y", "Repetition multiplier in the Y direction");
1204 RNA_def_property_update(prop, 0, "rna_Texture_update");
1205
1206 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1207 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_REPEAT_XMIR);
1208 RNA_def_property_ui_text(prop, "Mirror X", "Mirror the image repetition on the X direction");
1209 RNA_def_property_update(prop, 0, "rna_Texture_update");
1210
1211 prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
1212 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_REPEAT_YMIR);
1213 RNA_def_property_ui_text(prop, "Mirror Y", "Mirror the image repetition on the Y direction");
1214 RNA_def_property_update(prop, 0, "rna_Texture_update");
1215
1216 prop = RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
1217 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_CHECKER_ODD);
1218 RNA_def_property_ui_text(prop, "Checker Odd", "Odd checker tiles");
1219 RNA_def_property_update(prop, 0, "rna_Texture_update");
1220
1221 prop = RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
1222 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_CHECKER_EVEN);
1223 RNA_def_property_ui_text(prop, "Checker Even", "Even checker tiles");
1224 RNA_def_property_update(prop, 0, "rna_Texture_update");
1225
1226 prop = RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
1227 RNA_def_property_float_sdna(prop, nullptr, "checkerdist");
1228 RNA_def_property_range(prop, 0.0, 0.99);
1229 RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 2);
1230 RNA_def_property_ui_text(prop, "Checker Distance", "Distance between checker tiles");
1231 RNA_def_property_update(prop, 0, "rna_Texture_update");
1232
1233# if 0
1234
1235 /* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
1236 * perhaps a new sub-type could be added?
1237 * --I actually used single values for this, maybe change later with a RNA_Rect thing? */
1238 prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
1239 RNA_def_property_float_sdna(prop, nullptr, "cropxmin");
1240 RNA_def_property_array(prop, 4);
1241 RNA_def_property_range(prop, -10, 10);
1242 RNA_def_property_ui_text(prop, "Crop Rectangle", "");
1243 RNA_def_property_update(prop, 0, "rna_Texture_update");
1244
1245# endif
1246
1247 prop = RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
1248 RNA_def_property_float_sdna(prop, nullptr, "cropxmin");
1249 RNA_def_property_range(prop, -10.0, 10.0);
1250 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1251 RNA_def_property_ui_text(prop, "Crop Minimum X", "Minimum X value to crop the image");
1252 RNA_def_property_update(prop, 0, "rna_Texture_update");
1253
1254 prop = RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
1255 RNA_def_property_float_sdna(prop, nullptr, "cropymin");
1256 RNA_def_property_range(prop, -10.0, 10.0);
1257 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1258 RNA_def_property_ui_text(prop, "Crop Minimum Y", "Minimum Y value to crop the image");
1259 RNA_def_property_update(prop, 0, "rna_Texture_update");
1260
1261 prop = RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
1262 RNA_def_property_float_sdna(prop, nullptr, "cropxmax");
1263 RNA_def_property_range(prop, -10.0, 10.0);
1264 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1265 RNA_def_property_ui_text(prop, "Crop Maximum X", "Maximum X value to crop the image");
1266 RNA_def_property_update(prop, 0, "rna_Texture_update");
1267
1268 prop = RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
1269 RNA_def_property_float_sdna(prop, nullptr, "cropymax");
1270 RNA_def_property_range(prop, -10.0, 10.0);
1271 RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
1272 RNA_def_property_ui_text(prop, "Crop Maximum Y", "Maximum Y value to crop the image");
1273 RNA_def_property_update(prop, 0, "rna_Texture_update");
1274
1275 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1276 RNA_def_property_pointer_sdna(prop, nullptr, "ima");
1277 RNA_def_property_struct_type(prop, "Image");
1280 RNA_def_property_ui_text(prop, "Image", "");
1281 RNA_def_property_update(prop, 0, "rna_Texture_update");
1282
1283 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
1284 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
1286 prop,
1287 "Image User",
1288 "Parameters defining which layer, pass and frame of the image is displayed");
1289 RNA_def_property_update(prop, 0, "rna_Texture_update");
1290
1291 /* Normal Map */
1292 prop = RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
1293 RNA_def_property_boolean_sdna(prop, nullptr, "imaflag", TEX_NORMALMAP);
1294 RNA_def_property_ui_text(prop, "Normal Map", "Use image RGB values for normal mapping");
1295 RNA_def_property_update(prop, 0, "rna_Texture_update");
1296}
1297
1299{
1300 StructRNA *srna;
1301 PropertyRNA *prop;
1302
1303 static const EnumPropertyItem prop_musgrave_type[] = {
1304 {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Use Perlin noise as a basis"},
1305 {TEX_RIDGEDMF,
1306 "RIDGED_MULTIFRACTAL",
1307 0,
1308 "Ridged Multifractal",
1309 "Use Perlin noise with inflection as a basis"},
1310 {TEX_HYBRIDMF,
1311 "HYBRID_MULTIFRACTAL",
1312 0,
1313 "Hybrid Multifractal",
1314 "Use Perlin noise as a basis, with extended controls"},
1315 {TEX_FBM, "FBM", 0, "fBM", "Fractal Brownian Motion, use Brownian noise as a basis"},
1316 {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
1317 {0, nullptr, 0, nullptr, nullptr},
1318 };
1319
1320 srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
1321 RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
1322 RNA_def_struct_sdna(srna, "Tex");
1323
1324 prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
1325 RNA_def_property_enum_sdna(prop, nullptr, "stype");
1326 RNA_def_property_enum_items(prop, prop_musgrave_type);
1327 RNA_def_property_ui_text(prop, "Type", "Fractal noise algorithm");
1328 RNA_def_property_update(prop, 0, "rna_Texture_update");
1329
1330 prop = RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
1331 RNA_def_property_float_sdna(prop, nullptr, "mg_H");
1332 RNA_def_property_range(prop, 0.0001, 2);
1333 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
1334 RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
1335 RNA_def_property_update(prop, 0, "rna_Texture_update");
1336
1337 prop = RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
1338 RNA_def_property_float_sdna(prop, nullptr, "mg_lacunarity");
1339 RNA_def_property_range(prop, 0, 6);
1340 RNA_def_property_ui_range(prop, 0, 6, 1, 2);
1341 RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
1342 RNA_def_property_update(prop, 0, "rna_Texture_update");
1343
1344 prop = RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
1345 RNA_def_property_float_sdna(prop, nullptr, "mg_octaves");
1346 RNA_def_property_range(prop, 0, 8);
1347 RNA_def_property_ui_range(prop, 0, 8, 1, 2);
1348 RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
1349 RNA_def_property_update(prop, 0, "rna_Texture_update");
1350
1351 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
1352 RNA_def_property_float_sdna(prop, nullptr, "mg_offset");
1353 RNA_def_property_range(prop, 0, 6);
1354 RNA_def_property_ui_range(prop, 0, 6, 1, 2);
1355 RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
1356 RNA_def_property_update(prop, 0, "rna_Texture_update");
1357
1358 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
1359 RNA_def_property_float_sdna(prop, nullptr, "mg_gain");
1360 RNA_def_property_range(prop, 0, 6);
1361 RNA_def_property_ui_range(prop, 0, 6, 1, 2);
1362 RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
1363 RNA_def_property_update(prop, 0, "rna_Texture_update");
1364
1365 prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
1366 RNA_def_property_float_sdna(prop, nullptr, "ns_outscale");
1367 RNA_def_property_range(prop, 0, 10);
1368 RNA_def_property_ui_range(prop, 0, 10, 1, 2);
1369 RNA_def_property_ui_text(prop, "Noise Intensity", "Intensity of the noise");
1370 RNA_def_property_update(prop, 0, "rna_Texture_update");
1371
1372 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1373 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
1374 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1375 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
1376 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1377 RNA_def_property_update(prop, 0, "rna_Texture_update");
1378
1379 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1380 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
1382 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1383 RNA_def_property_update(prop, 0, "rna_Texture_update");
1384
1385 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1386 RNA_def_property_range(prop, 0.001, 0.1);
1387 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1388 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1389 RNA_def_property_update(prop, 0, "rna_Texture_update");
1390}
1391
1393{
1394 StructRNA *srna;
1395 PropertyRNA *prop;
1396
1397 static const EnumPropertyItem prop_distance_metric_items[] = {
1398 {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "sqrt(x*x+y*y+z*z)"},
1399 {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "(x*x+y*y+z*z)"},
1401 "MANHATTAN",
1402 0,
1403 "Manhattan",
1404 "The length of the distance in axial directions"},
1405 {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "The length of the longest Axial journey"},
1406 {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2", "Set Minkowski variable to 0.5"},
1407 {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4", "Set Minkowski variable to 4"},
1409 "MINKOVSKY",
1410 0,
1411 "Minkowski",
1412 "Use the Minkowski function to calculate distance "
1413 "(exponent value determines the shape of the boundaries)"},
1414 {0, nullptr, 0, nullptr, nullptr},
1415 };
1416
1417 static const EnumPropertyItem prop_coloring_items[] = {
1418 /* XXX: OK names / descriptions? */
1419 {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
1420 {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"},
1421 {TEX_COL2,
1422 "POSITION_OUTLINE",
1423 0,
1424 "Position and Outline",
1425 "Use position plus an outline based on F2-F1"},
1426 {TEX_COL3,
1427 "POSITION_OUTLINE_INTENSITY",
1428 0,
1429 "Position, Outline, and Intensity",
1430 "Multiply position and outline by intensity"},
1431 {0, nullptr, 0, nullptr, nullptr},
1432 };
1433
1434 srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
1435 RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
1436 RNA_def_struct_sdna(srna, "Tex");
1437
1438 prop = RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
1439 RNA_def_property_float_sdna(prop, nullptr, "vn_w1");
1440 RNA_def_property_range(prop, -2, 2);
1441 RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
1442 RNA_def_property_update(prop, 0, "rna_Texture_update");
1443
1444 prop = RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
1445 RNA_def_property_float_sdna(prop, nullptr, "vn_w2");
1446 RNA_def_property_range(prop, -2, 2);
1447 RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
1448 RNA_def_property_update(prop, 0, "rna_Texture_update");
1449
1450 prop = RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
1451 RNA_def_property_float_sdna(prop, nullptr, "vn_w3");
1452 RNA_def_property_range(prop, -2, 2);
1453 RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
1454 RNA_def_property_update(prop, 0, "rna_Texture_update");
1455
1456 prop = RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
1457 RNA_def_property_float_sdna(prop, nullptr, "vn_w4");
1458 RNA_def_property_range(prop, -2, 2);
1459 RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
1460 RNA_def_property_update(prop, 0, "rna_Texture_update");
1461
1462 prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
1463 RNA_def_property_float_sdna(prop, nullptr, "vn_mexp");
1464 RNA_def_property_range(prop, 0.01, 10);
1465 RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
1466 RNA_def_property_update(prop, 0, "rna_Texture_update");
1467
1468 prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
1469 RNA_def_property_enum_sdna(prop, nullptr, "vn_distm");
1470 RNA_def_property_enum_items(prop, prop_distance_metric_items);
1472 prop,
1473 "Distance Metric",
1474 "Algorithm used to calculate distance of sample points to feature points");
1475 RNA_def_property_update(prop, 0, "rna_Texture_update");
1476
1477 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
1478 RNA_def_property_enum_sdna(prop, nullptr, "vn_coltype");
1479 RNA_def_property_enum_items(prop, prop_coloring_items);
1480 RNA_def_property_ui_text(prop, "Coloring", "");
1481 RNA_def_property_update(prop, 0, "rna_Texture_update");
1482
1483 prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
1484 RNA_def_property_float_sdna(prop, nullptr, "ns_outscale");
1485 RNA_def_property_range(prop, 0.01, 10);
1486 RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
1487 RNA_def_property_update(prop, 0, "rna_Texture_update");
1488
1489 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1490 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
1491 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1492 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
1493 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1494 RNA_def_property_update(prop, 0, "rna_Texture_update");
1495
1496 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1497 RNA_def_property_range(prop, 0.001, 0.1);
1498 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1499 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1500 RNA_def_property_update(prop, 0, "rna_Texture_update");
1501}
1502
1504{
1505 StructRNA *srna;
1506 PropertyRNA *prop;
1507
1508 srna = RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
1509 RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
1510 RNA_def_struct_sdna(srna, "Tex");
1511
1512 prop = RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
1513 RNA_def_property_float_sdna(prop, nullptr, "dist_amount");
1514 RNA_def_property_range(prop, 0, 10);
1515 RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
1516 RNA_def_property_update(prop, 0, "rna_Texture_update");
1517
1518 prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
1519 RNA_def_property_float_sdna(prop, nullptr, "noisesize");
1520 RNA_def_property_range(prop, 0.0001, FLT_MAX);
1521 RNA_def_property_ui_range(prop, 0.0001, 2, 1, 2);
1522 RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
1523 RNA_def_property_update(prop, 0, "rna_Texture_update");
1524
1525 prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
1526 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis2");
1528 RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
1529 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1530
1531 prop = RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
1532 RNA_def_property_enum_sdna(prop, nullptr, "noisebasis");
1534 RNA_def_property_ui_text(prop, "Noise Distortion", "Noise basis for the distortion");
1535 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1536
1537 prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
1538 RNA_def_property_range(prop, 0.001, 0.1);
1539 RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
1540 RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
1541 RNA_def_property_update(prop, 0, "rna_Texture_update");
1542}
1543
1544static void rna_def_texture(BlenderRNA *brna)
1545{
1546 StructRNA *srna;
1547 PropertyRNA *prop;
1548
1549 srna = RNA_def_struct(brna, "Texture", "ID");
1550 RNA_def_struct_sdna(srna, "Tex");
1552 srna, "Texture", "Texture data-block used by materials, lights, worlds and brushes");
1553 RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
1554 RNA_def_struct_refine_func(srna, "rna_Texture_refine");
1555
1556 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1557 // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1558 RNA_def_property_enum_sdna(prop, nullptr, "type");
1560 RNA_def_property_enum_funcs(prop, nullptr, "rna_Texture_type_set", nullptr);
1561 RNA_def_property_ui_text(prop, "Type", "");
1562 RNA_def_property_update(prop, 0, "rna_Texture_update");
1563
1564 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
1567 "Clamp",
1568 "Set negative texture RGB and intensity values to zero, for some uses "
1569 "like displacement this option can be disabled to get the full range");
1570 RNA_def_property_update(prop, 0, "rna_Texture_update");
1571
1572 prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
1573 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_COLORBAND);
1574 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Texture_use_color_ramp_set");
1576 "Use Color Ramp",
1577 "Map the texture intensity to the color ramp. "
1578 "Note that the alpha value is used for image textures, "
1579 "enable \"Calculate Alpha\" for images without an alpha channel.");
1580 RNA_def_property_update(prop, 0, "rna_Texture_update");
1581
1582 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
1583 RNA_def_property_pointer_sdna(prop, nullptr, "coba");
1584 RNA_def_property_struct_type(prop, "ColorRamp");
1585 RNA_def_property_ui_text(prop, "Color Ramp", "");
1586 RNA_def_property_update(prop, 0, "rna_Texture_update");
1587
1588 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
1589 RNA_def_property_float_sdna(prop, nullptr, "bright");
1590 RNA_def_property_range(prop, 0, 2);
1591 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
1592 RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
1593 RNA_def_property_update(prop, 0, "rna_Texture_update");
1594
1595 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
1596 RNA_def_property_range(prop, 0.0, 5);
1597 RNA_def_property_ui_range(prop, 0, 5, 1, 3);
1598 RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
1599 RNA_def_property_update(prop, 0, "rna_Texture_update");
1600
1601 prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
1602 RNA_def_property_range(prop, 0, 2);
1603 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
1604 RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
1605 RNA_def_property_update(prop, 0, "rna_Texture_update");
1606
1607 /* RGB Factor */
1608 prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
1609 RNA_def_property_float_sdna(prop, nullptr, "rfac");
1610 RNA_def_property_range(prop, 0, 2);
1611 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
1612 RNA_def_property_ui_text(prop, "Factor Red", "");
1613 RNA_def_property_update(prop, 0, "rna_Texture_update");
1614
1615 prop = RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
1616 RNA_def_property_float_sdna(prop, nullptr, "gfac");
1617 RNA_def_property_range(prop, 0, 2);
1618 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
1619 RNA_def_property_ui_text(prop, "Factor Green", "");
1620 RNA_def_property_update(prop, 0, "rna_Texture_update");
1621
1622 prop = RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
1623 RNA_def_property_float_sdna(prop, nullptr, "bfac");
1624 RNA_def_property_range(prop, 0, 2);
1625 RNA_def_property_ui_range(prop, 0, 2, 1, 3);
1626 RNA_def_property_ui_text(prop, "Factor Blue", "");
1627 RNA_def_property_update(prop, 0, "rna_Texture_update");
1628
1629 /* Alpha for preview render */
1630 prop = RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
1631 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEX_PRV_ALPHA);
1632 RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
1633 RNA_def_property_update(prop, 0, "rna_Texture_update");
1634
1635 /* nodetree */
1636 prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
1637 RNA_def_property_boolean_sdna(prop, nullptr, "use_nodes", 1);
1639 RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
1640 RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update");
1641
1642 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
1643 RNA_def_property_pointer_sdna(prop, nullptr, "nodetree");
1646 RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
1647 RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
1648
1650
1651 /* specific types */
1663 /* XXX add more types here. */
1664
1665 RNA_api_texture(srna);
1666}
1667
1669{
1670 rna_def_texture(brna);
1671 rna_def_mtex(brna);
1672 rna_def_texmapping(brna);
1674}
1675
1676#endif
void BKE_brush_tag_unsaved_changes(Brush *brush)
Definition brush.cc:720
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:297
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_main_ensure_invariants(Main &bmain, std::optional< blender::Span< ID * > > modified_ids=std::nullopt)
#define TEX_NODE_OUTPUT
void BKE_ntree_update_tag_node_property(bNodeTree *ntree, bNode *node)
void BKE_paint_invalidate_overlay_tex(Scene *scene, ViewLayer *view_layer, const Tex *tex)
Definition paint.cc:250
void BKE_texture_mapping_init(struct TexMapping *texmap)
Definition texture.cc:253
void BKE_texture_type_set(struct Tex *tex, int type)
Definition texture.cc:367
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define BLT_I18NCONTEXT_ID_IMAGE
#define BLT_I18NCONTEXT_ID_TEXTURE
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_PSYS_CHILD
Definition DNA_ID.h:993
@ ID_RECALC_EDITORS
Definition DNA_ID.h:1019
@ ID_RECALC_PSYS_RESET
Definition DNA_ID.h:991
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ ID_TE
@ ID_NT
@ ID_LA
@ ID_LS
@ ID_BR
@ ID_WO
@ ID_MA
@ ID_PA
@ PAMAP_CHILD
@ PAMAP_INIT
@ TEX_DEFAULT
@ TEX_COLOR
@ TEX_NOISEPERL
@ TEX_NOISESOFT
@ TEX_CHEBYCHEV
@ TEX_DISTANCE_SQUARED
@ TEX_MINKOVSKY_FOUR
@ TEX_MINKOVSKY_HALF
@ TEX_MANHATTAN
@ TEX_DISTANCE
@ TEX_MINKOVSKY
@ TEX_BANDNOISE
@ TEX_RINGNOISE
@ TEX_RING
@ TEX_BAND
@ TEX_SHARPER
@ TEX_SOFT
@ TEX_SHARP
@ TXF_FELINE
@ TXF_BOX
@ TXF_AREA
@ TXF_EWA
@ COLORMAP_USE_RAMP
@ TEX_NO_CLAMP
@ TEX_REPEAT_YMIR
@ TEX_CHECKER_EVEN
@ TEX_FLIPBLEND
@ TEX_PRV_ALPHA
@ TEX_NEGALPHA
@ TEX_COLORBAND
@ TEX_REPEAT_XMIR
@ TEX_CHECKER_ODD
@ TEX_DIAG
@ TEX_EASE
@ TEX_HALO
@ TEX_QUAD
@ TEX_RAD
@ TEX_SPHERE
@ TEX_LIN
@ TEX_BLENDER
@ TEX_STDPERLIN
@ TEX_VORONOI_CRACKLE
@ TEX_VORONOI_F2
@ TEX_VORONOI_F2F1
@ TEX_NEWPERLIN
@ TEX_VORONOI_F1
@ TEX_VORONOI_F4
@ TEX_VORONOI_F3
@ TEX_CELLNOISE
@ TEX_PLASTIC
@ TEX_WALLIN
@ TEX_WALLOUT
@ TEX_BLEND
@ TEX_MARBLE
@ TEX_NOISE
@ TEX_IMAGE
@ TEX_WOOD
@ TEX_CLOUDS
@ TEX_DISTNOISE
@ TEX_VORONOI
@ TEX_STUCCI
@ TEX_MAGIC
@ TEX_MUSGRAVE
@ TEX_COL2
@ TEX_COL1
@ TEX_COL3
@ TEX_INTENSITY
@ TEX_CLIP
@ TEX_EXTEND
@ TEX_CHECKER
@ TEX_REPEAT
@ TEX_CLIPCUBE
@ MTEX_DIFF
@ MTEX_DIV
@ MTEX_BLEND_VAL
@ MTEX_MUL
@ MTEX_DARK
@ MTEX_BLEND_HUE
@ MTEX_LIGHT
@ MTEX_BLEND_COLOR
@ MTEX_BLEND
@ MTEX_SOFT_LIGHT
@ MTEX_LIN_LIGHT
@ MTEX_SUB
@ MTEX_ADD
@ MTEX_OVERLAY
@ MTEX_SCREEN
@ MTEX_BLEND_SAT
@ TEXMAP_CLIP_MIN
@ TEXMAP_CLIP_MAX
@ TEX_SIN
@ TEX_SAW
@ TEX_TRI
@ MTEX_FLAT
@ MTEX_SPHERE
@ MTEX_CUBE
@ MTEX_TUBE
@ TEX_HYBRIDMF
@ TEX_MFRACTAL
@ TEX_HTERRAIN
@ TEX_FBM
@ TEX_RIDGEDMF
@ TEX_USEALPHA
@ TEX_MIPMAP
@ TEX_CALCALPHA
@ TEX_INTERPOL
@ TEX_GAUSS_MIP
@ TEX_FILTER_MIN
@ TEX_IMAROT
@ TEX_NORMALMAP
void ED_node_texture_default(const bContext *C, Tex *tex)
Definition node_edit.cc:696
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:645
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:212
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROP_CONTEXT_UPDATE
Definition RNA_types.hh:381
@ PROP_PROPORTIONAL
Definition RNA_types.hh:335
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:369
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_COLOR
Definition RNA_types.hh:248
@ PROP_EULER
Definition RNA_types.hh:254
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_TRANSLATION
Definition RNA_types.hh:249
#define C
Definition RandGen.cpp:29
#define NC_WORLD
Definition WM_types.hh:384
#define ND_SHADING
Definition WM_types.hh:474
#define NC_BRUSH
Definition WM_types.hh:382
#define ND_LIGHTING_DRAW
Definition WM_types.hh:481
#define NC_LINESTYLE
Definition WM_types.hh:397
#define ND_NODES
Definition WM_types.hh:433
#define NA_EDITED
Definition WM_types.hh:581
#define ND_PARTICLE
Definition WM_types.hh:462
#define NC_MATERIAL
Definition WM_types.hh:377
#define NC_LAMP
Definition WM_types.hh:379
#define NC_TEXTURE
Definition WM_types.hh:378
#define ND_LIGHTING
Definition WM_types.hh:480
#define NC_OBJECT
Definition WM_types.hh:376
#define ND_SHADING_LINKS
Definition WM_types.hh:476
#define ND_SHADING_DRAW
Definition WM_types.hh:475
#define GS(a)
int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, const PointerRNA *t_ptr)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PointerRNA RNA_id_pointer_create(ID *id)
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
std::optional< std::string > rna_TextureSlot_path(const PointerRNA *ptr)
void RNA_api_texture(StructRNA *srna)
void rna_TextureSlot_update(bContext *C, PointerRNA *ptr)
const EnumPropertyItem rna_enum_mapping_type_items[]
static const EnumPropertyItem prop_image_extension[]
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:32
static void rna_def_texture_wood(BlenderRNA *brna)
static void rna_def_texture_magic(BlenderRNA *brna)
static const EnumPropertyItem blend_type_items[]
static void rna_def_colormapping(BlenderRNA *brna)
static const EnumPropertyItem prop_noise_basis_items[]
static void rna_def_texture_musgrave(BlenderRNA *brna)
static void rna_def_texture_clouds(BlenderRNA *brna)
static void rna_def_texture_blend(BlenderRNA *brna)
static void rna_def_texture_distorted_noise(BlenderRNA *brna)
static const EnumPropertyItem texture_filter_items[]
static void rna_def_texture_marble(BlenderRNA *brna)
static void rna_def_texture(BlenderRNA *brna)
static void rna_def_filter_common(StructRNA *srna)
static void rna_def_mtex(BlenderRNA *brna)
static const EnumPropertyItem prop_noise_type[]
static void rna_def_texture_noise(BlenderRNA *brna)
void RNA_def_texture(BlenderRNA *brna)
static void rna_def_texmapping(BlenderRNA *brna)
static void rna_def_texture_voronoi(BlenderRNA *brna)
static void rna_def_texture_image(BlenderRNA *brna)
const EnumPropertyItem rna_enum_texture_type_items[]
static void rna_def_texture_stucci(BlenderRNA *brna)
#define FLT_MAX
Definition stdcycles.h:14
const char * identifier
Definition RNA_types.hh:623
const char * name
Definition RNA_types.hh:627
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
void * first
short which_output
short mapto
struct Tex * tex
short imaflag
char use_nodes
struct ColorBand * coba
struct bNodeTree * nodetree
ListBase nodes
int16_t custom1
int16_t type_legacy
struct bNode * next
void * storage
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4227