Blender  V3.3
rna_material.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <float.h>
8 #include <stdlib.h>
9 
10 #include "DNA_material_types.h"
11 #include "DNA_mesh_types.h"
12 #include "DNA_texture_types.h"
13 
14 #include "BLI_math.h"
15 
16 #include "BKE_customdata.h"
17 
18 #include "RNA_define.h"
19 #include "RNA_enum_types.h"
20 
21 #include "rna_internal.h"
22 
23 #include "WM_api.h"
24 #include "WM_types.h"
25 
27  {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
29  {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
30  {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
31  {MA_RAMP_BURN, "BURN", 0, "Color Burn", ""},
33  {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
34  {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
35  {MA_RAMP_DODGE, "DODGE", 0, "Color Dodge", ""},
36  {MA_RAMP_ADD, "ADD", 0, "Add", ""},
38  {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
39  {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
40  {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
42  {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
43  {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
44  {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
46  {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
47  {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
48  {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
49  {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
50  {0, NULL, 0, NULL, NULL},
51 };
52 
53 #ifdef RNA_RUNTIME
54 
55 # include "MEM_guardedalloc.h"
56 
57 # include "DNA_gpencil_types.h"
58 # include "DNA_node_types.h"
59 # include "DNA_object_types.h"
60 # include "DNA_screen_types.h"
61 # include "DNA_space_types.h"
62 
63 # include "BKE_colorband.h"
64 # include "BKE_context.h"
65 # include "BKE_gpencil.h"
66 # include "BKE_main.h"
67 # include "BKE_material.h"
68 # include "BKE_node.h"
69 # include "BKE_paint.h"
70 # include "BKE_scene.h"
71 # include "BKE_texture.h"
72 # include "BKE_workspace.h"
73 
74 # include "DEG_depsgraph.h"
75 # include "DEG_depsgraph_build.h"
76 
77 # include "ED_gpencil.h"
78 # include "ED_image.h"
79 # include "ED_node.h"
80 # include "ED_screen.h"
81 
82 static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
83 {
84  Material *ma = (Material *)ptr->owner_id;
85 
88 }
89 
90 static void rna_Material_update_previews(Main *UNUSED(bmain),
91  Scene *UNUSED(scene),
92  PointerRNA *ptr)
93 {
94  Material *ma = (Material *)ptr->owner_id;
95 
96  if (ma->nodetree) {
98  }
99 
101 }
102 
103 static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *ptr)
104 {
105  Material *ma = (Material *)ptr->owner_id;
106  rna_Material_update(bmain, scene, ptr);
107 
108  /* Need set all caches as dirty. */
109  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
110  if (ob->type == OB_GPENCIL) {
111  bGPdata *gpd = (bGPdata *)ob->data;
113  }
114  }
115 
117 }
118 
119 static void rna_MaterialLineArt_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
120 {
121  Material *ma = (Material *)ptr->owner_id;
122  /* Need to tag geometry for line art modifier updates. */
125 }
126 
127 static char *rna_MaterialLineArt_path(const PointerRNA *UNUSED(ptr))
128 {
129  return BLI_strdup("lineart");
130 }
131 
132 static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
133 {
134  Material *ma = (Material *)ptr->owner_id;
135 
138 }
139 
140 static void rna_Material_texpaint_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
141 {
142  Material *ma = (Material *)ptr->data;
144  iter, (void *)ma->texpaintslot, sizeof(TexPaintSlot), ma->tot_slots, 0, NULL);
145 }
146 
147 static void rna_Material_active_paint_texture_index_update(bContext *C, PointerRNA *ptr)
148 {
149  Main *bmain = CTX_data_main(C);
150  bScreen *screen;
151  Material *ma = (Material *)ptr->owner_id;
152 
153  if (ma->use_nodes && ma->nodetree) {
155 
156  if (node) {
158  }
159  }
160 
161  if (ma->texpaintslot) {
162  TexPaintSlot *slot = &ma->texpaintslot[ma->paint_active_slot];
163  Image *image = slot->ima;
164  if (image) {
165  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
166  wmWindow *win = ED_screen_window_find(screen, bmain->wm.first);
167  if (win == NULL) {
168  continue;
169  }
170 
171  ScrArea *area;
172  for (area = screen->areabase.first; area; area = area->next) {
173  SpaceLink *sl;
174  for (sl = area->spacedata.first; sl; sl = sl->next) {
175  if (sl->spacetype == SPACE_IMAGE) {
176  SpaceImage *sima = (SpaceImage *)sl;
177  if (!sima->pin) {
178  ED_space_image_set(bmain, sima, image, true);
179  }
180  }
181  }
182  }
183  }
184  }
185 
186  /* For compatibility reasons with vertex paint we activate the color attribute. */
187  if (slot->attribute_name) {
189  if (ob != NULL && ob->type == OB_MESH) {
190  Mesh *mesh = ob->data;
192  if (layer != NULL) {
194  }
195  DEG_id_tag_update(&ob->id, 0);
197  }
198  }
199  }
200 
201  DEG_id_tag_update(&ma->id, 0);
203 }
204 
205 static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
206 {
207  Material *ma = (Material *)ptr->data;
208  Main *bmain = CTX_data_main(C);
209 
210  if (ma->use_nodes && ma->nodetree == NULL) {
211  ED_node_shader_default(C, &ma->id);
212  }
213 
216  rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
217 }
218 
219 MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
220 {
221  MTex *mtex = BKE_texture_mtex_add_id(self_id, -1);
222  if (mtex == NULL) {
223  BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
224  return NULL;
225  }
226 
227  /* for redraw only */
229 
230  return mtex;
231 }
232 
234  struct bContext *C,
235  ReportList *reports,
236  int index)
237 {
238  MTex *mtex;
239 
240  if (index < 0 || index >= MAX_MTEX) {
241  BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
242  return NULL;
243  }
244 
245  mtex = BKE_texture_mtex_add_id(self_id, index);
246 
247  /* for redraw only */
249 
250  return mtex;
251 }
252 
253 void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *reports, int index)
254 {
255  MTex **mtex_ar;
256  short act;
257 
258  give_active_mtex(self_id, &mtex_ar, &act);
259 
260  if (mtex_ar == NULL) {
261  BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
262  return;
263  }
264 
265  if (index < 0 || index >= MAX_MTEX) {
266  BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
267  return;
268  }
269 
270  if (mtex_ar[index]) {
271  id_us_min((ID *)mtex_ar[index]->tex);
272  MEM_freeN(mtex_ar[index]);
273  mtex_ar[index] = NULL;
274  DEG_id_tag_update(self_id, 0);
275  }
276 
277  /* for redraw only */
279 }
280 
281 static void rna_TexPaintSlot_uv_layer_get(PointerRNA *ptr, char *value)
282 {
284 
285  if (data->uvname != NULL) {
286  BLI_strncpy_utf8(value, data->uvname, 64);
287  }
288  else {
289  value[0] = '\0';
290  }
291 }
292 
293 static int rna_TexPaintSlot_uv_layer_length(PointerRNA *ptr)
294 {
296  return data->uvname == NULL ? 0 : strlen(data->uvname);
297 }
298 
299 static void rna_TexPaintSlot_uv_layer_set(PointerRNA *ptr, const char *value)
300 {
302 
303  if (data->uvname != NULL) {
304  BLI_strncpy_utf8(data->uvname, value, 64);
305  }
306 }
307 
308 static void rna_TexPaintSlot_name_get(PointerRNA *ptr, char *value)
309 {
311 
312  if (data->ima != NULL) {
313  BLI_strncpy_utf8(value, data->ima->id.name + 2, MAX_NAME);
314  return;
315  }
316 
317  if (data->attribute_name != NULL) {
318  BLI_strncpy_utf8(value, data->attribute_name, MAX_NAME);
319  return;
320  }
321 
322  value[0] = '\0';
323 }
324 
325 static int rna_TexPaintSlot_name_length(PointerRNA *ptr)
326 {
328  if (data->ima != NULL) {
329  return strlen(data->ima->id.name) - 2;
330  }
331  if (data->attribute_name != NULL) {
332  return strlen(data->attribute_name);
333  }
334 
335  return 0;
336 }
337 
338 static int rna_TexPaintSlot_icon_get(PointerRNA *ptr)
339 {
341  if (data->ima != NULL) {
342  return ICON_IMAGE;
343  }
344  if (data->attribute_name != NULL) {
345  return ICON_COLOR;
346  }
347 
348  return ICON_NONE;
349 }
350 
351 static bool rna_is_grease_pencil_get(PointerRNA *ptr)
352 {
353  Material *ma = (Material *)ptr->data;
354  if (ma->gp_style != NULL) {
355  return true;
356  }
357 
358  return false;
359 }
360 
361 static void rna_gpcolordata_uv_update(Main *bmain, Scene *scene, PointerRNA *ptr)
362 {
363  /* update all uv strokes of this color */
364  Material *ma = (Material *)ptr->owner_id;
365  ED_gpencil_update_color_uv(bmain, ma);
366 
367  rna_MaterialGpencil_update(bmain, scene, ptr);
368 }
369 
370 static char *rna_GpencilColorData_path(const PointerRNA *UNUSED(ptr))
371 {
372  return BLI_strdup("grease_pencil");
373 }
374 
375 static int rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
376 {
377  MaterialGPencilStyle *pcolor = ptr->data;
378  return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
379 }
380 
381 static int rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
382 {
384  return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
385 }
386 
387 static void rna_GpencilColorData_stroke_image_set(PointerRNA *ptr,
388  PointerRNA value,
389  struct ReportList *UNUSED(reports))
390 {
391  MaterialGPencilStyle *pcolor = ptr->data;
392  ID *id = value.data;
393 
394  id_us_plus(id);
395  pcolor->sima = (struct Image *)id;
396 }
397 
398 static void rna_GpencilColorData_fill_image_set(PointerRNA *ptr,
399  PointerRNA value,
400  struct ReportList *UNUSED(reports))
401 {
403  ID *id = value.data;
404 
405  id_us_plus(id);
406  pcolor->ima = (struct Image *)id;
407 }
408 
409 #else
410 
412 {
413  PropertyRNA *prop;
414 
415  prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
416  RNA_def_property_float_sdna(prop, NULL, "r");
417  RNA_def_property_array(prop, 4);
419  RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
420  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
421 
422  prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
423  RNA_def_property_float_sdna(prop, NULL, "specr");
424  RNA_def_property_array(prop, 3);
426  RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
427  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
428 
429  prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_FACTOR);
430  RNA_def_property_float_sdna(prop, NULL, "roughness");
431  RNA_def_property_range(prop, 0, 1);
433  RNA_def_property_ui_text(prop, "Roughness", "Roughness of the material");
434  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
435 
436  prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
437  RNA_def_property_float_sdna(prop, NULL, "spec");
438  RNA_def_property_range(prop, 0, 1);
440  RNA_def_property_ui_text(prop, "Specular", "How intense (bright) the specular reflection is");
441  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
442 
443  prop = RNA_def_property(srna, "metallic", PROP_FLOAT, PROP_FACTOR);
444  RNA_def_property_float_sdna(prop, NULL, "metallic");
445  RNA_def_property_range(prop, 0.0f, 1.0f);
447  RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
448  RNA_def_property_update(prop, 0, "rna_Material_update");
449 
450  /* Freestyle line color */
451  prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
452  RNA_def_property_float_sdna(prop, NULL, "line_col");
453  RNA_def_property_array(prop, 4);
454  RNA_def_property_ui_text(prop, "Line Color", "Line color used for Freestyle line rendering");
455  RNA_def_property_update(prop, 0, "rna_Material_update");
456 
457  prop = RNA_def_property(srna, "line_priority", PROP_INT, PROP_NONE);
458  RNA_def_property_int_sdna(prop, NULL, "line_priority");
459  RNA_def_property_range(prop, 0, 32767);
461  prop, "Line Priority", "The line color of a higher priority is used at material boundaries");
462  RNA_def_property_update(prop, 0, "rna_Material_update");
463 }
464 
466 {
467  StructRNA *srna;
468  PropertyRNA *prop;
469 
470  /* mode type styles */
471  static EnumPropertyItem gpcolordata_mode_types_items[] = {
472  {GP_MATERIAL_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
473  {GP_MATERIAL_MODE_DOT, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
474  {GP_MATERIAL_MODE_SQUARE, "BOX", 0, "Squares", "Draw strokes using separated squares"},
475  {0, NULL, 0, NULL, NULL},
476  };
477 
478  /* stroke styles */
479  static EnumPropertyItem stroke_style_items[] = {
480  {GP_MATERIAL_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
481  {GP_MATERIAL_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
482  {0, NULL, 0, NULL, NULL},
483  };
484 
485  /* fill styles */
486  static EnumPropertyItem fill_style_items[] = {
487  {GP_MATERIAL_FILL_STYLE_SOLID, "SOLID", 0, "Solid", "Fill area with solid color"},
489  "GRADIENT",
490  0,
491  "Gradient",
492  "Fill area with gradient color"},
493  {GP_MATERIAL_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
494  {0, NULL, 0, NULL, NULL},
495  };
496 
497  static EnumPropertyItem fill_gradient_items[] = {
498  {GP_MATERIAL_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
499  {GP_MATERIAL_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
500  {0, NULL, 0, NULL, NULL},
501  };
502 
503  static EnumPropertyItem alignment_draw_items[] = {
505  "PATH",
506  0,
507  "Path",
508  "Follow stroke drawing path and object rotation"},
509  {GP_MATERIAL_FOLLOW_OBJ, "OBJECT", 0, "Object", "Follow object rotation only"},
511  "FIXED",
512  0,
513  "Fixed",
514  "Do not follow drawing path or object rotation and keeps aligned with viewport"},
515  {0, NULL, 0, NULL, NULL},
516  };
517 
518  srna = RNA_def_struct(brna, "MaterialGPencilStyle", NULL);
519  RNA_def_struct_sdna(srna, "MaterialGPencilStyle");
520  RNA_def_struct_ui_text(srna, "Grease Pencil Color", "");
521  RNA_def_struct_path_func(srna, "rna_GpencilColorData_path");
522 
523  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
524  RNA_def_property_range(prop, 0.0, 1.0);
525  RNA_def_property_float_sdna(prop, NULL, "stroke_rgba");
526  RNA_def_property_array(prop, 4);
527  RNA_def_property_ui_text(prop, "Color", "");
528  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
529 
530  /* Fill Drawing Color */
531  prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR);
532  RNA_def_property_float_sdna(prop, NULL, "fill_rgba");
533  RNA_def_property_array(prop, 4);
534  RNA_def_property_range(prop, 0.0f, 1.0f);
535  RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
536  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
537 
538  /* Secondary Drawing Color */
539  prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR);
540  RNA_def_property_float_sdna(prop, NULL, "mix_rgba");
541  RNA_def_property_array(prop, 4);
542  RNA_def_property_range(prop, 0.0f, 1.0f);
543  RNA_def_property_ui_text(prop, "Mix Color", "Color for mixing with primary filling color");
544  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
545 
546  /* Mix factor */
547  prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_FACTOR);
548  RNA_def_property_float_sdna(prop, NULL, "mix_factor");
549  RNA_def_property_range(prop, 0.0f, 1.0f);
550  RNA_def_property_ui_text(prop, "Mix", "Mix Factor");
551  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
552 
553  /* Stroke Mix factor */
554  prop = RNA_def_property(srna, "mix_stroke_factor", PROP_FLOAT, PROP_FACTOR);
555  RNA_def_property_float_sdna(prop, NULL, "mix_stroke_factor");
556  RNA_def_property_range(prop, 0.0f, 1.0f);
557  RNA_def_property_ui_text(prop, "Mix", "Mix Stroke Factor");
558  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
559 
560  /* Texture angle */
561  prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
562  RNA_def_property_float_sdna(prop, NULL, "texture_angle");
563  RNA_def_property_ui_text(prop, "Angle", "Texture Orientation Angle");
564  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
565 
566  /* Scale factor for texture */
567  prop = RNA_def_property(srna, "texture_scale", PROP_FLOAT, PROP_COORDS);
568  RNA_def_property_float_sdna(prop, NULL, "texture_scale");
569  RNA_def_property_array(prop, 2);
570  RNA_def_property_ui_text(prop, "Scale", "Scale Factor for Texture");
571  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
572 
573  /* Shift factor to move texture in 2d space */
574  prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_COORDS);
575  RNA_def_property_float_sdna(prop, NULL, "texture_offset");
576  RNA_def_property_array(prop, 2);
577  RNA_def_property_ui_text(prop, "Offset", "Shift Texture in 2d Space");
578  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
579 
580  /* texture pixsize factor (used for UV along the stroke) */
581  prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
582  RNA_def_property_float_sdna(prop, NULL, "texture_pixsize");
583  RNA_def_property_range(prop, 1, 5000);
584  RNA_def_property_ui_text(prop, "UV Factor", "Texture Pixel Size factor along the stroke");
585  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_gpcolordata_uv_update");
586 
587  /* Flags */
588  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
590  RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
591  RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
592  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
593 
594  prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
596  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
598  prop, "Locked", "Protect color from further editing and/or frame changes");
599  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
600 
601  prop = RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
603  RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
605  prop, "Show in Ghosts", "Display strokes using this color when showing onion skins");
606  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
607 
608  prop = RNA_def_property(srna, "texture_clamp", PROP_BOOLEAN, PROP_NONE);
610  RNA_def_property_ui_text(prop, "Clamp", "Do not repeat texture and clamp to one instance only");
611  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
612 
613  prop = RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
615  RNA_def_property_ui_text(prop, "Flip", "Flip filling colors");
616  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
617 
618  prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, PROP_NONE);
621  prop, "Self Overlap", "Disable stencil and overlap self intersections with alpha materials");
622  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
623 
624  prop = RNA_def_property(srna, "use_stroke_holdout", PROP_BOOLEAN, PROP_NONE);
627  prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
628  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
629 
630  prop = RNA_def_property(srna, "use_fill_holdout", PROP_BOOLEAN, PROP_NONE);
633  prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
634  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
635 
636  prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
638  RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
639  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
640 
641  prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
643  RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
644  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
645 
646  /* Mode to align Dots and Boxes to drawing path and object rotation */
647  prop = RNA_def_property(srna, "alignment_mode", PROP_ENUM, PROP_NONE);
648  RNA_def_property_enum_bitflag_sdna(prop, NULL, "alignment_mode");
649  RNA_def_property_enum_items(prop, alignment_draw_items);
651  prop, "Alignment", "Defines how align Dots and Boxes with drawing path and object rotation");
652  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
653 
654  /* Rotation of texture for Dots or Strokes. */
655  prop = RNA_def_property(srna, "alignment_rotation", PROP_FLOAT, PROP_ANGLE);
656  RNA_def_property_float_sdna(prop, NULL, "alignment_rotation");
657  RNA_def_property_float_default(prop, 0.0f);
658  RNA_def_property_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f));
659  RNA_def_property_ui_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f), 10, 3);
661  "Rotation",
662  "Additional rotation applied to dots and square texture of strokes. "
663  "Only applies in texture shading mode");
664  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
665 
666  /* pass index for future compositing and editing tools */
667  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
668  RNA_def_property_int_sdna(prop, NULL, "index");
669  RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Color Index\" pass");
670  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
671 
672  /* mode type */
673  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
675  RNA_def_property_enum_items(prop, gpcolordata_mode_types_items);
676  RNA_def_property_ui_text(prop, "Line Type", "Select line type for strokes");
677  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
678 
679  /* stroke style */
680  prop = RNA_def_property(srna, "stroke_style", PROP_ENUM, PROP_NONE);
681  RNA_def_property_enum_bitflag_sdna(prop, NULL, "stroke_style");
682  RNA_def_property_enum_items(prop, stroke_style_items);
683  RNA_def_property_ui_text(prop, "Stroke Style", "Select style used to draw strokes");
684  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
685 
686  /* stroke image texture */
687  prop = RNA_def_property(srna, "stroke_image", PROP_POINTER, PROP_NONE);
688  RNA_def_property_pointer_sdna(prop, NULL, "sima");
689  RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_stroke_image_set", NULL, NULL);
692  RNA_def_property_ui_text(prop, "Image", "");
693  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
694 
695  /* fill style */
696  prop = RNA_def_property(srna, "fill_style", PROP_ENUM, PROP_NONE);
697  RNA_def_property_enum_bitflag_sdna(prop, NULL, "fill_style");
698  RNA_def_property_enum_items(prop, fill_style_items);
699  RNA_def_property_ui_text(prop, "Fill Style", "Select style used to fill strokes");
700  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
701 
702  /* gradient type */
703  prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
704  RNA_def_property_enum_bitflag_sdna(prop, NULL, "gradient_type");
705  RNA_def_property_enum_items(prop, fill_gradient_items);
706  RNA_def_property_ui_text(prop, "Gradient Type", "Select type of gradient used to fill strokes");
707  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
708 
709  /* fill image texture */
710  prop = RNA_def_property(srna, "fill_image", PROP_POINTER, PROP_NONE);
711  RNA_def_property_pointer_sdna(prop, NULL, "ima");
712  RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_fill_image_set", NULL, NULL);
715  RNA_def_property_ui_text(prop, "Image", "");
716  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
717 
718  /* Read-only state props (for simpler UI code) */
719  prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
720  RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_stroke_visible_get", NULL);
723  prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
724 
725  prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
726  RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_fill_visible_get", NULL);
729  prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
730 }
732 {
733  StructRNA *srna;
734  PropertyRNA *prop;
735 
736  srna = RNA_def_struct(brna, "MaterialLineArt", NULL);
737  RNA_def_struct_sdna(srna, "MaterialLineArt");
738  RNA_def_struct_ui_text(srna, "Material Line Art", "");
739  RNA_def_struct_path_func(srna, "rna_MaterialLineArt_path");
740 
741  prop = RNA_def_property(srna, "use_material_mask", PROP_BOOLEAN, PROP_NONE);
745  prop, "Use Material Mask", "Use material masks to filter out occluded strokes");
746  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
747 
748  prop = RNA_def_property(srna, "use_material_mask_bits", PROP_BOOLEAN, PROP_NONE);
750  RNA_def_property_boolean_sdna(prop, NULL, "material_mask_bits", 1);
751  RNA_def_property_array(prop, 8);
752  RNA_def_property_ui_text(prop, "Mask", "");
753  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
754 
755  prop = RNA_def_property(srna, "mat_occlusion", PROP_INT, PROP_NONE);
757  RNA_def_property_ui_range(prop, 0.0f, 5.0f, 1.0f, 1);
759  prop,
760  "Effectiveness",
761  "Faces with this material will behave as if it has set number of layers in occlusion");
762  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
763 
764  prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
765  RNA_def_property_range(prop, 0, 255);
767  "Intersection Priority",
768  "The intersection line will be included into the object with the "
769  "higher intersection priority value");
770  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
771 
772  prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
776  "Use Intersection Priority",
777  "Override object and collection intersection priority value");
778  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
779 }
780 
782 {
783  StructRNA *srna;
784  PropertyRNA *prop;
785 
786  /* Render Preview Types */
787  static const EnumPropertyItem preview_type_items[] = {
788  {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
789  {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
790  {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
791  {MA_HAIR, "HAIR", ICON_CURVES, "Hair", "Hair strands"},
792  {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader ball"},
793  {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
794  {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
795  {0, NULL, 0, NULL, NULL},
796  };
797 
798  static EnumPropertyItem prop_eevee_blend_items[] = {
799  {MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
800  {MA_BM_CLIP,
801  "CLIP",
802  0,
803  "Alpha Clip",
804  "Use the alpha threshold to clip the visibility (binary visibility)"},
805  {MA_BM_HASHED,
806  "HASHED",
807  0,
808  "Alpha Hashed",
809  "Use noise to dither the binary visibility (works well with multi-samples)"},
810  {MA_BM_BLEND,
811  "BLEND",
812  0,
813  "Alpha Blend",
814  "Render polygon transparent, depending on alpha channel of the texture"},
815  {0, NULL, 0, NULL, NULL},
816  };
817 
818  static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
819  {MA_BS_NONE, "NONE", 0, "None", "Material will cast no shadow"},
820  {MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
821  {MA_BS_CLIP,
822  "CLIP",
823  0,
824  "Alpha Clip",
825  "Use the alpha threshold to clip the visibility (binary visibility)"},
826  {MA_BS_HASHED,
827  "HASHED",
828  0,
829  "Alpha Hashed",
830  "Use noise to dither the binary visibility and use filtering to reduce the noise"},
831  {0, NULL, 0, NULL, NULL},
832  };
833 
834  srna = RNA_def_struct(brna, "Material", "ID");
836  srna,
837  "Material",
838  "Material data-block to define the appearance of geometric objects for rendering");
839  RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
840 
841  /* Blending (only Eevee for now) */
842  prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
843  RNA_def_property_enum_items(prop, prop_eevee_blend_items);
844  RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
845  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
846 
847  prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
848  RNA_def_property_enum_sdna(prop, NULL, "blend_shadow");
849  RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
850  RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
851  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
852 
853  prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
854  RNA_def_property_range(prop, 0, 1);
856  "Clip Threshold",
857  "A pixel is rendered only if its alpha value is above this threshold");
858  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
859 
860  prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
863  "Show Backface",
864  "Render multiple transparent layers "
865  "(may introduce transparency sorting problems)");
866  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
867 
868  prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
871  prop, "Backface Culling", "Use back face culling to hide the back side of faces");
872  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
873 
874  prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
877  prop, "Screen Space Refraction", "Use raytraced screen space refractions");
878  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
879 
880  prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
883  prop, "Subsurface Translucency", "Add translucency effect to subsurface");
884  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
885 
886  prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
887  RNA_def_property_float_sdna(prop, NULL, "refract_depth");
888  RNA_def_property_range(prop, 0.0f, FLT_MAX);
890  "Refraction Depth",
891  "Approximate the thickness of the object to compute two refraction "
892  "events (0 is disabled)");
893  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
894 
895  /* For Preview Render */
896  prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
897  RNA_def_property_enum_sdna(prop, NULL, "pr_type");
898  RNA_def_property_enum_items(prop, preview_type_items);
899  RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
900  RNA_def_property_update(prop, 0, "rna_Material_update_previews");
901 
902  prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
905  prop, "Preview World", "Use the current world background to light the preview render");
906  RNA_def_property_update(prop, 0, "rna_Material_update_previews");
907 
908  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
909  RNA_def_property_int_sdna(prop, NULL, "index");
911  prop, "Pass Index", "Index number for the \"Material Index\" render pass");
912  RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
913 
914  /* nodetree */
915  prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
916  RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
919  RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
920 
921  prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
922  RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
925  RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
926  RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
927 
928  /* common */
930  rna_def_texpaint_slots(brna, srna);
931 
933 
934  /* grease pencil */
935  prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
936  RNA_def_property_pointer_sdna(prop, NULL, "gp_style");
938  prop, "Grease Pencil Settings", "Grease pencil color settings for material");
939 
940  prop = RNA_def_property(srna, "is_grease_pencil", PROP_BOOLEAN, PROP_NONE);
941  RNA_def_property_boolean_funcs(prop, "rna_is_grease_pencil_get", NULL);
944  prop, "Is Grease Pencil", "True if this material has grease pencil data");
945 
946  /* line art */
947  prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
948  RNA_def_property_pointer_sdna(prop, NULL, "lineart");
949  RNA_def_property_ui_text(prop, "Line Art Settings", "Line art settings for material");
950 
953 
954  RNA_api_material(srna);
955 }
956 
958  PropertyRNA *cprop,
959  const char *structname,
960  const char *structname_slots)
961 {
962  StructRNA *srna;
963 
964  FunctionRNA *func;
965  PropertyRNA *parm;
966 
967  RNA_def_property_srna(cprop, structname_slots);
968  srna = RNA_def_struct(brna, structname_slots, NULL);
969  RNA_def_struct_sdna(srna, "ID");
970  RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
971 
972  /* functions */
973  func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
976  parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
977  RNA_def_function_return(func, parm);
978 
979  func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
982  parm = RNA_def_int(
983  func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
985  parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
986  RNA_def_function_return(func, parm);
987 
988  func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
991  parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
993 }
994 
996  StructRNA *srna,
997  const char *begin,
998  const char *activeget,
999  const char *activeset,
1000  const char *activeeditable,
1001  const char *structname,
1002  const char *structname_slots,
1003  const char *update,
1004  const char *update_index)
1005 {
1006  PropertyRNA *prop;
1007 
1008  /* mtex */
1009  prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
1010  RNA_def_property_struct_type(prop, structname);
1012  begin,
1013  "rna_iterator_array_next",
1014  "rna_iterator_array_end",
1015  "rna_iterator_array_dereference_get",
1016  NULL,
1017  NULL,
1018  NULL,
1019  NULL);
1021  prop, "Textures", "Texture slots defining the mapping and influence of textures");
1022  rna_def_texture_slots(brna, prop, structname, structname_slots);
1023 
1024  prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
1025  RNA_def_property_struct_type(prop, "Texture");
1027  if (activeeditable) {
1028  RNA_def_property_editable_func(prop, activeeditable);
1029  }
1030  RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
1031  RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
1033 
1034  prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
1035  RNA_def_property_int_sdna(prop, NULL, "texact");
1036  RNA_def_property_range(prop, 0, MAX_MTEX - 1);
1037  RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
1039 }
1040 
1041 static void rna_def_tex_slot(BlenderRNA *brna)
1042 {
1043  StructRNA *srna;
1044  PropertyRNA *prop;
1045 
1046  srna = RNA_def_struct(brna, "TexPaintSlot", NULL);
1048  srna, "Texture Paint Slot", "Slot that contains information about texture painting");
1049 
1050  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1053  prop, "rna_TexPaintSlot_name_get", "rna_TexPaintSlot_name_length", NULL);
1054  RNA_def_property_ui_text(prop, "Name", "Name of the slot");
1055  RNA_def_struct_name_property(srna, prop);
1056 
1057  prop = RNA_def_property(srna, "icon_value", PROP_INT, PROP_NONE);
1059  RNA_def_property_int_funcs(prop, "rna_TexPaintSlot_icon_get", NULL, NULL);
1060  RNA_def_property_ui_text(prop, "Icon", "Paint slot icon");
1061 
1062  prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1063  RNA_def_property_string_maxlength(prop, 64); /* else it uses the pointer size! */
1064  RNA_def_property_string_sdna(prop, NULL, "uvname");
1066  "rna_TexPaintSlot_uv_layer_get",
1067  "rna_TexPaintSlot_uv_layer_length",
1068  "rna_TexPaintSlot_uv_layer_set");
1069  RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
1070  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
1071 
1072  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
1073  RNA_def_property_boolean_sdna(prop, NULL, "valid", 1);
1075  RNA_def_property_ui_text(prop, "Valid", "Slot has a valid image and UV map");
1076 }
1077 
1079 {
1080  PropertyRNA *prop;
1081 
1082  rna_def_tex_slot(brna);
1083 
1084  /* mtex */
1085  prop = RNA_def_property(srna, "texture_paint_images", PROP_COLLECTION, PROP_NONE);
1086  RNA_def_property_collection_sdna(prop, NULL, "texpaintslot", NULL);
1088  "rna_Material_texpaint_begin",
1089  "rna_iterator_array_next",
1090  "rna_iterator_array_end",
1091  "rna_iterator_array_dereference_get",
1092  NULL,
1093  NULL,
1094  NULL,
1095  NULL);
1096  RNA_def_property_struct_type(prop, "Image");
1098  prop, "Texture Slot Images", "Texture images used for texture painting");
1099 
1100  prop = RNA_def_property(srna, "texture_paint_slots", PROP_COLLECTION, PROP_NONE);
1102  "rna_Material_texpaint_begin",
1103  "rna_iterator_array_next",
1104  "rna_iterator_array_end",
1105  "rna_iterator_array_get",
1106  NULL,
1107  NULL,
1108  NULL,
1109  NULL);
1110  RNA_def_property_struct_type(prop, "TexPaintSlot");
1112  prop, "Texture Slots", "Texture slots defining the mapping and influence of textures");
1113 
1114  prop = RNA_def_property(srna, "paint_active_slot", PROP_INT, PROP_UNSIGNED);
1115  RNA_def_property_range(prop, 0, SHRT_MAX);
1117  prop, "Active Paint Texture Index", "Index of active texture paint slot");
1120  prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_Material_active_paint_texture_index_update");
1121 
1122  prop = RNA_def_property(srna, "paint_clone_slot", PROP_INT, PROP_UNSIGNED);
1123  RNA_def_property_range(prop, 0, SHRT_MAX);
1124  RNA_def_property_ui_text(prop, "Clone Paint Texture Index", "Index of clone texture paint slot");
1126 }
1127 
1128 #endif
void BKE_id_attributes_active_color_set(struct ID *id, struct CustomDataLayer *active_layer)
Definition: attribute.cc:715
struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, const char *name)
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
CustomData interface, see also DNA_customdata_types.h.
#define GPENCIL_ALPHA_OPACITY_THRESH
Definition: BKE_gpencil.h:323
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
General operations, lookup, etc. for materials.
struct bNode * BKE_texpaint_slot_material_find_node(struct Material *ma, short texpaint_slot)
Definition: material.c:1599
void BKE_node_preview_clear_tree(struct bNodeTree *ntree)
Definition: node.cc:2852
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:3644
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act)
Definition: texture.c:483
struct MTex * BKE_texture_mtex_add_id(struct ID *id, int slot)
Definition: texture.c:402
#define DEG2RADF(_deg)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_SHADING
Definition: DNA_ID.h:811
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
#define MAX_NAME
Definition: DNA_defs.h:48
@ GP_MATERIAL_GRADIENT_RADIAL
@ GP_MATERIAL_GRADIENT_LINEAR
@ GP_MATERIAL_FILL_STYLE_GRADIENT
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
#define MA_RAMP_SUB
struct TexPaintSlot TexPaintSlot
#define MA_RAMP_VAL
#define MA_RAMP_DIFF
@ MA_FLUID
@ MA_CLOTH
@ MA_SHADERBALL
@ MA_FLAT
@ MA_CUBE
@ MA_SPHERE
@ MA_HAIR
#define MA_RAMP_DARK
#define MA_RAMP_BURN
#define MA_RAMP_LIGHT
#define MA_RAMP_SOFT
@ MA_BS_HASHED
@ MA_BS_CLIP
@ MA_BS_NONE
@ MA_BS_SOLID
#define MA_RAMP_LINEAR
#define MA_RAMP_OVERLAY
#define MA_RAMP_MULT
@ GP_MATERIAL_LOCKED
@ GP_MATERIAL_FLIP_FILL
@ GP_MATERIAL_HIDE_ONIONSKIN
@ GP_MATERIAL_HIDE
@ GP_MATERIAL_DISABLE_STENCIL
@ GP_MATERIAL_IS_STROKE_HOLDOUT
@ GP_MATERIAL_STROKE_SHOW
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ GP_MATERIAL_FILL_SHOW
@ GP_MATERIAL_TEX_CLAMP
#define MA_RAMP_SAT
@ LRT_MATERIAL_CUSTOM_INTERSECTION_PRIORITY
@ LRT_MATERIAL_MASK_ENABLED
@ GP_MATERIAL_MODE_SQUARE
@ GP_MATERIAL_MODE_DOT
@ GP_MATERIAL_MODE_LINE
#define MA_RAMP_DIV
@ GP_MATERIAL_FOLLOW_OBJ
@ GP_MATERIAL_FOLLOW_PATH
@ GP_MATERIAL_FOLLOW_FIXED
#define MA_RAMP_DODGE
#define MA_PREVIEW_WORLD
#define MA_RAMP_SCREEN
#define MA_RAMP_HUE
@ MA_BM_CLIP
@ MA_BM_HASHED
@ MA_BM_SOLID
@ MA_BM_BLEND
#define MA_RAMP_BLEND
#define MA_RAMP_ADD
#define MA_RAMP_COLOR
@ MA_BL_CULL_BACKFACE
@ MA_BL_TRANSLUCENCY
@ MA_BL_SS_REFRACTION
@ MA_BL_HIDE_BACKFACE
Object is a sort of wrapper for general info.
@ OB_MESH
@ OB_GPENCIL
@ SPACE_IMAGE
void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Image *ima, bool automatic)
Definition: image_edit.c:45
void ED_node_shader_default(const struct bContext *C, struct ID *id)
struct wmWindow * ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm)
Read Guarded memory(de)allocation.
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_NO_SELF
Definition: RNA_types.h:656
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:662
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
#define RNA_ENUM_ITEM_SEPR
Definition: RNA_types.h:483
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:269
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_COORDS
Definition: RNA_types.h:167
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_FACTOR
Definition: RNA_types.h:144
@ PROP_UNSIGNED
Definition: RNA_types.h:142
#define C
Definition: RandGen.cpp:25
#define MAX_MTEX
Definition: Stroke.h:31
#define ND_SHADING
Definition: WM_types.h:425
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DATA
Definition: WM_types.h:456
#define ND_SHADING_PREVIEW
Definition: WM_types.h:428
#define NC_MATERIAL
Definition: WM_types.h:330
#define NC_GPENCIL
Definition: WM_types.h:349
#define NC_TEXTURE
Definition: WM_types.h:331
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_SHADING_LINKS
Definition: WM_types.h:427
#define ND_SHADING_DRAW
Definition: WM_types.h:426
return(oflags[bm->toolflag_index].f &oflag) !=0
OperationNode * node
Scene scene
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void update_index(const char *filename, FileIndexerEntries *entries, void *user_data)
static void update(bNodeTree *ntree)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
Definition: rna_access.c:4781
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2022
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
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)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1937
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_int_default(PropertyRNA *prop, int value)
Definition: rna_define.c:1978
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
Definition: rna_define.c:1920
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2855
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2669
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct ReportList *reports, int index)
void RNA_api_material(StructRNA *srna)
struct MTex * rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports)
struct MTex * rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index)
static void rna_def_material_greasepencil(BlenderRNA *brna)
Definition: rna_material.c:465
static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
Definition: rna_material.c:957
const EnumPropertyItem rna_enum_ramp_blend_items[]
Definition: rna_material.c:26
void RNA_def_material(BlenderRNA *brna)
Definition: rna_material.c:781
void rna_def_texpaint_slots(BlenderRNA *brna, StructRNA *srna)
static void rna_def_tex_slot(BlenderRNA *brna)
static void rna_def_material_lineart(BlenderRNA *brna)
Definition: rna_material.c:731
void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *structname, const char *structname_slots, const char *update, const char *update_index)
Definition: rna_material.c:995
static void rna_def_material_display(StructRNA *srna)
Definition: rna_material.c:411
Definition: DNA_ID.h:368
void * next
Definition: DNA_ID.h:369
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase wm
Definition: BKE_main.h:197
ListBase screens
Definition: BKE_main.h:183
ListBase objects
Definition: BKE_main.h:170
struct bNodeTree * nodetree
short paint_active_slot
struct MaterialGPencilStyle * gp_style
struct TexPaintSlot * texpaintslot
void * data
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct Image * ima
ListBase areabase
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480