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