Blender V5.3
rna_material.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_material_types.h"
13#include "DNA_mesh_types.h"
14
16
17#include "BLT_translation.hh"
18
19#include "BKE_customdata.hh"
20
21#include "RNA_define.hh"
22#include "RNA_enum_types.hh"
23
24#include "rna_internal.hh"
25
26#include "WM_api.hh"
27#include "WM_types.hh"
28
29namespace blender {
30
32 {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
34 {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
35 {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
36 {MA_RAMP_BURN, "BURN", 0, "Color Burn", ""},
38 {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
39 {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
40 {MA_RAMP_DODGE, "DODGE", 0, "Color Dodge", ""},
41 {MA_RAMP_ADD, "ADD", 0, "Add", ""},
43 {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
44 {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
45 {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
47 {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
48 {MA_RAMP_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
49 {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
50 {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
52 {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
53 {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
54 {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
55 {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
56 {0, nullptr, 0, nullptr, nullptr},
57};
58
59}
60
61#ifdef RNA_RUNTIME
62
63# include "MEM_guardedalloc.h"
64
66# include "DNA_meshdata_types.h"
67# include "DNA_node_types.h"
68# include "DNA_object_types.h"
69# include "DNA_screen_types.h"
70# include "DNA_space_types.h"
71
72# include "BLI_string_utf8.hh"
73
74# include "BKE_attribute.h"
75# include "BKE_attribute.hh"
76# include "BKE_colorband.hh"
77# include "BKE_context.hh"
78# include "BKE_editmesh.hh"
79# include "BKE_grease_pencil.hh"
80# include "BKE_lib_id.hh"
81# include "BKE_main.hh"
82# include "BKE_material.hh"
83# include "BKE_mesh.hh"
84# include "BKE_mesh_types.hh"
85# include "BKE_node.hh"
86# include "BKE_paint.hh"
87# include "BKE_scene.hh"
88# include "BKE_texture.h"
89# include "BKE_workspace.hh"
90
91# include "DEG_depsgraph.hh"
92# include "DEG_depsgraph_build.hh"
93
94# include "ED_gpencil_legacy.hh"
95# include "ED_image.hh"
96# include "ED_node.hh"
97# include "ED_screen.hh"
98
99/* Stroke and Fill - Alpha Visibility Threshold */
100# define GPENCIL_ALPHA_OPACITY_THRESH 0.001f
101
102namespace blender {
103
104static void rna_Material_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
105{
106 Material *ma = id_cast<Material *>(ptr->owner_id);
107
110}
111
112static void rna_Material_update_previews(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
113{
114 Material *ma = id_cast<Material *>(ptr->owner_id);
115
117}
118
119static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *ptr)
120{
121 Material *ma = id_cast<Material *>(ptr->owner_id);
122 rna_Material_update(bmain, scene, ptr);
123
124 /* Need set all caches as dirty. */
125 for (Object *ob = bmain->objects.first(); ob; ob = static_cast<Object *>(ob->id.next)) {
126 if (ob->type == OB_GREASE_PENCIL) {
127 GreasePencil &grease_pencil = *id_cast<GreasePencil *>(ob->data);
128 DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
129 }
130 }
131
133}
134
135static void rna_MaterialLineArt_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
136{
137 Material *ma = id_cast<Material *>(ptr->owner_id);
138 /* Need to tag geometry for line art modifier updates. */
141}
142
143static std::optional<std::string> rna_MaterialLineArt_path(const PointerRNA * /*ptr*/)
144{
145 return "lineart";
146}
147
148static void rna_Material_draw_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
149{
150 Material *ma = id_cast<Material *>(ptr->owner_id);
151
154}
155
156static void rna_Material_texpaint_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
157{
158 Material *ma = static_cast<Material *>(ptr->data);
160 ptr,
161 static_cast<void *>(ma->texpaintslot),
162 sizeof(TexPaintSlot),
163 ma->tot_slots,
164 0,
165 nullptr);
166}
167
168static void rna_Material_active_paint_texture_index_update(bContext *C, PointerRNA *ptr)
169{
170 Main *bmain = CTX_data_main(C);
171 Material *ma = id_cast<Material *>(ptr->owner_id);
172
173 if (ma->nodetree) {
174 std::pair<bNodeTree *, bNode *> found = BKE_texpaint_slot_material_find_node(
175 ma, ma->paint_active_slot);
176
177 if (found.second) {
178 BLI_assert(found.first != nullptr);
179 bke::node_set_active(*found.first, *found.second);
180 /* Tag nodetree for viewport update (if node is found in a nested group). */
181 if (ma->nodetree != found.first) {
182 DEG_id_tag_update(&found.first->id, ID_RECALC_SYNC_TO_EVAL);
183 }
184 }
185 }
186
187 if (ma->texpaintslot && (ma->tot_slots > ma->paint_active_slot)) {
188 TexPaintSlot *slot = &ma->texpaintslot[ma->paint_active_slot];
189 Image *image = slot->ima;
190 if (image) {
191 ED_space_image_sync(bmain, image, false);
192 }
193
194 /* For compatibility reasons with vertex paint we activate the color attribute. */
195 if (const char *name = slot->attribute_name) {
197 if (ob != nullptr && ob->type == OB_MESH) {
198 Mesh *mesh = id_cast<Mesh *>(ob->data);
199 if (mesh->runtime->edit_mesh) {
200 if (const BMDataLayerLookup attr = BM_data_layer_lookup(*mesh->runtime->edit_mesh->bm,
201 name))
202 {
204 }
205 }
206 else {
207 const bke::AttributeAccessor attributes = mesh->attributes();
208 if (bke::mesh::is_color_attribute(attributes.lookup_meta_data(name))) {
210 }
211 }
212 DEG_id_tag_update(&ob->id, 0);
214 }
215 }
216 }
217
218 DEG_id_tag_update(&ma->id, 0);
220}
221
222static int rna_Material_blend_method_get(PointerRNA *ptr)
223{
224 Material *material = id_cast<Material *>(ptr->owner_id);
225 switch (material->surface_render_method) {
227 return MA_BM_HASHED;
229 return MA_BM_BLEND;
230 }
231 return MA_BM_HASHED;
232}
233
234static void rna_Material_blend_method_set(PointerRNA *ptr, int new_blend_method)
235{
236 Material *material = id_cast<Material *>(ptr->owner_id);
237 switch (new_blend_method) {
238 case MA_BM_SOLID:
239 case MA_BM_CLIP:
240 case MA_BM_HASHED:
241 material->surface_render_method = MA_SURFACE_METHOD_DEFERRED;
242 break;
243 case MA_BM_BLEND:
244 material->surface_render_method = MA_SURFACE_METHOD_FORWARD;
245 break;
246 }
247}
248
249static void rna_Material_render_method_set(PointerRNA *ptr, int new_render_method)
250{
251 Material *material = id_cast<Material *>(ptr->owner_id);
252 material->surface_render_method = eMaterial_SurfaceRenderMethod(new_render_method);
253
254 /* Still sets the legacy property for forward compatibility. */
255 switch (new_render_method) {
257 material->blend_method = MA_BM_HASHED;
258 break;
260 material->blend_method = MA_BM_BLEND;
261 break;
262 }
263}
264static void rna_Material_transparent_shadow_set(PointerRNA *ptr, bool new_value)
265{
266 Material *material = id_cast<Material *>(ptr->owner_id);
267 SET_FLAG_FROM_TEST(material->blend_flag, new_value, MA_BL_TRANSPARENT_SHADOW);
268 /* Still sets the legacy property for forward compatibility. */
269 material->blend_shadow = new_value ? MA_BS_HASHED : MA_BS_SOLID;
270}
271
272static bool rna_Material_use_nodes_get(PointerRNA * /*ptr*/)
273{
274 /* #use_nodes is deprecated. All materials now use nodes. */
275 return true;
276}
277
278static void rna_Material_use_nodes_set(PointerRNA * /*ptr*/, bool /*new_value*/)
279{
280 /* #use_nodes is deprecated. Setting the property has no effect.
281 * Note: Users will get a warning through the RNA deprecation warning, so no need to log a
282 * warning here. */
283 return;
284}
285
287{
288 MTex *mtex = BKE_texture_mtex_add_id(self_id, -1);
289 if (mtex == nullptr) {
290 BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
291 return nullptr;
292 }
293
294 /* for redraw only */
296
297 return mtex;
298}
299
301{
302 MTex *mtex;
303
304 if (index < 0 || index >= MAX_MTEX) {
305 BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
306 return nullptr;
307 }
308
309 mtex = BKE_texture_mtex_add_id(self_id, index);
310
311 /* for redraw only */
313
314 return mtex;
315}
316
317void rna_mtex_texture_slots_clear(ID *self_id, bContext *C, ReportList *reports, int index)
318{
319 MTex **mtex_ar;
320 short act;
321
322 give_active_mtex(self_id, &mtex_ar, &act);
323
324 if (mtex_ar == nullptr) {
325 BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
326 return;
327 }
328
329 if (index < 0 || index >= MAX_MTEX) {
330 BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
331 return;
332 }
333
334 if (mtex_ar[index]) {
335 id_us_min(id_cast<ID *>(mtex_ar[index]->tex));
336 MEM_delete(mtex_ar[index]);
337 mtex_ar[index] = nullptr;
338 DEG_id_tag_update(self_id, 0);
339 }
340
341 /* for redraw only */
343}
344
345static void rna_TexPaintSlot_uv_layer_get(PointerRNA *ptr, char *value)
346{
347 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
348
349 if (data->uvname != nullptr) {
350 strcpy(value, data->uvname);
351 }
352 else {
353 value[0] = '\0';
354 }
355}
356
357static int rna_TexPaintSlot_uv_layer_length(PointerRNA *ptr)
358{
359 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
360 return data->uvname == nullptr ? 0 : strlen(data->uvname);
361}
362
363static void rna_TexPaintSlot_uv_layer_set(PointerRNA *ptr, const char *value)
364{
365 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
366
367 if (data->uvname != nullptr) {
369 }
370}
371
372static void rna_TexPaintSlot_name_get(PointerRNA *ptr, char *value)
373{
374 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
375
376 if (data->ima != nullptr) {
377 strcpy(value, data->ima->id.name + 2);
378 return;
379 }
380
381 if (data->attribute_name != nullptr) {
382 strcpy(value, data->attribute_name);
383 return;
384 }
385
386 value[0] = '\0';
387}
388
389static int rna_TexPaintSlot_name_length(PointerRNA *ptr)
390{
391 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
392 if (data->ima != nullptr) {
393 return strlen(data->ima->id.name) - 2;
394 }
395 if (data->attribute_name != nullptr) {
396 return strlen(data->attribute_name);
397 }
398
399 return 0;
400}
401
402static int rna_TexPaintSlot_icon_get(PointerRNA *ptr)
403{
404 TexPaintSlot *data = static_cast<TexPaintSlot *>(ptr->data);
405 if (data->ima != nullptr) {
406 return ICON_IMAGE;
407 }
408 if (data->attribute_name != nullptr) {
409 return ICON_COLOR;
410 }
411
412 return ICON_NONE;
413}
414
415static bool rna_is_grease_pencil_get(PointerRNA *ptr)
416{
417 Material *ma = static_cast<Material *>(ptr->data);
418 if (ma->gp_style != nullptr) {
419 return true;
420 }
421
422 return false;
423}
424
425static void rna_grease_pencil_fill_style_set(PointerRNA *ptr, int value)
426{
427 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
429
430 if ((pcolor->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) && pcolor->gradient == nullptr) {
431 pcolor->gradient = BKE_colorband_add(true);
432 }
433}
434
435static PointerRNA rna_grease_pencil_gradient_get(PointerRNA *ptr)
436{
437 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
438
439 if (pcolor->gradient == nullptr) {
440 pcolor->gradient = BKE_colorband_add(true);
441 }
442
443 return RNA_pointer_create_discrete(ptr->owner_id, RNA_ColorRamp, pcolor->gradient);
444}
445
446static std::optional<std::string> rna_GpencilColorData_path(const PointerRNA * /*ptr*/)
447{
448 return "grease_pencil";
449}
450
451static bool rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
452{
453 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
454 return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
455}
456
457static bool rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
458{
459 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
460 return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
461}
462
463static void rna_GpencilColorData_stroke_image_set(PointerRNA *ptr,
464 PointerRNA value,
465 ReportList * /*reports*/)
466{
467 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
468 ID *id = static_cast<ID *>(value.data);
469
470 id_us_min(id_cast<ID *>(pcolor->sima));
471 id_us_plus(id);
472 pcolor->sima = id_cast<Image *>(id);
473}
474
475static void rna_GpencilColorData_fill_image_set(PointerRNA *ptr,
476 PointerRNA value,
477 ReportList * /*reports*/)
478{
479 MaterialGPencilStyle *pcolor = static_cast<MaterialGPencilStyle *>(ptr->data);
480 ID *id = static_cast<ID *>(value.data);
481
482 id_us_min(id_cast<ID *>(pcolor->ima));
483 id_us_plus(id);
484 pcolor->ima = id_cast<Image *>(id);
485}
486
487} // namespace blender
488
489#else
490
491namespace blender {
492
494{
495 PropertyRNA *prop;
496
497 prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
498 RNA_def_property_float_sdna(prop, nullptr, "r");
499 RNA_def_property_array(prop, 4);
501 RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
502 /* See #82514 for details, for now re-define defaults here. Keep in sync with
503 * #DNA_material_defaults.h */
504 static const float diffuse_color_default[4] = {0.8f, 0.8f, 0.8f, 1.0f};
505 RNA_def_property_float_array_default(prop, diffuse_color_default);
506 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
507
508 prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
509 RNA_def_property_float_sdna(prop, nullptr, "specr");
510 RNA_def_property_array(prop, 3);
512 RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
513 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
514
515 prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_FACTOR);
516 RNA_def_property_float_sdna(prop, nullptr, "roughness");
517 RNA_def_property_range(prop, 0, 1);
519 RNA_def_property_ui_text(prop, "Roughness", "Roughness of the material");
520 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
521
522 prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
523 RNA_def_property_float_sdna(prop, nullptr, "spec");
524 RNA_def_property_range(prop, 0, 1);
526 RNA_def_property_ui_text(prop, "Specular", "How intense (bright) the specular reflection is");
527 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
528
529 prop = RNA_def_property(srna, "metallic", PROP_FLOAT, PROP_FACTOR);
530 RNA_def_property_float_sdna(prop, nullptr, "metallic");
531 RNA_def_property_range(prop, 0.0f, 1.0f);
533 RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
534 RNA_def_property_update(prop, 0, "rna_Material_update");
535
536 /* Freestyle line color */
537 prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
538 RNA_def_property_float_sdna(prop, nullptr, "line_col");
539 RNA_def_property_array(prop, 4);
540 RNA_def_property_ui_text(prop, "Line Color", "Line color used for Freestyle line rendering");
541 RNA_def_property_update(prop, 0, "rna_Material_update");
542
543 prop = RNA_def_property(srna, "line_priority", PROP_INT, PROP_NONE);
544 RNA_def_property_int_sdna(prop, nullptr, "line_priority");
545 RNA_def_property_range(prop, 0, 32767);
547 prop, "Line Priority", "The line color of a higher priority is used at material boundaries");
548 RNA_def_property_update(prop, 0, "rna_Material_update");
549}
550
552{
553 StructRNA *srna;
554 PropertyRNA *prop;
555
556 /* mode type styles */
557 static const EnumPropertyItem gpcolordata_mode_types_items[] = {
558 {GP_MATERIAL_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
559 {GP_MATERIAL_MODE_DOT, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
560 {GP_MATERIAL_MODE_SQUARE, "BOX", 0, "Squares", "Draw strokes using separated squares"},
561 {0, nullptr, 0, nullptr, nullptr},
562 };
563
564 /* stroke styles */
565 static const EnumPropertyItem stroke_style_items[] = {
566 {GP_MATERIAL_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
567 {GP_MATERIAL_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
568 {0, nullptr, 0, nullptr, nullptr},
569 };
570
571 /* fill styles */
572 static const EnumPropertyItem fill_style_items[] = {
573 {GP_MATERIAL_FILL_STYLE_SOLID, "SOLID", 0, "Solid", "Fill area with solid color"},
575 "GRADIENT",
576 0,
577 "Gradient",
578 "Fill area with gradient color"},
579 {GP_MATERIAL_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
580 {0, nullptr, 0, nullptr, nullptr},
581 };
582
583 static const EnumPropertyItem fill_gradient_items[] = {
584 {GP_MATERIAL_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
585 {GP_MATERIAL_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
586 {0, nullptr, 0, nullptr, nullptr},
587 };
588
589 static const EnumPropertyItem alignment_draw_items[] = {
591 "PATH",
592 0,
593 "Path",
594 "Follow stroke drawing path and object rotation"},
595 {GP_MATERIAL_FOLLOW_OBJ, "OBJECT", 0, "Object", "Follow object rotation only"},
597 "FIXED",
598 0,
599 "Fixed",
600 "Do not follow drawing path or object rotation and keeps aligned with viewport"},
601 {0, nullptr, 0, nullptr, nullptr},
602 };
603
604 static EnumPropertyItem placement_mode_items[] = {
606 "COUNT",
607 0,
608 "Count",
609 "Place dots evenly along each segment of the stroke"},
611 "RADIUS",
612 0,
613 "Radius",
614 "Place dots evenly with respect to radius"},
616 "DENSITY",
617 0,
618 "Density",
619 "Place dots evenly along the length of the stroke"},
620 {0, nullptr, 0, nullptr, nullptr},
621 };
622
623 srna = RNA_def_struct(brna, "MaterialGPencilStyle", nullptr);
624 RNA_def_struct_sdna(srna, "MaterialGPencilStyle");
625 RNA_def_struct_ui_text(srna, "Grease Pencil Color", "");
626 RNA_def_struct_path_func(srna, "rna_GpencilColorData_path");
627
628 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
629 RNA_def_property_float_sdna(prop, nullptr, "stroke_rgba");
630 RNA_def_property_array(prop, 4);
631 RNA_def_property_range(prop, 0.0f, FLT_MAX);
632 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
633 RNA_def_property_ui_text(prop, "Color", "");
634 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
635
636 /* Fill Drawing Color */
637 prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR);
638 RNA_def_property_float_sdna(prop, nullptr, "fill_rgba");
639 RNA_def_property_array(prop, 4);
640 RNA_def_property_range(prop, 0.0f, FLT_MAX);
641 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
642 RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
643 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
644
645 /* Secondary Drawing Color */
646 prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR);
647 RNA_def_property_float_sdna(prop, nullptr, "mix_rgba");
648 RNA_def_property_array(prop, 4);
649 RNA_def_property_range(prop, 0.0f, FLT_MAX);
650 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
651 RNA_def_property_ui_text(prop, "Mix Color", "Color for mixing with primary filling color");
652 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
654 prop, "Unused but kept for compatibility with older versions of Blender.", 503, 600);
655
656 /* Gradient */
657 prop = RNA_def_property(srna, "gradient", PROP_POINTER, PROP_NEVER_NULL);
658 RNA_def_property_pointer_sdna(prop, nullptr, "gradient");
660 prop, "rna_grease_pencil_gradient_get", nullptr, nullptr, nullptr);
661 RNA_def_property_struct_type(prop, "ColorRamp");
662 RNA_def_property_ui_text(prop, "Gradient", "");
663 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
664
665 /* Mix factor */
666 prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_FACTOR);
667 RNA_def_property_float_sdna(prop, nullptr, "mix_factor");
668 RNA_def_property_range(prop, 0.0f, 1.0f);
669 RNA_def_property_ui_text(prop, "Mix", "Mix Factor");
671 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
672
673 /* Stroke Mix factor */
674 prop = RNA_def_property(srna, "mix_stroke_factor", PROP_FLOAT, PROP_FACTOR);
675 RNA_def_property_float_sdna(prop, nullptr, "mix_stroke_factor");
676 RNA_def_property_range(prop, 0.0f, 1.0f);
677 RNA_def_property_ui_text(prop, "Mix", "Mix Stroke Factor");
679 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
680
681 /* Texture angle */
682 prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
683 RNA_def_property_float_sdna(prop, nullptr, "texture_angle");
684 RNA_def_property_ui_text(prop, "Angle", "Texture Orientation Angle");
685 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
686
687 /* Scale factor for texture */
688 prop = RNA_def_property(srna, "texture_scale", PROP_FLOAT, PROP_COORDS);
689 RNA_def_property_float_sdna(prop, nullptr, "texture_scale");
690 RNA_def_property_array(prop, 2);
691 RNA_def_property_ui_text(prop, "Scale", "Scale Factor for Texture");
692 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
693
694 /* Shift factor to move texture in 2d space */
695 prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_COORDS);
696 RNA_def_property_float_sdna(prop, nullptr, "texture_offset");
697 RNA_def_property_array(prop, 2);
698 RNA_def_property_ui_text(prop, "Offset", "Shift Texture in 2d Space");
699 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
700
701 /* texture pixsize factor (used for UV along the stroke) */
702 prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
703 RNA_def_property_float_sdna(prop, nullptr, "texture_pixsize");
704 RNA_def_property_range(prop, 1, 5000);
705 RNA_def_property_ui_text(prop, "UV Factor", "Texture Pixel Size factor along the stroke");
706 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
707
708 /* Flags */
709 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
710 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_MATERIAL_HIDE);
711 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
712 RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
713 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
714
715 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
717 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
719 prop, "Locked", "Protect color from further editing and/or frame changes");
720 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
721
722 prop = RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
724 RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
726 prop, "Show in Ghosts", "Display strokes using this color when showing onion skins");
727 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
728
729 prop = RNA_def_property(srna, "texture_clamp", PROP_BOOLEAN, PROP_NONE);
731 RNA_def_property_ui_text(prop, "Clamp", "Do not repeat texture and clamp to one instance only");
732 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
733
734 prop = RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
736 RNA_def_property_ui_text(prop, "Flip", "Flip filling colors");
737 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
739 prop, "Unused but kept for compatibility with older versions of Blender.", 503, 600);
740
741 prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, PROP_NONE);
744 prop, "Self Overlap", "Disable stencil and overlap self intersections with alpha materials");
745 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
746
747 prop = RNA_def_property(srna, "use_stroke_holdout", PROP_BOOLEAN, PROP_NONE);
750 prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
751 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
752
753 prop = RNA_def_property(srna, "use_fill_holdout", PROP_BOOLEAN, PROP_NONE);
756 prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
757 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
758
759 prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
761 RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
762 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
764 prop, "Unused but kept for compatibility with older versions of Blender.", 501, 600);
765
766 prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
768 RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
769 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
771 prop, "Unused but kept for compatibility with older versions of Blender.", 501, 600);
772
773 /* Mode to align Dots and Boxes to drawing path and object rotation */
774 prop = RNA_def_property(srna, "alignment_mode", PROP_ENUM, PROP_NONE);
775 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "alignment_mode");
776 RNA_def_property_enum_items(prop, alignment_draw_items);
778 prop, "Alignment", "Defines how align Dots and Boxes with drawing path and object rotation");
779 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
780
781 /* Rotation of texture for Dots or Strokes. */
782 prop = RNA_def_property(srna, "alignment_rotation", PROP_FLOAT, PROP_ANGLE);
783 RNA_def_property_float_sdna(prop, nullptr, "alignment_rotation");
785 RNA_def_property_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f));
786 RNA_def_property_ui_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f), 10, 3);
788 prop, "Rotation", "Additional rotation applied to dots and square texture of strokes");
789 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
790
791 /* Placement mode for Dots and Squares. */
792 prop = RNA_def_property(srna, "placement_mode", PROP_ENUM, PROP_NONE);
793 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "placement_mode");
794 RNA_def_property_enum_items(prop, placement_mode_items);
797 prop, "Placement", "Defines how Dots or Squares are placed along strokes");
798 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
799
800 /* Placement count. */
801 prop = RNA_def_property(srna, "placement_count", PROP_INT, PROP_NONE);
802 RNA_def_property_int_sdna(prop, nullptr, "placement_count");
804 RNA_def_property_ui_text(prop, "Count", "Number of dots placed per segment");
805 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
806
807 /* Placement radius factor. */
808 prop = RNA_def_property(srna, "placement_radius_spacing", PROP_FLOAT, PROP_PERCENTAGE);
809 RNA_def_property_float_sdna(prop, nullptr, "placement_radius_spacing");
810 RNA_def_property_float_default(prop, 100.0f);
811 RNA_def_property_range(prop, 0.0f, FLT_MAX);
812 RNA_def_property_ui_range(prop, 1.0f, 200.0f, 10, 0);
814 prop, "Spacing", "Spacing between dots as a percentage of the diameter");
815 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
816
817 /* Placement density. */
818 prop = RNA_def_property(srna, "placement_density", PROP_FLOAT, PROP_NONE);
819 RNA_def_property_float_sdna(prop, nullptr, "placement_density");
821 RNA_def_property_range(prop, 0.0f, FLT_MAX);
822 RNA_def_property_ui_text(prop, "Density", "Density of dots along the stroke");
823 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
824
825 /* Use Randomization. */
826 prop = RNA_def_property(srna, "use_randomization", PROP_BOOLEAN, PROP_NONE);
828 RNA_def_property_ui_text(prop, "Randomization", "Use material randomization");
829 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
830
831 /* Random Size. */
832 prop = RNA_def_property(srna, "random_size_factor", PROP_FLOAT, PROP_NONE);
833 RNA_def_property_float_sdna(prop, nullptr, "random_size_factor");
835 RNA_def_property_range(prop, 0.0f, 1.0f);
836 RNA_def_property_ui_text(prop, "Size", "Randomize the size");
837 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
838
839 /* Random Strength. */
840 prop = RNA_def_property(srna, "random_strength_factor", PROP_FLOAT, PROP_NONE);
841 RNA_def_property_float_sdna(prop, nullptr, "random_strength_factor");
843 RNA_def_property_range(prop, 0.0f, 1.0f);
844 RNA_def_property_ui_text(prop, "Strength", "Randomize strength");
845 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
846
847 /* Random Rotation. */
848 prop = RNA_def_property(srna, "random_rotation_factor", PROP_FLOAT, PROP_NONE);
849 RNA_def_property_float_sdna(prop, nullptr, "random_rotation_factor");
851 RNA_def_property_range(prop, 0.0f, 1.0f);
852 RNA_def_property_ui_text(prop, "Rotation", "Randomize texture rotation");
853 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
854
855 /* Random Color Hue. */
856 prop = RNA_def_property(srna, "random_hue_factor", PROP_FLOAT, PROP_NONE);
857 RNA_def_property_float_sdna(prop, nullptr, "random_hue_factor");
859 RNA_def_property_range(prop, 0.0f, 1.0f);
860 RNA_def_property_ui_text(prop, "Hue", "Randomize color hue");
861 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
862
863 /* Random Color Saturation. */
864 prop = RNA_def_property(srna, "random_saturation_factor", PROP_FLOAT, PROP_NONE);
865 RNA_def_property_float_sdna(prop, nullptr, "random_saturation_factor");
867 RNA_def_property_range(prop, 0.0f, 1.0f);
868 RNA_def_property_ui_text(prop, "Saturation", "Randomize color saturation");
869 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
870
871 /* Random Color Value. */
872 prop = RNA_def_property(srna, "random_value_factor", PROP_FLOAT, PROP_NONE);
873 RNA_def_property_float_sdna(prop, nullptr, "random_value_factor");
875 RNA_def_property_range(prop, 0.0f, 1.0f);
876 RNA_def_property_ui_text(prop, "Value", "Randomize color value");
877 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
878
879 /* Random Noise Scale. */
880 prop = RNA_def_property(srna, "random_noise_scale", PROP_FLOAT, PROP_NONE);
881 RNA_def_property_float_sdna(prop, nullptr, "random_noise_scale");
883 RNA_def_property_range(prop, 0.0f, FLT_MAX);
884 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1f, 3);
885 RNA_def_property_ui_text(prop, "Noise Scale", "Scale the noise frequency");
886 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
887
888 /* Pass index for modifiers. */
889 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
890 RNA_def_property_int_sdna(prop, nullptr, "index");
892 "Pass Index",
893 "Identifier that can be used with some modifiers to restrict their "
894 "influence to only certain materials");
895 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
896
897 /* mode type */
898 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
899 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "mode");
900 RNA_def_property_enum_items(prop, gpcolordata_mode_types_items);
901 RNA_def_property_ui_text(prop, "Line Type", "Select line type for strokes");
902 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
903
904 /* stroke style */
905 prop = RNA_def_property(srna, "stroke_style", PROP_ENUM, PROP_NONE);
906 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "stroke_style");
907 RNA_def_property_enum_items(prop, stroke_style_items);
908 RNA_def_property_ui_text(prop, "Stroke Style", "Select style used to draw strokes");
910 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
911
912 /* stroke image texture */
913 prop = RNA_def_property(srna, "stroke_image", PROP_POINTER, PROP_NONE);
914 RNA_def_property_pointer_sdna(prop, nullptr, "sima");
916 prop, nullptr, "rna_GpencilColorData_stroke_image_set", nullptr, nullptr);
919 RNA_def_property_ui_text(prop, "Image", "");
920 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
921
922 /* fill style */
923 prop = RNA_def_property(srna, "fill_style", PROP_ENUM, PROP_NONE);
924 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "fill_style");
925 RNA_def_property_enum_items(prop, fill_style_items);
926 RNA_def_property_enum_funcs(prop, nullptr, "rna_grease_pencil_fill_style_set", nullptr);
927 RNA_def_property_ui_text(prop, "Fill Style", "Select style used to fill strokes");
929 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
930
931 /* gradient type */
932 prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
933 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "gradient_type");
934 RNA_def_property_enum_items(prop, fill_gradient_items);
935 RNA_def_property_ui_text(prop, "Gradient Type", "Select type of gradient used to fill strokes");
936 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
937
938 /* fill image texture */
939 prop = RNA_def_property(srna, "fill_image", PROP_POINTER, PROP_NONE);
940 RNA_def_property_pointer_sdna(prop, nullptr, "ima");
942 prop, nullptr, "rna_GpencilColorData_fill_image_set", nullptr, nullptr);
945 RNA_def_property_ui_text(prop, "Image", "");
946 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
947
948 /* Read-only state props (for simpler UI code) */
949 prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
950 RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_stroke_visible_get", nullptr);
953 prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
954
955 prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
956 RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_fill_visible_get", nullptr);
959 prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
960}
962{
963 StructRNA *srna;
964 PropertyRNA *prop;
965
966 srna = RNA_def_struct(brna, "MaterialLineArt", nullptr);
967 RNA_def_struct_sdna(srna, "MaterialLineArt");
968 RNA_def_struct_ui_text(srna, "Material Line Art", "");
969 RNA_def_struct_path_func(srna, "rna_MaterialLineArt_path");
970
971 prop = RNA_def_property(srna, "use_material_mask", PROP_BOOLEAN, PROP_NONE);
975 prop, "Use Material Mask", "Use material masks to filter out occluded strokes");
976 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
977
978 prop = RNA_def_property(srna, "use_material_mask_bits", PROP_BOOLEAN, PROP_NONE);
980 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "material_mask_bits", 1 << 0, 8);
981 RNA_def_property_ui_text(prop, "Mask", "");
982 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
983
984 prop = RNA_def_property(srna, "mat_occlusion", PROP_INT, PROP_NONE);
985 RNA_def_property_ui_range(prop, 0.0f, 5.0f, 1.0f, 1);
987 prop,
988 "Effectiveness",
989 "Faces with this material will behave as if it has set number of layers in occlusion");
990 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
991
992 prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
993 RNA_def_property_range(prop, 0, 255);
995 "Intersection Priority",
996 "The intersection line will be included into the object with the "
997 "higher intersection priority value");
998 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
999
1000 prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
1004 "Use Intersection Priority",
1005 "Override object and collection intersection priority value");
1006 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
1007}
1008
1010{
1011 StructRNA *srna;
1012 PropertyRNA *prop;
1013
1014 /* Render Preview Types */
1015 static const EnumPropertyItem preview_type_items[] = {
1016 {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
1017 {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
1018 {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
1019 {MA_HAIR, "HAIR", ICON_CURVES, "Hair", "Hair strands"},
1020 {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader ball"},
1021 {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
1022 {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
1023 {0, nullptr, 0, nullptr, nullptr},
1024 };
1025
1026 static const EnumPropertyItem prop_eevee_volume_isect_method_items[] = {
1028 "FAST",
1029 0,
1030 "Fast",
1031 "Each face is considered as a medium interface. Gives correct results for manifold "
1032 "geometry that contains no inner parts."},
1034 "ACCURATE",
1035 0,
1036 "Accurate",
1037 "Faces are considered as medium interface only when they have different consecutive "
1038 "facing. Gives correct results as long as the max ray depth is not exceeded. Have "
1039 "significant memory overhead compared to the fast method."},
1040 {0, nullptr, 0, nullptr, nullptr},
1041 };
1042
1043 static const EnumPropertyItem prop_eevee_thickness_method_items[] = {
1045 "SPHERE",
1046 0,
1047 "Sphere",
1048 "Approximate the object as a sphere whose diameter is equal to the thickness defined by "
1049 "the node tree"},
1051 "SLAB",
1052 0,
1053 "Slab",
1054 "Approximate the object as an infinite slab of thickness defined by the node tree"},
1055 {0, nullptr, 0, nullptr, nullptr},
1056 };
1057
1058# if 1 /* Delete this section once we remove old eevee. */
1059 static const EnumPropertyItem prop_eevee_blend_items[] = {
1060 {MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
1061 {MA_BM_CLIP,
1062 "CLIP",
1063 0,
1064 "Alpha Clip",
1065 "Use the alpha threshold to clip the visibility (binary visibility)"},
1066 {MA_BM_HASHED,
1067 "HASHED",
1068 0,
1069 "Alpha Hashed",
1070 "Use noise to dither the binary visibility (works well with multi-samples)"},
1071 {MA_BM_BLEND,
1072 "BLEND",
1073 0,
1074 "Alpha Blend",
1075 "Render polygon transparent, depending on alpha channel of the texture"},
1076 {0, nullptr, 0, nullptr, nullptr},
1077 };
1078# endif
1079
1080 static const EnumPropertyItem prop_eevee_surface_render_method_items[] = {
1082 "DITHERED",
1083 0,
1084 "Dithered",
1085 "Allows for grayscale hashed transparency, and compatible with render passes and "
1086 "raytracing. Also known as deferred rendering."},
1088 "BLENDED",
1089 0,
1090 "Blended",
1091 "Allows for colored transparency, but incompatible with render passes and raytracing. Also "
1092 "known as forward rendering."},
1093 {0, nullptr, 0, nullptr, nullptr},
1094 };
1095
1096 static const EnumPropertyItem prop_displacement_method_items[] = {
1098 "BUMP",
1099 0,
1100 "Bump Only",
1101 "Bump mapping to simulate the appearance of displacement"},
1103 "DISPLACEMENT",
1104 0,
1105 "Displacement Only",
1106 "Use true displacement of surface only, requires fine subdivision"},
1108 "BOTH",
1109 0,
1110 "Displacement and Bump",
1111 "Combination of true displacement and bump mapping for finer detail"},
1112 {0, nullptr, 0, nullptr, nullptr},
1113 };
1114
1115 srna = RNA_def_struct(brna, "Material", "ID");
1117 srna,
1118 "Material",
1119 "Material data-block to define the appearance of geometric objects for rendering");
1120 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
1121
1122 prop = RNA_def_property(srna, "surface_render_method", PROP_ENUM, PROP_NONE);
1123 RNA_def_property_enum_items(prop, prop_eevee_surface_render_method_items);
1125 "Surface Render Method",
1126 "Controls the blending and the compatibility with certain features");
1127 /* Setter function for forward compatibility. */
1128 RNA_def_property_enum_funcs(prop, nullptr, "rna_Material_render_method_set", nullptr);
1129 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1130
1131 prop = RNA_def_property(srna, "displacement_method", PROP_ENUM, PROP_NONE);
1132 RNA_def_property_enum_items(prop, prop_displacement_method_items);
1133 RNA_def_property_ui_text(prop, "Displacement Method", "Method to use for the displacement");
1134 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1135
1136# if 1 /* Delete this section once we remove old eevee. */
1137 /* Blending (only Eevee for now) */
1138 prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
1139 RNA_def_property_enum_items(prop, prop_eevee_blend_items);
1141 prop,
1142 "Blend Mode",
1143 "Blend Mode for Transparent Faces (Deprecated: use 'surface_render_method')");
1145 prop, "rna_Material_blend_method_get", "rna_Material_blend_method_set", nullptr);
1147 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1148
1149 prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
1150 RNA_def_property_range(prop, 0, 1);
1152 "Clip Threshold",
1153 "A pixel is rendered only if its alpha value is above this threshold");
1154 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1155# endif
1156
1157 prop = RNA_def_property(srna, "use_transparency_overlap", PROP_BOOLEAN, PROP_NONE);
1158 RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
1160 "Use Transparency Overlap",
1161 "Render multiple transparent layers "
1162 "(may introduce transparency sorting problems)");
1163
1164# if 1 /* This should be deleted in Blender 4.5 */
1165 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1166 prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
1167 RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
1169 prop,
1170 "Show Backface",
1171 "Render multiple transparent layers "
1172 "(may introduce transparency sorting problems) (Deprecated: use 'use_tranparency_overlap')");
1173 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1174# endif
1175
1176 prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
1177 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE);
1179 prop, "Backface Culling", "Use back face culling to hide the back side of faces");
1180 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1181
1182 prop = RNA_def_property(srna, "use_backface_culling_shadow", PROP_BOOLEAN, PROP_NONE);
1183 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE_SHADOW);
1185 prop, "Shadow Backface Culling", "Use back face culling when casting shadows");
1186 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1187
1188 prop = RNA_def_property(srna, "use_backface_culling_lightprobe_volume", PROP_BOOLEAN, PROP_NONE);
1190 prop, nullptr, "blend_flag", MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED);
1192 prop,
1193 "Light Probe Volume Backface Culling",
1194 "Consider material single sided for light probe volume capture. "
1195 "Additionally helps rejecting probes inside the object to avoid light leaks.");
1196 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1197
1198 prop = RNA_def_property(srna, "use_transparent_shadow", PROP_BOOLEAN, PROP_NONE);
1199 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSPARENT_SHADOW);
1200 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Material_transparent_shadow_set");
1202 prop,
1203 "Transparent Shadows",
1204 "Use transparent shadows for this material if it contains a Transparent BSDF, "
1205 "disabling will render faster but not give accurate shadows");
1206 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1207
1208 prop = RNA_def_property(srna, "use_raytrace_refraction", PROP_BOOLEAN, PROP_NONE);
1209 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
1211 prop,
1212 "Raytrace Transmission",
1213 "Use raytracing to determine transmitted color instead of using only light probes. "
1214 "This prevents the surface from contributing to the lighting of surfaces not using this "
1215 "setting.");
1216 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1217
1218# if 1 /* This should be deleted in Blender 4.5 */
1219 prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
1220 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
1222 prop,
1223 "Raytrace Transmission",
1224 "Use raytracing to determine transmitted color instead of using only light probes. "
1225 "This prevents the surface from contributing to the lighting of surfaces not using this "
1226 "setting. Deprecated: use 'use_raytrace_refraction'.");
1227 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1228
1229 prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
1230 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSLUCENCY);
1232 prop, "Subsurface Translucency", "Add translucency effect to subsurface (Deprecated)");
1233 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1234
1235 prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
1236 RNA_def_property_float_sdna(prop, nullptr, "refract_depth");
1237 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1239 "Refraction Depth",
1240 "Approximate the thickness of the object to compute two refraction "
1241 "events (0 is disabled) (Deprecated)");
1242 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1243# endif
1244
1245 prop = RNA_def_property(srna, "thickness_mode", PROP_ENUM, PROP_NONE);
1246 RNA_def_property_enum_items(prop, prop_eevee_thickness_method_items);
1248 "Thickness Mode",
1249 "Approximation used to model the light interactions inside the object");
1250 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1251
1252 prop = RNA_def_property(srna, "use_thickness_from_shadow", PROP_BOOLEAN, PROP_NONE);
1253 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_THICKNESS_FROM_SHADOW);
1255 "Thickness From Shadow",
1256 "Use the shadow maps from shadow casting lights "
1257 "to refine the thickness defined by the material node tree");
1258 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1259
1260 prop = RNA_def_property(srna, "volume_intersection_method", PROP_ENUM, PROP_NONE);
1261 RNA_def_property_enum_items(prop, prop_eevee_volume_isect_method_items);
1263 prop,
1264 "Volume Intersection Method",
1265 "Determines which inner part of the mesh will produce volumetric effect");
1266 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1267
1268 prop = RNA_def_property(srna, "max_vertex_displacement", PROP_FLOAT, PROP_DISTANCE);
1269 RNA_def_property_float_sdna(prop, nullptr, "inflate_bounds");
1270 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1272 "Max Vertex Displacement",
1273 "The max distance a vertex can be displaced. "
1274 "Displacements over this threshold may cause visibility issues.");
1275 RNA_def_property_update(prop, 0, "rna_Material_draw_update");
1276
1277 /* For Preview Render */
1278 prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
1279 RNA_def_property_enum_sdna(prop, nullptr, "pr_type");
1280 RNA_def_property_enum_items(prop, preview_type_items);
1281 RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
1283 RNA_def_property_update(prop, 0, "rna_Material_update_previews");
1284
1285 prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
1286 RNA_def_property_boolean_sdna(prop, nullptr, "pr_flag", MA_PREVIEW_WORLD);
1288 prop, "Preview World", "Use the current world background to light the preview render");
1289 RNA_def_property_update(prop, 0, "rna_Material_update_previews");
1290
1291 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
1292 RNA_def_property_int_sdna(prop, nullptr, "index");
1294 prop, "Pass Index", "Index number for the \"Material Index\" render pass");
1295 RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
1296
1297 /* nodetree */
1298 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
1299 RNA_def_property_pointer_sdna(prop, nullptr, "nodetree");
1302 RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
1303
1304 prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
1305 RNA_def_property_boolean_sdna(prop, nullptr, "use_nodes", 1);
1307 RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
1308 RNA_def_property_boolean_funcs(prop, "rna_Material_use_nodes_get", "rna_Material_use_nodes_set");
1310 "Unused but kept for compatibility reasons. Setting the property "
1311 "has no effect, and getting it always returns True.",
1312 500,
1313 600);
1314
1315 /* common */
1317 rna_def_texpaint_slots(brna, srna);
1318
1320
1321 /* grease pencil */
1322 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
1323 RNA_def_property_pointer_sdna(prop, nullptr, "gp_style");
1325 prop, "Grease Pencil Settings", "Grease Pencil color settings for material");
1326
1327 prop = RNA_def_property(srna, "is_grease_pencil", PROP_BOOLEAN, PROP_NONE);
1328 RNA_def_property_boolean_funcs(prop, "rna_is_grease_pencil_get", nullptr);
1331 prop, "Is Grease Pencil", "True if this material has Grease Pencil data");
1332
1333 /* line art */
1334 prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
1335 RNA_def_property_pointer_sdna(prop, nullptr, "lineart");
1336 RNA_def_property_ui_text(prop, "Line Art Settings", "Line Art settings for material");
1337
1340
1341 RNA_api_material(srna);
1342}
1343
1345 PropertyRNA *cprop,
1346 const char *structname,
1347 const char *structname_slots)
1348{
1349 StructRNA *srna;
1350
1351 FunctionRNA *func;
1352 PropertyRNA *parm;
1353
1354 RNA_def_property_srna(cprop, structname_slots);
1355 srna = RNA_def_struct(brna, structname_slots, nullptr);
1356 RNA_def_struct_sdna(srna, "ID");
1357 RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
1358
1359 /* functions */
1360 func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
1363 parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
1365 RNA_def_function_return(func, parm);
1366
1367 func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
1370 parm = RNA_def_int(
1371 func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
1373 parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
1375 RNA_def_function_return(func, parm);
1376
1377 func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
1380 parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
1382}
1383
1385 StructRNA *srna,
1386 const char *begin,
1387 const char *activeget,
1388 const char *activeset,
1389 const char *activeeditable,
1390 const char *structname,
1391 const char *structname_slots,
1392 const char *update,
1393 const char *update_index)
1394{
1395 PropertyRNA *prop;
1396
1397 /* mtex */
1398 prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
1399 RNA_def_property_struct_type(prop, structname);
1401 begin,
1402 "rna_iterator_array_next",
1403 "rna_iterator_array_end",
1404 "rna_iterator_array_dereference_get",
1405 nullptr,
1406 nullptr,
1407 nullptr,
1408 nullptr);
1410 prop, "Textures", "Texture slots defining the mapping and influence of textures");
1411 rna_def_texture_slots(brna, prop, structname, structname_slots);
1412
1413 prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
1414 RNA_def_property_struct_type(prop, "Texture");
1416 if (activeeditable) {
1417 RNA_def_property_editable_func(prop, activeeditable);
1418 }
1419 RNA_def_property_pointer_funcs(prop, activeget, activeset, nullptr, nullptr);
1420 RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
1422
1423 prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
1424 RNA_def_property_int_sdna(prop, nullptr, "texact");
1425 RNA_def_property_range(prop, 0, MAX_MTEX - 1);
1426 RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
1428}
1429
1431{
1432 StructRNA *srna;
1433 PropertyRNA *prop;
1434
1435 srna = RNA_def_struct(brna, "TexPaintSlot", nullptr);
1437 srna, "Texture Paint Slot", "Slot that contains information about texture painting");
1438
1439 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1442 prop, "rna_TexPaintSlot_name_get", "rna_TexPaintSlot_name_length", nullptr);
1443 RNA_def_property_ui_text(prop, "Name", "Name of the slot");
1444 RNA_def_struct_name_property(srna, prop);
1445
1446 prop = RNA_def_property(srna, "icon_value", PROP_INT, PROP_NONE);
1448 RNA_def_property_int_funcs(prop, "rna_TexPaintSlot_icon_get", nullptr, nullptr);
1449 RNA_def_property_ui_text(prop, "Icon", "Paint slot icon");
1450
1451 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1453 prop, MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX); /* Else it uses the pointer size! */
1454 RNA_def_property_string_sdna(prop, nullptr, "uvname");
1456 "rna_TexPaintSlot_uv_layer_get",
1457 "rna_TexPaintSlot_uv_layer_length",
1458 "rna_TexPaintSlot_uv_layer_set");
1459 RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
1460 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
1461
1462 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
1463 RNA_def_property_boolean_sdna(prop, nullptr, "valid", 1);
1465 RNA_def_property_ui_text(prop, "Valid", "Slot has a valid image and UV map");
1466}
1467
1469{
1470 PropertyRNA *prop;
1471
1472 rna_def_tex_slot(brna);
1473
1474 /* mtex */
1475 prop = RNA_def_property(srna, "texture_paint_images", PROP_COLLECTION, PROP_NONE);
1476 RNA_def_property_collection_sdna(prop, nullptr, "texpaintslot", nullptr);
1478 "rna_Material_texpaint_begin",
1479 "rna_iterator_array_next",
1480 "rna_iterator_array_end",
1481 "rna_iterator_array_dereference_get",
1482 nullptr,
1483 nullptr,
1484 nullptr,
1485 nullptr);
1486 RNA_def_property_struct_type(prop, "Image");
1488 prop, "Texture Slot Images", "Texture images used for texture painting");
1489
1490 prop = RNA_def_property(srna, "texture_paint_slots", PROP_COLLECTION, PROP_NONE);
1492 "rna_Material_texpaint_begin",
1493 "rna_iterator_array_next",
1494 "rna_iterator_array_end",
1495 "rna_iterator_array_get",
1496 nullptr,
1497 nullptr,
1498 nullptr,
1499 nullptr);
1500 RNA_def_property_struct_type(prop, "TexPaintSlot");
1502 prop, "Texture Slots", "Texture slots defining the mapping and influence of textures");
1503
1504 prop = RNA_def_property(srna, "paint_active_slot", PROP_INT, PROP_UNSIGNED);
1507 prop, "Active Paint Texture Index", "Index of active texture paint slot");
1510 prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_Material_active_paint_texture_index_update");
1511
1512 prop = RNA_def_property(srna, "paint_clone_slot", PROP_INT, PROP_UNSIGNED);
1514 RNA_def_property_ui_text(prop, "Clone Paint Texture Index", "Index of clone texture paint slot");
1516}
1517
1518} // namespace blender
1519
1520#endif
Generic geometry attributes built on CustomData.
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
#define DEG2RADF(_deg)
#define BLT_I18NCONTEXT_ID_GPENCIL
#define BLT_I18NCONTEXT_ID_MATERIAL
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:762
#define C
Definition RandGen.cpp:29
#define MAX_MTEX
Definition Stroke.h:31
#define ND_SHADING
Definition WM_types.hh:520
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DATA
Definition WM_types.hh:552
#define ND_SHADING_PREVIEW
Definition WM_types.hh:523
#define NC_MATERIAL
Definition WM_types.hh:393
#define NC_GPENCIL
Definition WM_types.hh:412
#define NC_TEXTURE
Definition WM_types.hh:394
#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 SET_FLAG_FROM_TEST(value, test, flag)
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX
#define SHRT_MAX
#define FLT_MAX
#define INT_MAX
bool is_color_attribute(const AttributeMetaData &meta_data)
void node_set_active(bNodeTree &ntree, bNode &node)
Definition node.cc:5484
BMesh Iterators.
static void rna_def_material_display(StructRNA *srna)
void WM_main_add_notifier(uint type, void *reference)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_deprecated(PropertyRNA *prop, const char *note, const short version, const short removal_version)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
static void rna_def_tex_slot(BlenderRNA *brna)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
@ GP_MATERIAL_PLACEMENT_RADIUS
@ GP_MATERIAL_PLACEMENT_COUNT
@ GP_MATERIAL_PLACEMENT_DENSITY
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void ED_space_image_sync(Main *bmain, Image *image, bool ignore_render_viewer)
Definition image_edit.cc:79
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void id_us_plus(ID *id)
Definition lib_id.cc:433
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
const EnumPropertyItem rna_enum_ramp_blend_items[]
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
@ FUNC_USE_REPORTS
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:980
@ FUNC_NO_SELF
Definition RNA_types.hh:998
@ FUNC_USE_CONTEXT
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
struct MTex * BKE_texture_mtex_add_id(struct ID *id, int slot)
Definition texture.cc:399
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:301
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
@ MA_BL_THICKNESS_FROM_SHADOW
@ MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED
void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *name, const char *name_slots, const char *update, const char *update_index)
MTex * rna_mtex_texture_slots_create(ID *self, bContext *C, ReportList *reports, int index)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
@ GP_MATERIAL_DISABLE_STENCIL
@ GP_MATERIAL_USE_DOTS_RANDOMIZATION
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ GP_MATERIAL_HIDE_ONIONSKIN
@ GP_MATERIAL_IS_STROKE_HOLDOUT
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
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)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void rna_def_animdata_common(StructRNA *srna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_api_material(StructRNA *srna)
static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void rna_def_texpaint_slots(BlenderRNA *brna, StructRNA *srna)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act)
Definition texture.cc:480
BMesh const char void * data
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)
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void rna_mtex_texture_slots_clear(ID *self, bContext *C, ReportList *reports, int index)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
MTex * rna_mtex_texture_slots_add(ID *self, bContext *C, ReportList *reports)
BMDataLayerLookup BM_data_layer_lookup(const BMesh &bm, const StringRef name)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_material(BlenderRNA *brna)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
Main * CTX_data_main(const bContext *C)
iter begin(iter)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< StringRef > name)
static void rna_def_material_lineart(BlenderRNA *brna)
@ ID_RECALC_SHADING
Definition DNA_ID.h:1094
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_CONTEXT_UPDATE
Definition RNA_types.hh:477
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:465
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:434
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Scene * CTX_data_scene(const bContext *C)
std::pair< bNodeTree *, bNode * > BKE_texpaint_slot_material_find_node(Material *ma, short texpaint_slot)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
@ GP_MATERIAL_GRADIENT_RADIAL
@ GP_MATERIAL_GRADIENT_LINEAR
@ PROP_PERCENTAGE
Definition RNA_types.hh:307
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_COORDS
Definition RNA_types.hh:331
@ PROP_DISTANCE
Definition RNA_types.hh:313
@ PROP_UNSIGNED
Definition RNA_types.hh:306
@ PARM_REQUIRED
Definition RNA_types.hh:631
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
static void rna_def_material_greasepencil(BlenderRNA *brna)
Object * CTX_data_active_object(const bContext *C)
void id_us_min(ID *id)
Definition lib_id.cc:441
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
@ LRT_MATERIAL_CUSTOM_INTERSECTION_PRIORITY
@ LRT_MATERIAL_MASK_ENABLED
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
@ GP_MATERIAL_FILL_STYLE_GRADIENT
const NodeType * type
Definition graph/node.h:179
eMaterialGPencilStyle_FillStyle fill_style