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