Blender  V2.93
rna_material.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <float.h>
22 #include <stdlib.h>
23 
24 #include "DNA_material_types.h"
25 #include "DNA_texture_types.h"
26 
27 #include "BLI_math.h"
28 
29 #include "RNA_define.h"
30 #include "RNA_enum_types.h"
31 
32 #include "rna_internal.h"
33 
34 #include "WM_api.h"
35 #include "WM_types.h"
36 
38  {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
39  {0, "", ICON_NONE, NULL, NULL},
40  {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
41  {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
42  {MA_RAMP_BURN, "BURN", 0, "Color Burn", ""},
43  {0, "", ICON_NONE, NULL, NULL},
44  {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
45  {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
46  {MA_RAMP_DODGE, "DODGE", 0, "Color Dodge", ""},
47  {MA_RAMP_ADD, "ADD", 0, "Add", ""},
48  {0, "", ICON_NONE, NULL, NULL},
49  {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
50  {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
51  {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
52  {0, "", ICON_NONE, NULL, NULL},
53  {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
54  {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
55  {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
56  {0, "", ICON_NONE, NULL, NULL},
57  {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
58  {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
59  {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
60  {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
61  {0, NULL, 0, NULL, NULL},
62 };
63 
64 #ifdef RNA_RUNTIME
65 
66 # include "MEM_guardedalloc.h"
67 
68 # include "DNA_gpencil_types.h"
69 # include "DNA_node_types.h"
70 # include "DNA_object_types.h"
71 # include "DNA_screen_types.h"
72 # include "DNA_space_types.h"
73 
74 # include "BKE_colorband.h"
75 # include "BKE_context.h"
76 # include "BKE_gpencil.h"
77 # include "BKE_main.h"
78 # include "BKE_material.h"
79 # include "BKE_node.h"
80 # include "BKE_paint.h"
81 # include "BKE_scene.h"
82 # include "BKE_texture.h"
83 # include "BKE_workspace.h"
84 
85 # include "DEG_depsgraph.h"
86 # include "DEG_depsgraph_build.h"
87 
88 # include "ED_gpencil.h"
89 # include "ED_image.h"
90 # include "ED_node.h"
91 # include "ED_screen.h"
92 
93 static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
94 {
95  Material *ma = (Material *)ptr->owner_id;
96 
99 }
100 
101 static void rna_Material_update_previews(Main *UNUSED(bmain),
102  Scene *UNUSED(scene),
103  PointerRNA *ptr)
104 {
105  Material *ma = (Material *)ptr->owner_id;
106 
107  if (ma->nodetree) {
109  }
110 
112 }
113 
114 static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *ptr)
115 {
116  Material *ma = (Material *)ptr->owner_id;
117  rna_Material_update(bmain, scene, ptr);
118 
119  /* Need set all caches as dirty. */
120  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
121  if (ob->type == OB_GPENCIL) {
122  bGPdata *gpd = (bGPdata *)ob->data;
124  }
125  }
126 
128 }
129 
130 static void rna_MaterialLineArt_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
131 {
132  Material *ma = (Material *)ptr->owner_id;
133  /* Need to tag geometry for line art modifier updates. */
136 }
137 
138 static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
139 {
140  Material *ma = (Material *)ptr->owner_id;
141 
144 }
145 
146 static void rna_Material_texpaint_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
147 {
148  Material *ma = (Material *)ptr->data;
150  iter, (void *)ma->texpaintslot, sizeof(TexPaintSlot), ma->tot_slots, 0, NULL);
151 }
152 
153 static void rna_Material_active_paint_texture_index_update(Main *bmain,
154  Scene *UNUSED(scene),
155  PointerRNA *ptr)
156 {
157  bScreen *screen;
158  Material *ma = (Material *)ptr->owner_id;
159 
160  if (ma->use_nodes && ma->nodetree) {
162 
163  if (node) {
165  }
166  }
167 
168  if (ma->texpaintslot) {
169  Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
170  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
171  wmWindow *win = ED_screen_window_find(screen, bmain->wm.first);
172  if (win == NULL) {
173  continue;
174  }
175 
176  Object *obedit = NULL;
177  {
178  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
179  obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
180  }
181 
182  ScrArea *area;
183  for (area = screen->areabase.first; area; area = area->next) {
184  SpaceLink *sl;
185  for (sl = area->spacedata.first; sl; sl = sl->next) {
186  if (sl->spacetype == SPACE_IMAGE) {
187  SpaceImage *sima = (SpaceImage *)sl;
188  if (!sima->pin) {
189  ED_space_image_set(bmain, sima, obedit, image, true);
190  }
191  }
192  }
193  }
194  }
195  }
196 
197  DEG_id_tag_update(&ma->id, 0);
199 }
200 
201 static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
202 {
203  Material *ma = (Material *)ptr->data;
204  Main *bmain = CTX_data_main(C);
205 
206  if (ma->use_nodes && ma->nodetree == NULL) {
207  ED_node_shader_default(C, &ma->id);
208  }
209 
212  rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
213 }
214 
215 MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
216 {
217  MTex *mtex = BKE_texture_mtex_add_id(self_id, -1);
218  if (mtex == NULL) {
219  BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
220  return NULL;
221  }
222 
223  /* for redraw only */
225 
226  return mtex;
227 }
228 
230  struct bContext *C,
231  ReportList *reports,
232  int index)
233 {
234  MTex *mtex;
235 
236  if (index < 0 || index >= MAX_MTEX) {
237  BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
238  return NULL;
239  }
240 
241  mtex = BKE_texture_mtex_add_id(self_id, index);
242 
243  /* for redraw only */
245 
246  return mtex;
247 }
248 
249 void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *reports, int index)
250 {
251  MTex **mtex_ar;
252  short act;
253 
254  give_active_mtex(self_id, &mtex_ar, &act);
255 
256  if (mtex_ar == NULL) {
257  BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
258  return;
259  }
260 
261  if (index < 0 || index >= MAX_MTEX) {
262  BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
263  return;
264  }
265 
266  if (mtex_ar[index]) {
267  id_us_min((ID *)mtex_ar[index]->tex);
268  MEM_freeN(mtex_ar[index]);
269  mtex_ar[index] = NULL;
270  DEG_id_tag_update(self_id, 0);
271  }
272 
273  /* for redraw only */
275 }
276 
277 static void rna_TexPaintSlot_uv_layer_get(PointerRNA *ptr, char *value)
278 {
280 
281  if (data->uvname != NULL) {
282  BLI_strncpy_utf8(value, data->uvname, 64);
283  }
284  else {
285  value[0] = '\0';
286  }
287 }
288 
289 static int rna_TexPaintSlot_uv_layer_length(PointerRNA *ptr)
290 {
292  return data->uvname == NULL ? 0 : strlen(data->uvname);
293 }
294 
295 static void rna_TexPaintSlot_uv_layer_set(PointerRNA *ptr, const char *value)
296 {
298 
299  if (data->uvname != NULL) {
300  BLI_strncpy_utf8(data->uvname, value, 64);
301  }
302 }
303 
304 static bool rna_is_grease_pencil_get(PointerRNA *ptr)
305 {
306  Material *ma = (Material *)ptr->data;
307  if (ma->gp_style != NULL) {
308  return true;
309  }
310 
311  return false;
312 }
313 
314 static void rna_gpcolordata_uv_update(Main *bmain, Scene *scene, PointerRNA *ptr)
315 {
316  /* update all uv strokes of this color */
317  Material *ma = (Material *)ptr->owner_id;
318  ED_gpencil_update_color_uv(bmain, ma);
319 
320  rna_MaterialGpencil_update(bmain, scene, ptr);
321 }
322 
323 static char *rna_GpencilColorData_path(PointerRNA *UNUSED(ptr))
324 {
325  return BLI_strdup("grease_pencil");
326 }
327 
328 static int rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
329 {
330  MaterialGPencilStyle *pcolor = ptr->data;
331  return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
332 }
333 
334 static int rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
335 {
337  return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
338 }
339 
340 static void rna_GpencilColorData_stroke_image_set(PointerRNA *ptr,
341  PointerRNA value,
342  struct ReportList *UNUSED(reports))
343 {
344  MaterialGPencilStyle *pcolor = ptr->data;
345  ID *id = value.data;
346 
347  id_us_plus(id);
348  pcolor->sima = (struct Image *)id;
349 }
350 
351 static void rna_GpencilColorData_fill_image_set(PointerRNA *ptr,
352  PointerRNA value,
353  struct ReportList *UNUSED(reports))
354 {
356  ID *id = value.data;
357 
358  id_us_plus(id);
359  pcolor->ima = (struct Image *)id;
360 }
361 
362 #else
363 
365 {
366  PropertyRNA *prop;
367 
368  prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
369  RNA_def_property_float_sdna(prop, NULL, "r");
370  RNA_def_property_array(prop, 4);
372  RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
373  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
374 
375  prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
376  RNA_def_property_float_sdna(prop, NULL, "specr");
377  RNA_def_property_array(prop, 3);
379  RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
380  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
381 
382  prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_FACTOR);
383  RNA_def_property_float_sdna(prop, NULL, "roughness");
384  RNA_def_property_range(prop, 0, 1);
386  RNA_def_property_ui_text(prop, "Roughness", "Roughness of the material");
387  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
388 
389  prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
390  RNA_def_property_float_sdna(prop, NULL, "spec");
391  RNA_def_property_range(prop, 0, 1);
393  RNA_def_property_ui_text(prop, "Specular", "How intense (bright) the specular reflection is");
394  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
395 
396  prop = RNA_def_property(srna, "metallic", PROP_FLOAT, PROP_FACTOR);
397  RNA_def_property_float_sdna(prop, NULL, "metallic");
398  RNA_def_property_range(prop, 0.0f, 1.0f);
400  RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
401  RNA_def_property_update(prop, 0, "rna_Material_update");
402 
403  /* Freestyle line color */
404  prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
405  RNA_def_property_float_sdna(prop, NULL, "line_col");
406  RNA_def_property_array(prop, 4);
407  RNA_def_property_ui_text(prop, "Line Color", "Line color used for Freestyle line rendering");
408  RNA_def_property_update(prop, 0, "rna_Material_update");
409 
410  prop = RNA_def_property(srna, "line_priority", PROP_INT, PROP_NONE);
411  RNA_def_property_int_sdna(prop, NULL, "line_priority");
412  RNA_def_property_range(prop, 0, 32767);
414  prop, "Line Priority", "The line color of a higher priority is used at material boundaries");
415  RNA_def_property_update(prop, 0, "rna_Material_update");
416 }
417 
419 {
420  StructRNA *srna;
421  PropertyRNA *prop;
422 
423  /* mode type styles */
424  static EnumPropertyItem gpcolordata_mode_types_items[] = {
425  {GP_MATERIAL_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
426  {GP_MATERIAL_MODE_DOT, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
427  {GP_MATERIAL_MODE_SQUARE, "BOX", 0, "Squares", "Draw strokes using separated squares"},
428  {0, NULL, 0, NULL, NULL},
429  };
430 
431  /* stroke styles */
432  static EnumPropertyItem stroke_style_items[] = {
433  {GP_MATERIAL_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
434  {GP_MATERIAL_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
435  {0, NULL, 0, NULL, NULL},
436  };
437 
438  /* fill styles */
439  static EnumPropertyItem fill_style_items[] = {
440  {GP_MATERIAL_FILL_STYLE_SOLID, "SOLID", 0, "Solid", "Fill area with solid color"},
442  "GRADIENT",
443  0,
444  "Gradient",
445  "Fill area with gradient color"},
446  {GP_MATERIAL_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
447  {0, NULL, 0, NULL, NULL},
448  };
449 
450  static EnumPropertyItem fill_gradient_items[] = {
451  {GP_MATERIAL_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
452  {GP_MATERIAL_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
453  {0, NULL, 0, NULL, NULL},
454  };
455 
456  static EnumPropertyItem alignment_draw_items[] = {
458  "PATH",
459  0,
460  "Path",
461  "Follow stroke drawing path and object rotation"},
462  {GP_MATERIAL_FOLLOW_OBJ, "OBJECT", 0, "Object", "Follow object rotation only"},
464  "FIXED",
465  0,
466  "Fixed",
467  "Do not follow drawing path or object rotation and keeps aligned with viewport"},
468  {0, NULL, 0, NULL, NULL},
469  };
470 
471  srna = RNA_def_struct(brna, "MaterialGPencilStyle", NULL);
472  RNA_def_struct_sdna(srna, "MaterialGPencilStyle");
473  RNA_def_struct_ui_text(srna, "Grease Pencil Color", "");
474  RNA_def_struct_path_func(srna, "rna_GpencilColorData_path");
475 
476  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
477  RNA_def_property_range(prop, 0.0, 1.0);
478  RNA_def_property_float_sdna(prop, NULL, "stroke_rgba");
479  RNA_def_property_array(prop, 4);
480  RNA_def_property_ui_text(prop, "Color", "");
481  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
482 
483  /* Fill Drawing Color */
484  prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR);
485  RNA_def_property_float_sdna(prop, NULL, "fill_rgba");
486  RNA_def_property_array(prop, 4);
487  RNA_def_property_range(prop, 0.0f, 1.0f);
488  RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
489  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
490 
491  /* Secondary Drawing Color */
492  prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR);
493  RNA_def_property_float_sdna(prop, NULL, "mix_rgba");
494  RNA_def_property_array(prop, 4);
495  RNA_def_property_range(prop, 0.0f, 1.0f);
496  RNA_def_property_ui_text(prop, "Mix Color", "Color for mixing with primary filling color");
497  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
498 
499  /* Mix factor */
500  prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_FACTOR);
501  RNA_def_property_float_sdna(prop, NULL, "mix_factor");
502  RNA_def_property_range(prop, 0.0f, 1.0f);
503  RNA_def_property_ui_text(prop, "Mix", "Mix Factor");
504  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
505 
506  /* Stroke Mix factor */
507  prop = RNA_def_property(srna, "mix_stroke_factor", PROP_FLOAT, PROP_FACTOR);
508  RNA_def_property_float_sdna(prop, NULL, "mix_stroke_factor");
509  RNA_def_property_range(prop, 0.0f, 1.0f);
510  RNA_def_property_ui_text(prop, "Mix", "Mix Stroke Factor");
511  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
512 
513  /* Texture angle */
514  prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
515  RNA_def_property_float_sdna(prop, NULL, "texture_angle");
516  RNA_def_property_ui_text(prop, "Angle", "Texture Orientation Angle");
517  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
518 
519  /* Scale factor for texture */
520  prop = RNA_def_property(srna, "texture_scale", PROP_FLOAT, PROP_COORDS);
521  RNA_def_property_float_sdna(prop, NULL, "texture_scale");
522  RNA_def_property_array(prop, 2);
523  RNA_def_property_ui_text(prop, "Scale", "Scale Factor for Texture");
524  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
525 
526  /* Shift factor to move texture in 2d space */
527  prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_COORDS);
528  RNA_def_property_float_sdna(prop, NULL, "texture_offset");
529  RNA_def_property_array(prop, 2);
530  RNA_def_property_ui_text(prop, "Offset", "Shift Texture in 2d Space");
531  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
532 
533  /* texture pixsize factor (used for UV along the stroke) */
534  prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
535  RNA_def_property_float_sdna(prop, NULL, "texture_pixsize");
536  RNA_def_property_range(prop, 1, 5000);
537  RNA_def_property_ui_text(prop, "UV Factor", "Texture Pixel Size factor along the stroke");
538  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_gpcolordata_uv_update");
539 
540  /* Flags */
541  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
543  RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
544  RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
545  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
546 
547  prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
549  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
551  prop, "Locked", "Protect color from further editing and/or frame changes");
552  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
553 
554  prop = RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
556  RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
558  prop, "Show in Ghosts", "Display strokes using this color when showing onion skins");
559  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
560 
561  prop = RNA_def_property(srna, "texture_clamp", PROP_BOOLEAN, PROP_NONE);
563  RNA_def_property_ui_text(prop, "Clamp", "Do not repeat texture and clamp to one instance only");
564  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
565 
566  prop = RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
568  RNA_def_property_ui_text(prop, "Flip", "Flip filling colors");
569  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
570 
571  prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, PROP_NONE);
574  prop, "Self Overlap", "Disable stencil and overlap self intersections with alpha materials");
575  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
576 
577  prop = RNA_def_property(srna, "use_stroke_holdout", PROP_BOOLEAN, PROP_NONE);
580  prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
581  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
582 
583  prop = RNA_def_property(srna, "use_fill_holdout", PROP_BOOLEAN, PROP_NONE);
586  prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
587  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
588 
589  prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
591  RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
592  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
593 
594  prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
596  RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
597  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
598 
599  /* Mode to align Dots and Boxes to drawing path and object rotation */
600  prop = RNA_def_property(srna, "alignment_mode", PROP_ENUM, PROP_NONE);
601  RNA_def_property_enum_bitflag_sdna(prop, NULL, "alignment_mode");
602  RNA_def_property_enum_items(prop, alignment_draw_items);
604  prop, "Alignment", "Defines how align Dots and Boxes with drawing path and object rotation");
605  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
606 
607  /* Rotation of texture for Dots or Strokes. */
608  prop = RNA_def_property(srna, "alignment_rotation", PROP_FLOAT, PROP_ANGLE);
609  RNA_def_property_float_sdna(prop, NULL, "alignment_rotation");
610  RNA_def_property_float_default(prop, 0.0f);
611  RNA_def_property_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f));
612  RNA_def_property_ui_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f), 10, 3);
614  prop, "Rotation", "Additional rotation applied to dots and square strokes");
615  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
616 
617  /* pass index for future compositing and editing tools */
618  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
619  RNA_def_property_int_sdna(prop, NULL, "index");
620  RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Color Index\" pass");
621  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
622 
623  /* mode type */
624  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
626  RNA_def_property_enum_items(prop, gpcolordata_mode_types_items);
627  RNA_def_property_ui_text(prop, "Line Type", "Select line type for strokes");
628  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
629 
630  /* stroke style */
631  prop = RNA_def_property(srna, "stroke_style", PROP_ENUM, PROP_NONE);
632  RNA_def_property_enum_bitflag_sdna(prop, NULL, "stroke_style");
633  RNA_def_property_enum_items(prop, stroke_style_items);
634  RNA_def_property_ui_text(prop, "Stroke Style", "Select style used to draw strokes");
635  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
636 
637  /* stroke image texture */
638  prop = RNA_def_property(srna, "stroke_image", PROP_POINTER, PROP_NONE);
639  RNA_def_property_pointer_sdna(prop, NULL, "sima");
640  RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_stroke_image_set", NULL, NULL);
643  RNA_def_property_ui_text(prop, "Image", "");
644  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
645 
646  /* fill style */
647  prop = RNA_def_property(srna, "fill_style", PROP_ENUM, PROP_NONE);
648  RNA_def_property_enum_bitflag_sdna(prop, NULL, "fill_style");
649  RNA_def_property_enum_items(prop, fill_style_items);
650  RNA_def_property_ui_text(prop, "Fill Style", "Select style used to fill strokes");
651  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
652 
653  /* gradient type */
654  prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
655  RNA_def_property_enum_bitflag_sdna(prop, NULL, "gradient_type");
656  RNA_def_property_enum_items(prop, fill_gradient_items);
657  RNA_def_property_ui_text(prop, "Gradient Type", "Select type of gradient used to fill strokes");
658  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
659 
660  /* fill image texture */
661  prop = RNA_def_property(srna, "fill_image", PROP_POINTER, PROP_NONE);
662  RNA_def_property_pointer_sdna(prop, NULL, "ima");
663  RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_fill_image_set", NULL, NULL);
666  RNA_def_property_ui_text(prop, "Image", "");
667  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
668 
669  /* Read-only state props (for simpler UI code) */
670  prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
671  RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_stroke_visible_get", NULL);
674  prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
675 
676  prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
677  RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_fill_visible_get", NULL);
680  prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
681 }
683 {
684  StructRNA *srna;
685  PropertyRNA *prop;
686 
687  srna = RNA_def_struct(brna, "MaterialLineArt", NULL);
688  RNA_def_struct_sdna(srna, "MaterialLineArt");
689  RNA_def_struct_ui_text(srna, "Material Line Art", "");
690 
691  prop = RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE);
695  prop, "Use Transparency", "Use transparency mask from this material in line art");
696  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
697 
698  prop = RNA_def_property(srna, "use_transparency_mask", PROP_BOOLEAN, PROP_NONE);
700  RNA_def_property_boolean_sdna(prop, NULL, "transparency_mask", 1);
701  RNA_def_property_array(prop, 8);
702  RNA_def_property_ui_text(prop, "Mask", "");
703  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
704 }
705 
707 {
708  StructRNA *srna;
709  PropertyRNA *prop;
710 
711  /* Render Preview Types */
712  static const EnumPropertyItem preview_type_items[] = {
713  {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
714  {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
715  {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
716  {MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"},
717  {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader ball"},
718  {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
719  {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
720  {0, NULL, 0, NULL, NULL},
721  };
722 
723  static EnumPropertyItem prop_eevee_blend_items[] = {
724  {MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
725  {MA_BM_CLIP,
726  "CLIP",
727  0,
728  "Alpha Clip",
729  "Use the alpha threshold to clip the visibility (binary visibility)"},
730  {MA_BM_HASHED,
731  "HASHED",
732  0,
733  "Alpha Hashed",
734  "Use noise to dither the binary visibility (works well with multi-samples)"},
735  {MA_BM_BLEND,
736  "BLEND",
737  0,
738  "Alpha Blend",
739  "Render polygon transparent, depending on alpha channel of the texture"},
740  {0, NULL, 0, NULL, NULL},
741  };
742 
743  static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
744  {MA_BS_NONE, "NONE", 0, "None", "Material will cast no shadow"},
745  {MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
746  {MA_BS_CLIP,
747  "CLIP",
748  0,
749  "Alpha Clip",
750  "Use the alpha threshold to clip the visibility (binary visibility)"},
751  {MA_BS_HASHED,
752  "HASHED",
753  0,
754  "Alpha Hashed",
755  "Use noise to dither the binary visibility and use filtering to reduce the noise"},
756  {0, NULL, 0, NULL, NULL},
757  };
758 
759  srna = RNA_def_struct(brna, "Material", "ID");
761  srna,
762  "Material",
763  "Material data-block to define the appearance of geometric objects for rendering");
764  RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
765 
766  /* Blending (only Eevee for now) */
767  prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
768  RNA_def_property_enum_items(prop, prop_eevee_blend_items);
769  RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
770  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
771 
772  prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
773  RNA_def_property_enum_sdna(prop, NULL, "blend_shadow");
774  RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
775  RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
776  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
777 
778  prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
779  RNA_def_property_range(prop, 0, 1);
781  "Clip Threshold",
782  "A pixel is rendered only if its alpha value is above this threshold");
783  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
784 
785  prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
788  "Show Backface",
789  "Limit transparency to a single layer "
790  "(avoids transparency sorting problems)");
791  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
792 
793  prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
796  prop, "Backface Culling", "Use back face culling to hide the back side of faces");
797  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
798 
799  prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
802  prop, "Screen Space Refraction", "Use raytraced screen space refractions");
803  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
804 
805  prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
808  prop, "Subsurface Translucency", "Add translucency effect to subsurface");
809  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
810 
811  prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
812  RNA_def_property_float_sdna(prop, NULL, "refract_depth");
813  RNA_def_property_range(prop, 0.0f, FLT_MAX);
815  "Refraction Depth",
816  "Approximate the thickness of the object to compute two refraction "
817  "event (0 is disabled)");
818  RNA_def_property_update(prop, 0, "rna_Material_draw_update");
819 
820  /* For Preview Render */
821  prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
822  RNA_def_property_enum_sdna(prop, NULL, "pr_type");
823  RNA_def_property_enum_items(prop, preview_type_items);
824  RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
825  RNA_def_property_update(prop, 0, "rna_Material_update_previews");
826 
827  prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
830  prop, "Preview World", "Use the current world background to light the preview render");
831  RNA_def_property_update(prop, 0, "rna_Material_update_previews");
832 
833  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
834  RNA_def_property_int_sdna(prop, NULL, "index");
836  prop, "Pass Index", "Index number for the \"Material Index\" render pass");
837  RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
838 
839  /* nodetree */
840  prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
841  RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
843  /* XXX: remove once overrides in material node trees are supported. */
845  RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
846 
847  prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
848  RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
851  RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
852  RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
853 
854  /* common */
856  rna_def_texpaint_slots(brna, srna);
857 
859 
860  /* grease pencil */
861  prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
862  RNA_def_property_pointer_sdna(prop, NULL, "gp_style");
864  prop, "Grease Pencil Settings", "Grease pencil color settings for material");
865 
866  prop = RNA_def_property(srna, "is_grease_pencil", PROP_BOOLEAN, PROP_NONE);
867  RNA_def_property_boolean_funcs(prop, "rna_is_grease_pencil_get", NULL);
870  prop, "Is Grease Pencil", "True if this material has grease pencil data");
871 
872  /* line art */
873  prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
874  RNA_def_property_pointer_sdna(prop, NULL, "lineart");
875  RNA_def_property_ui_text(prop, "Line Art Settings", "Line art settings for material");
876 
879 
880  RNA_api_material(srna);
881 }
882 
884  PropertyRNA *cprop,
885  const char *structname,
886  const char *structname_slots)
887 {
888  StructRNA *srna;
889 
890  FunctionRNA *func;
891  PropertyRNA *parm;
892 
893  RNA_def_property_srna(cprop, structname_slots);
894  srna = RNA_def_struct(brna, structname_slots, NULL);
895  RNA_def_struct_sdna(srna, "ID");
896  RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
897 
898  /* functions */
899  func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
902  parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
903  RNA_def_function_return(func, parm);
904 
905  func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
908  parm = RNA_def_int(
909  func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
911  parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
912  RNA_def_function_return(func, parm);
913 
914  func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
917  parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
919 }
920 
922  StructRNA *srna,
923  const char *begin,
924  const char *activeget,
925  const char *activeset,
926  const char *activeeditable,
927  const char *structname,
928  const char *structname_slots,
929  const char *update,
930  const char *update_index)
931 {
932  PropertyRNA *prop;
933 
934  /* mtex */
935  prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
936  RNA_def_property_struct_type(prop, structname);
938  begin,
939  "rna_iterator_array_next",
940  "rna_iterator_array_end",
941  "rna_iterator_array_dereference_get",
942  NULL,
943  NULL,
944  NULL,
945  NULL);
947  prop, "Textures", "Texture slots defining the mapping and influence of textures");
948  rna_def_texture_slots(brna, prop, structname, structname_slots);
949 
950  prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
951  RNA_def_property_struct_type(prop, "Texture");
953  if (activeeditable) {
954  RNA_def_property_editable_func(prop, activeeditable);
955  }
956  RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
957  RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
959 
960  prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
961  RNA_def_property_int_sdna(prop, NULL, "texact");
962  RNA_def_property_range(prop, 0, MAX_MTEX - 1);
963  RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
965 }
966 
967 static void rna_def_tex_slot(BlenderRNA *brna)
968 {
969  StructRNA *srna;
970  PropertyRNA *prop;
971 
972  srna = RNA_def_struct(brna, "TexPaintSlot", NULL);
974  srna, "Texture Paint Slot", "Slot that contains information about texture painting");
975 
976  prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
977  RNA_def_property_string_maxlength(prop, 64); /* else it uses the pointer size! */
978  RNA_def_property_string_sdna(prop, NULL, "uvname");
980  "rna_TexPaintSlot_uv_layer_get",
981  "rna_TexPaintSlot_uv_layer_length",
982  "rna_TexPaintSlot_uv_layer_set");
983  RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
984  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
985 
986  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
987  RNA_def_property_boolean_sdna(prop, NULL, "valid", 1);
989  RNA_def_property_ui_text(prop, "Valid", "Slot has a valid image and UV map");
990 }
991 
993 {
994  PropertyRNA *prop;
995 
996  rna_def_tex_slot(brna);
997 
998  /* mtex */
999  prop = RNA_def_property(srna, "texture_paint_images", PROP_COLLECTION, PROP_NONE);
1000  RNA_def_property_collection_sdna(prop, NULL, "texpaintslot", NULL);
1002  "rna_Material_texpaint_begin",
1003  "rna_iterator_array_next",
1004  "rna_iterator_array_end",
1005  "rna_iterator_array_dereference_get",
1006  NULL,
1007  NULL,
1008  NULL,
1009  NULL);
1010  RNA_def_property_struct_type(prop, "Image");
1012  prop, "Texture Slot Images", "Texture images used for texture painting");
1013 
1014  prop = RNA_def_property(srna, "texture_paint_slots", PROP_COLLECTION, PROP_NONE);
1016  "rna_Material_texpaint_begin",
1017  "rna_iterator_array_next",
1018  "rna_iterator_array_end",
1019  "rna_iterator_array_get",
1020  NULL,
1021  NULL,
1022  NULL,
1023  NULL);
1024  RNA_def_property_struct_type(prop, "TexPaintSlot");
1026  prop, "Texture Slots", "Texture slots defining the mapping and influence of textures");
1027 
1028  prop = RNA_def_property(srna, "paint_active_slot", PROP_INT, PROP_UNSIGNED);
1029  RNA_def_property_range(prop, 0, SHRT_MAX);
1031  prop, "Active Paint Texture Index", "Index of active texture paint slot");
1033  prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_Material_active_paint_texture_index_update");
1034 
1035  prop = RNA_def_property(srna, "paint_clone_slot", PROP_INT, PROP_UNSIGNED);
1036  RNA_def_property_range(prop, 0, SHRT_MAX);
1037  RNA_def_property_ui_text(prop, "Clone Paint Texture Index", "Index of clone texture paint slot");
1039 }
1040 
1041 #endif
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
#define GPENCIL_ALPHA_OPACITY_THRESH
Definition: BKE_gpencil.h:177
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
General operations, lookup, etc. for materials.
struct bNode * BKE_texpaint_slot_material_find_node(struct Material *ma, short texpaint_slot)
Definition: material.c:1386
void BKE_node_preview_clear_tree(struct bNodeTree *ntree)
Definition: node.cc:2723
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:3694
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act)
Definition: texture.c:499
struct MTex * BKE_texture_mtex_add_id(struct ID *id, int slot)
Definition: texture.c:417
#define DEG2RADF(_deg)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#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:654
@ ID_RECALC_SHADING
Definition: DNA_ID.h:631
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ MA_BL_CULL_BACKFACE
@ MA_BL_TRANSLUCENCY
@ MA_BL_SS_REFRACTION
@ MA_BL_HIDE_BACKFACE
#define MA_RAMP_SUB
struct TexPaintSlot TexPaintSlot
#define MA_FLAT
#define MA_RAMP_VAL
#define MA_RAMP_DIFF
#define MA_RAMP_DARK
@ GP_MATERIAL_FOLLOW_OBJ
@ GP_MATERIAL_FOLLOW_PATH
@ GP_MATERIAL_FOLLOW_FIXED
#define MA_RAMP_BURN
#define MA_RAMP_LIGHT
#define MA_RAMP_SOFT
#define MA_CLOTH
#define MA_RAMP_LINEAR
#define MA_RAMP_OVERLAY
#define MA_RAMP_MULT
#define MA_SHADERBALL
@ 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_HAIR
#define MA_RAMP_SAT
@ LRT_MATERIAL_TRANSPARENCY_ENABLED
#define MA_SPHERE
@ GP_MATERIAL_MODE_SQUARE
@ GP_MATERIAL_MODE_DOT
@ GP_MATERIAL_MODE_LINE
#define MA_RAMP_DIV
@ MA_BM_CLIP
@ MA_BM_HASHED
@ MA_BM_SOLID
@ MA_BM_BLEND
#define MA_RAMP_DODGE
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
#define MA_PREVIEW_WORLD
#define MA_FLUID
#define MA_RAMP_SCREEN
#define MA_RAMP_HUE
@ GP_MATERIAL_GRADIENT_RADIAL
@ GP_MATERIAL_GRADIENT_LINEAR
@ MA_BS_HASHED
@ MA_BS_CLIP
@ MA_BS_NONE
@ MA_BS_SOLID
#define MA_RAMP_BLEND
#define MA_RAMP_ADD
@ GP_MATERIAL_FILL_STYLE_GRADIENT
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
#define MA_RAMP_COLOR
#define MA_CUBE
Object is a sort of wrapper for general info.
@ OB_GPENCIL
#define OBEDIT_FROM_VIEW_LAYER(view_layer)
@ SPACE_IMAGE
void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Object *obedit, struct Image *ima, bool automatic)
Definition: image_edit.c:60
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:337
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_NO_SELF
Definition: RNA_types.h:571
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:317
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:254
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:242
@ PROP_DISTANCE
Definition: RNA_types.h:135
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_ANGLE
Definition: RNA_types.h:132
@ PROP_COORDS
Definition: RNA_types.h:153
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_FACTOR
Definition: RNA_types.h:131
@ PROP_UNSIGNED
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:39
#define MAX_MTEX
Definition: Stroke.h:45
#define ND_SHADING
Definition: WM_types.h:377
#define NC_GEOM
Definition: WM_types.h:294
#define ND_DATA
Definition: WM_types.h:408
#define ND_SHADING_PREVIEW
Definition: WM_types.h:380
#define NC_MATERIAL
Definition: WM_types.h:281
#define NC_GPENCIL
Definition: WM_types.h:300
#define NC_TEXTURE
Definition: WM_types.h:282
#define NC_OBJECT
Definition: WM_types.h:280
#define ND_SHADING_LINKS
Definition: WM_types.h:379
#define ND_SHADING_DRAW
Definition: WM_types.h:378
return(oflags[bm->toolflag_index].f &oflag) !=0
OperationNode * node
Scene scene
void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
static void area(int d1, int d2, int e1, int e2, float weights[2])
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:4875
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:2762
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1212
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2042
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1684
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
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:3408
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1957
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
Definition: rna_define.c:1940
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2877
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2691
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
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:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
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:3585
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
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:418
static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
Definition: rna_material.c:883
const EnumPropertyItem rna_enum_ramp_blend_items[]
Definition: rna_material.c:37
void RNA_def_material(BlenderRNA *brna)
Definition: rna_material.c:706
void rna_def_texpaint_slots(BlenderRNA *brna, StructRNA *srna)
Definition: rna_material.c:992
static void rna_def_tex_slot(BlenderRNA *brna)
Definition: rna_material.c:967
static void rna_def_material_lineart(BlenderRNA *brna)
Definition: rna_material.c:682
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:921
static void rna_def_material_display(StructRNA *srna)
Definition: rna_material.c:364
Definition: DNA_ID.h:273
void * next
Definition: DNA_ID.h:274
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase wm
Definition: BKE_main.h:175
ListBase screens
Definition: BKE_main.h:161
ListBase objects
Definition: BKE_main.h:148
struct bNodeTree * nodetree
short paint_active_slot
struct MaterialGPencilStyle * gp_style
struct TexPaintSlot * texpaintslot
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
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:3157
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2286