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