Blender  V3.3
render_shading.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #include <cstdlib>
9 #include <cstring>
10 
11 #include "MEM_guardedalloc.h"
12 
13 #include "DNA_curve_types.h"
14 #include "DNA_light_types.h"
15 #include "DNA_lightprobe_types.h"
16 #include "DNA_material_types.h"
17 #include "DNA_node_types.h"
18 #include "DNA_object_types.h"
19 #include "DNA_particle_types.h"
20 #include "DNA_scene_types.h"
21 #include "DNA_space_types.h"
22 #include "DNA_world_types.h"
23 
24 #include "BLI_listbase.h"
25 #include "BLI_math_vector.h"
26 #include "BLI_utildefines.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "BKE_anim_data.h"
31 #include "BKE_animsys.h"
32 #include "BKE_brush.h"
33 #include "BKE_context.h"
34 #include "BKE_curve.h"
35 #include "BKE_editmesh.h"
36 #include "BKE_global.h"
37 #include "BKE_image.h"
38 #include "BKE_layer.h"
39 #include "BKE_lib_id.h"
40 #include "BKE_linestyle.h"
41 #include "BKE_main.h"
42 #include "BKE_material.h"
43 #include "BKE_node.h"
44 #include "BKE_object.h"
45 #include "BKE_report.h"
46 #include "BKE_scene.h"
47 #include "BKE_texture.h"
48 #include "BKE_vfont.h"
49 #include "BKE_workspace.h"
50 #include "BKE_world.h"
51 
52 #include "NOD_composite.h"
53 
54 #include "DEG_depsgraph.h"
55 #include "DEG_depsgraph_build.h"
56 
57 #ifdef WITH_FREESTYLE
58 # include "BKE_freestyle.h"
59 # include "FRS_freestyle.h"
60 # include "RNA_enum_types.h"
61 #endif
62 
63 #include "RNA_access.h"
64 
65 #include "WM_api.h"
66 #include "WM_types.h"
67 
68 #include "ED_curve.h"
69 #include "ED_mesh.h"
70 #include "ED_node.h"
71 #include "ED_object.h"
72 #include "ED_paint.h"
73 #include "ED_render.h"
74 #include "ED_scene.h"
75 #include "ED_screen.h"
76 
77 #include "RNA_define.h"
78 #include "RNA_prototypes.h"
79 
80 #include "UI_interface.h"
81 
82 #include "RE_engine.h"
83 #include "RE_pipeline.h"
84 
86 
87 #include "render_intern.hh" /* own include */
88 
89 static bool object_materials_supported_poll_ex(bContext *C, const Object *ob);
90 
91 /* -------------------------------------------------------------------- */
96 {
97  bContext *C = static_cast<bContext *>(user_data);
99  if (BKE_object_is_in_editmode(ob) == true) {
100  return true;
101  }
102  }
103  return false;
104 }
105 
107 {
110 }
111 
113 {
114  bContext *C = static_cast<bContext *>(user_data);
116  if (BKE_object_is_in_editmode(ob) == false) {
117  return true;
118  }
119  }
120  return false;
121 }
122 
124 {
127 }
128 
131 /* -------------------------------------------------------------------- */
136 {
138  return false;
139  }
140  if (!OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
141  return false;
142  }
143 
144  /* Material linked to object. */
145  if (ob->matbits && ob->actcol && ob->matbits[ob->actcol - 1]) {
146  return true;
147  }
148 
149  /* Material linked to obdata. */
150  const ID *data = static_cast<ID *>(ob->data);
151  return (data && !ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data));
152 }
153 
155 {
156  Object *ob = ED_object_context(C);
158 }
159 
162 /* -------------------------------------------------------------------- */
167 {
168  Main *bmain = CTX_data_main(C);
169  Object *ob = ED_object_context(C);
170 
171  if (!ob) {
172  return OPERATOR_CANCELLED;
173  }
174 
175  BKE_object_material_slot_add(bmain, ob);
176 
177  if (ob->mode & OB_MODE_TEXTURE_PAINT) {
179  ED_paint_proj_mesh_data_check(scene, ob, nullptr, nullptr, nullptr, nullptr);
181  }
182 
186 
187  return OPERATOR_FINISHED;
188 }
189 
191 {
192  /* identifiers */
193  ot->name = "Add Material Slot";
194  ot->idname = "OBJECT_OT_material_slot_add";
195  ot->description = "Add a new material slot";
196 
197  /* api callbacks */
200 
201  /* flags */
203 }
204 
207 /* -------------------------------------------------------------------- */
212 {
213  Object *ob = ED_object_context(C);
214 
215  if (!ob) {
216  return OPERATOR_CANCELLED;
217  }
218 
219  /* Removing material slots in edit mode screws things up, see bug T21822. */
220  if (ob == CTX_data_edit_object(C)) {
221  BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode");
222  return OPERATOR_CANCELLED;
223  }
224 
226 
227  if (ob->mode & OB_MODE_TEXTURE_PAINT) {
229  ED_paint_proj_mesh_data_check(scene, ob, nullptr, nullptr, nullptr, nullptr);
231  }
232 
237 
238  return OPERATOR_FINISHED;
239 }
240 
242 {
243  /* identifiers */
244  ot->name = "Remove Material Slot";
245  ot->idname = "OBJECT_OT_material_slot_remove";
246  ot->description = "Remove the selected material slot";
247 
248  /* api callbacks */
251 
252  /* flags */
254 }
255 
258 /* -------------------------------------------------------------------- */
263 {
264  View3D *v3d = CTX_wm_view3d(C);
265  bool changed_multi = false;
266 
267  Object *obact = CTX_data_active_object(C);
268  const Material *mat_active = obact ? BKE_object_material_get(obact, obact->actcol) : nullptr;
269 
270  uint objects_len = 0;
271  Object **objects = object_array_for_shading_edit_mode_enabled(C, &objects_len);
272  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
273  Object *ob = objects[ob_index];
274  short mat_nr_active = -1;
275 
276  if (ob->totcol == 0) {
277  continue;
278  }
279  if (obact && (mat_active == BKE_object_material_get(ob, obact->actcol))) {
280  /* Avoid searching since there may be multiple slots with the same material.
281  * For the active object or duplicates: match the material slot index first. */
282  mat_nr_active = obact->actcol - 1;
283  }
284  else {
285  /* Find the first matching material.
286  * NOTE: there may be multiple but that's not a common use case. */
287  for (int i = 0; i < ob->totcol; i++) {
288  const Material *mat = BKE_object_material_get(ob, i + 1);
289  if (mat_active == mat) {
290  mat_nr_active = i;
291  break;
292  }
293  }
294  if (mat_nr_active == -1) {
295  continue;
296  }
297  }
298 
299  bool changed = false;
300  if (ob->type == OB_MESH) {
302  BMFace *efa;
303  BMIter iter;
304 
305  if (em) {
306  BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
307  if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
308  changed = true;
309  efa->mat_nr = mat_nr_active;
310  }
311  }
312  }
313  }
314  else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
315  Nurb *nu;
316  ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
317 
318  if (nurbs) {
319  for (nu = static_cast<Nurb *>(nurbs->first); nu; nu = nu->next) {
320  if (ED_curve_nurb_select_check(v3d, nu)) {
321  changed = true;
322  nu->mat_nr = mat_nr_active;
323  }
324  }
325  }
326  }
327  else if (ob->type == OB_FONT) {
328  EditFont *ef = ((Curve *)ob->data)->editfont;
329  int i, selstart, selend;
330 
331  if (ef && BKE_vfont_select_get(ob, &selstart, &selend)) {
332  for (i = selstart; i <= selend; i++) {
333  changed = true;
334  ef->textbufinfo[i].mat_nr = mat_nr_active + 1;
335  }
336  }
337  }
338 
339  if (changed) {
340  changed_multi = true;
343  }
344  }
345  MEM_freeN(objects);
346 
347  return (changed_multi) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
348 }
349 
351 {
352  /* identifiers */
353  ot->name = "Assign Material Slot";
354  ot->idname = "OBJECT_OT_material_slot_assign";
355  ot->description = "Assign active material slot to selection";
356 
357  /* api callbacks */
360 
361  /* flags */
363 }
364 
367 /* -------------------------------------------------------------------- */
372 {
373  bool changed_multi = false;
374  Object *obact = CTX_data_active_object(C);
375  const Material *mat_active = obact ? BKE_object_material_get(obact, obact->actcol) : nullptr;
376 
377  uint objects_len = 0;
378  Object **objects = object_array_for_shading_edit_mode_enabled(C, &objects_len);
379  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
380  Object *ob = objects[ob_index];
381  short mat_nr_active = -1;
382 
383  if (ob->totcol == 0) {
384  continue;
385  }
386  if (obact && (mat_active == BKE_object_material_get(ob, obact->actcol))) {
387  /* Avoid searching since there may be multiple slots with the same material.
388  * For the active object or duplicates: match the material slot index first. */
389  mat_nr_active = obact->actcol - 1;
390  }
391  else {
392  /* Find the first matching material.
393  * NOTE: there may be multiple but that's not a common use case. */
394  for (int i = 0; i < ob->totcol; i++) {
395  const Material *mat = BKE_object_material_get(ob, i + 1);
396  if (mat_active == mat) {
397  mat_nr_active = i;
398  break;
399  }
400  }
401  if (mat_nr_active == -1) {
402  continue;
403  }
404  }
405 
406  bool changed = false;
407 
408  if (ob->type == OB_MESH) {
410 
411  if (em) {
412  changed = EDBM_deselect_by_material(em, mat_nr_active, select);
413  }
414  }
415  else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
416  ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
417  Nurb *nu;
418  BPoint *bp;
419  BezTriple *bezt;
420  int a;
421 
422  if (nurbs) {
423  for (nu = static_cast<Nurb *>(nurbs->first); nu; nu = nu->next) {
424  if (nu->mat_nr == mat_nr_active) {
425  if (nu->bezt) {
426  a = nu->pntsu;
427  bezt = nu->bezt;
428  while (a--) {
429  if (bezt->hide == 0) {
430  changed = true;
431  if (select) {
432  bezt->f1 |= SELECT;
433  bezt->f2 |= SELECT;
434  bezt->f3 |= SELECT;
435  }
436  else {
437  bezt->f1 &= ~SELECT;
438  bezt->f2 &= ~SELECT;
439  bezt->f3 &= ~SELECT;
440  }
441  }
442  bezt++;
443  }
444  }
445  else if (nu->bp) {
446  a = nu->pntsu * nu->pntsv;
447  bp = nu->bp;
448  while (a--) {
449  if (bp->hide == 0) {
450  changed = true;
451  if (select) {
452  bp->f1 |= SELECT;
453  }
454  else {
455  bp->f1 &= ~SELECT;
456  }
457  }
458  bp++;
459  }
460  }
461  }
462  }
463  }
464  }
465 
466  if (changed) {
467  changed_multi = true;
468  DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_SELECT);
470  }
471  }
472 
473  MEM_freeN(objects);
474 
475  return (changed_multi) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
476 }
477 
479 {
480  return material_slot_de_select(C, true);
481 }
482 
484 {
485  /* identifiers */
486  ot->name = "Select Material Slot";
487  ot->idname = "OBJECT_OT_material_slot_select";
488  ot->description = "Select by active material slot";
489 
490  /* api callbacks */
492 
493  /* flags */
495 }
496 
498 {
499  return material_slot_de_select(C, false);
500 }
501 
503 {
504  /* identifiers */
505  ot->name = "Deselect Material Slot";
506  ot->idname = "OBJECT_OT_material_slot_deselect";
507  ot->description = "Deselect by active material slot";
508 
509  /* api callbacks */
511 
512  /* flags */
514 }
515 
518 /* -------------------------------------------------------------------- */
523 {
524  Main *bmain = CTX_data_main(C);
525  Object *ob = ED_object_context(C);
526  Material ***matar_obdata;
527 
528  if (!ob || !(matar_obdata = BKE_object_material_array_p(ob))) {
529  return OPERATOR_CANCELLED;
530  }
531 
533 
534  Material ***matar_object = &ob->mat;
535 
536  Material **matar = static_cast<Material **>(
537  MEM_callocN(sizeof(*matar) * (size_t)ob->totcol, __func__));
538  for (int i = ob->totcol; i--;) {
539  matar[i] = ob->matbits[i] ? (*matar_object)[i] : (*matar_obdata)[i];
540  }
541 
542  CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
543  if (ob != ob_iter && BKE_object_material_array_p(ob_iter)) {
544  /* If we are using the same obdata, we only assign slots in ob_iter that are using object
545  * materials, and not obdata ones. */
546  const bool is_same_obdata = ob->data == ob_iter->data;
547  BKE_object_material_array_assign(bmain, ob_iter, &matar, ob->totcol, is_same_obdata);
548 
549  if (ob_iter->totcol == ob->totcol) {
550  ob_iter->actcol = ob->actcol;
551  DEG_id_tag_update(&ob_iter->id, ID_RECALC_GEOMETRY);
553  }
554  }
555  }
556  CTX_DATA_END;
557 
558  MEM_freeN(matar);
559 
560  return OPERATOR_FINISHED;
561 }
562 
564 {
565  /* identifiers */
566  ot->name = "Copy Material to Selected";
567  ot->idname = "OBJECT_OT_material_slot_copy";
568  ot->description = "Copy material to selected objects";
569 
570  /* api callbacks */
572 
573  /* flags */
575 }
576 
579 /* -------------------------------------------------------------------- */
584 {
585  Object *ob = ED_object_context(C);
586 
587  uint *slot_remap;
588  int index_pair[2];
589 
590  int dir = RNA_enum_get(op->ptr, "direction");
591 
592  if (!ob || ob->totcol < 2) {
593  return OPERATOR_CANCELLED;
594  }
595 
596  /* up */
597  if (dir == 1 && ob->actcol > 1) {
598  index_pair[0] = ob->actcol - 2;
599  index_pair[1] = ob->actcol - 1;
600  ob->actcol--;
601  }
602  /* down */
603  else if (dir == -1 && ob->actcol < ob->totcol) {
604  index_pair[0] = ob->actcol - 1;
605  index_pair[1] = ob->actcol - 0;
606  ob->actcol++;
607  }
608  else {
609  return OPERATOR_CANCELLED;
610  }
611 
612  slot_remap = static_cast<uint *>(MEM_mallocN(sizeof(uint) * ob->totcol, __func__));
613 
614  range_vn_u(slot_remap, ob->totcol, 0);
615 
616  slot_remap[index_pair[0]] = index_pair[1];
617  slot_remap[index_pair[1]] = index_pair[0];
618 
619  BKE_object_material_remap(ob, slot_remap);
620 
621  MEM_freeN(slot_remap);
622 
626 
627  return OPERATOR_FINISHED;
628 }
629 
631 {
632  static const EnumPropertyItem material_slot_move[] = {
633  {1, "UP", 0, "Up", ""},
634  {-1, "DOWN", 0, "Down", ""},
635  {0, nullptr, 0, nullptr, nullptr},
636  };
637 
638  /* identifiers */
639  ot->name = "Move Material";
640  ot->idname = "OBJECT_OT_material_slot_move";
641  ot->description = "Move the active material up/down in the list";
642 
643  /* api callbacks */
646 
647  /* flags */
649 
651  "direction",
652  material_slot_move,
653  0,
654  "Direction",
655  "Direction to move the active material towards");
656 }
657 
660 /* -------------------------------------------------------------------- */
665 {
666  /* Removing material slots in edit mode screws things up, see bug T21822. */
667  Object *ob_active = CTX_data_active_object(C);
668  if (ob_active && BKE_object_is_in_editmode(ob_active)) {
669  BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode");
670  return OPERATOR_CANCELLED;
671  }
672 
673  Main *bmain = CTX_data_main(C);
674  int removed = 0;
675 
676  uint objects_len = 0;
677  Object **objects = object_array_for_shading_edit_mode_disabled(C, &objects_len);
678  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
679  Object *ob = objects[ob_index];
680  int actcol = ob->actcol;
681  for (int slot = 1; slot <= ob->totcol; slot++) {
682  while (slot <= ob->totcol && !BKE_object_material_slot_used(ob, slot)) {
683  ob->actcol = slot;
685 
686  if (actcol >= slot) {
687  actcol--;
688  }
689 
690  removed++;
691  }
692  }
693  ob->actcol = actcol;
694 
696  }
697  MEM_freeN(objects);
698 
699  if (!removed) {
700  return OPERATOR_CANCELLED;
701  }
702 
703  BKE_reportf(op->reports, RPT_INFO, "Removed %d slots", removed);
704 
705  if (ob_active->mode & OB_MODE_TEXTURE_PAINT) {
707  ED_paint_proj_mesh_data_check(scene, ob_active, nullptr, nullptr, nullptr, nullptr);
709  }
710 
711  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_active);
714 
715  return OPERATOR_FINISHED;
716 }
717 
719 {
720  /* identifiers */
721  ot->name = "Remove Unused Slots";
722  ot->idname = "OBJECT_OT_material_slot_remove_unused";
723  ot->description = "Remove unused material slots";
724 
725  /* api callbacks */
728 
729  /* flags */
731 }
732 
735 /* -------------------------------------------------------------------- */
740 {
741  Material *ma = static_cast<Material *>(
742  CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
743  Main *bmain = CTX_data_main(C);
744  PointerRNA ptr, idptr;
745  PropertyRNA *prop;
746 
747  /* hook into UI */
749 
750  Object *ob = static_cast<Object *>((prop && RNA_struct_is_a(ptr.type, &RNA_Object)) ? ptr.data :
751  nullptr);
752 
753  /* add or copy material */
754  if (ma) {
755  Material *new_ma = (Material *)BKE_id_copy_ex(
756  bmain, &ma->id, nullptr, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
757  ma = new_ma;
758  }
759  else {
760  const char *name = DATA_("Material");
761  if (!(ob != nullptr && ob->type == OB_GPENCIL)) {
762  ma = BKE_material_add(bmain, name);
763  }
764  else {
765  ma = BKE_gpencil_material_add(bmain, name);
766  }
767  ED_node_shader_default(C, &ma->id);
768  ma->use_nodes = true;
769  }
770 
771  if (prop) {
772  if (ob != nullptr) {
773  /* Add slot follows user-preferences for creating new slots,
774  * RNA pointer assignment doesn't, see: T60014. */
775  if (BKE_object_material_get_p(ob, ob->actcol) == nullptr) {
776  BKE_object_material_slot_add(bmain, ob);
777  }
778  }
779 
780  /* when creating new ID blocks, use is already 1, but RNA
781  * pointer use also increases user, so this compensates it */
782  id_us_min(&ma->id);
783 
784  RNA_id_pointer_create(&ma->id, &idptr);
785  RNA_property_pointer_set(&ptr, prop, idptr, nullptr);
786  RNA_property_update(C, &ptr, prop);
787  }
788 
790 
791  return OPERATOR_FINISHED;
792 }
793 
795 {
796  /* identifiers */
797  ot->name = "New Material";
798  ot->idname = "MATERIAL_OT_new";
799  ot->description = "Add a new material";
800 
801  /* api callbacks */
804 
805  /* flags */
807 }
808 
811 /* -------------------------------------------------------------------- */
816 {
817  Tex *tex = static_cast<Tex *>(CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data);
818  Main *bmain = CTX_data_main(C);
819  PointerRNA ptr, idptr;
820  PropertyRNA *prop;
821 
822  /* add or copy texture */
823  if (tex) {
824  tex = (Tex *)BKE_id_copy(bmain, &tex->id);
825  }
826  else {
827  tex = BKE_texture_add(bmain, DATA_("Texture"));
828  }
829 
830  /* hook into UI */
832 
833  if (prop) {
834  /* when creating new ID blocks, use is already 1, but RNA
835  * pointer use also increases user, so this compensates it */
836  id_us_min(&tex->id);
837 
838  RNA_id_pointer_create(&tex->id, &idptr);
839  RNA_property_pointer_set(&ptr, prop, idptr, nullptr);
840  RNA_property_update(C, &ptr, prop);
841  }
842 
844 
845  return OPERATOR_FINISHED;
846 }
847 
849 {
850  /* identifiers */
851  ot->name = "New Texture";
852  ot->idname = "TEXTURE_OT_new";
853  ot->description = "Add a new texture";
854 
855  /* api callbacks */
857 
858  /* flags */
860 }
861 
864 /* -------------------------------------------------------------------- */
869 {
870  World *wo = static_cast<World *>(CTX_data_pointer_get_type(C, "world", &RNA_World).data);
871  Main *bmain = CTX_data_main(C);
872  PointerRNA ptr, idptr;
873  PropertyRNA *prop;
874 
875  /* add or copy world */
876  if (wo) {
877  World *new_wo = (World *)BKE_id_copy_ex(
878  bmain, &wo->id, nullptr, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
879  wo = new_wo;
880  }
881  else {
882  wo = BKE_world_add(bmain, DATA_("World"));
883  ED_node_shader_default(C, &wo->id);
884  wo->use_nodes = true;
885  }
886 
887  /* hook into UI */
889 
890  if (prop) {
891  /* when creating new ID blocks, use is already 1, but RNA
892  * pointer use also increases user, so this compensates it */
893  id_us_min(&wo->id);
894 
895  RNA_id_pointer_create(&wo->id, &idptr);
896  RNA_property_pointer_set(&ptr, prop, idptr, nullptr);
897  RNA_property_update(C, &ptr, prop);
898  }
899 
901 
902  return OPERATOR_FINISHED;
903 }
904 
906 {
907  /* identifiers */
908  ot->name = "New World";
909  ot->idname = "WORLD_OT_new";
910  ot->description = "Create a new world Data-Block";
911 
912  /* api callbacks */
914 
915  /* flags */
917 }
918 
921 /* -------------------------------------------------------------------- */
926 {
927  wmWindow *win = CTX_wm_window(C);
929  ViewLayer *view_layer_current = WM_window_get_active_view_layer(win);
930  ViewLayer *view_layer_new = BKE_view_layer_add(
931  scene, view_layer_current->name, view_layer_current, RNA_enum_get(op->ptr, "type"));
932 
933  if (win) {
934  WM_window_set_active_view_layer(win, view_layer_new);
935  }
936 
937  DEG_id_tag_update(&scene->id, 0);
940 
941  return OPERATOR_FINISHED;
942 }
943 
945 {
946  static EnumPropertyItem type_items[] = {
947  {VIEWLAYER_ADD_NEW, "NEW", 0, "New", "Add a new view layer"},
948  {VIEWLAYER_ADD_COPY, "COPY", 0, "Copy Settings", "Copy settings of current view layer"},
950  "EMPTY",
951  0,
952  "Blank",
953  "Add a new view layer with all collections disabled"},
954  {0, nullptr, 0, nullptr, nullptr},
955  };
956 
957  /* identifiers */
958  ot->name = "Add View Layer";
959  ot->idname = "SCENE_OT_view_layer_add";
960  ot->description = "Add a view layer";
961 
962  /* api callbacks */
965 
966  /* flags */
968 
969  /* properties */
970  ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
971 }
972 
975 /* -------------------------------------------------------------------- */
980 {
983 }
984 
986 {
987  Main *bmain = CTX_data_main(C);
989  ViewLayer *view_layer = CTX_data_view_layer(C);
990 
991  if (!ED_scene_view_layer_delete(bmain, scene, view_layer, nullptr)) {
992  return OPERATOR_CANCELLED;
993  }
994 
996 
997  return OPERATOR_FINISHED;
998 }
999 
1001 {
1002  /* identifiers */
1003  ot->name = "Remove View Layer";
1004  ot->idname = "SCENE_OT_view_layer_remove";
1005  ot->description = "Remove the selected view layer";
1006 
1007  /* api callbacks */
1010 
1011  /* flags */
1013 }
1014 
1017 /* -------------------------------------------------------------------- */
1022 {
1024  ViewLayer *view_layer = CTX_data_view_layer(C);
1025 
1026  BKE_view_layer_add_aov(view_layer);
1027 
1028  RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
1029  if (engine_type->update_render_passes) {
1030  RenderEngine *engine = RE_engine_create(engine_type);
1031  if (engine) {
1032  BKE_view_layer_verify_aov(engine, scene, view_layer);
1033  }
1034  RE_engine_free(engine);
1035  engine = nullptr;
1036  }
1037 
1038  if (scene->nodetree) {
1040  }
1041 
1042  DEG_id_tag_update(&scene->id, 0);
1045 
1046  return OPERATOR_FINISHED;
1047 }
1048 
1050 {
1051  /* identifiers */
1052  ot->name = "Add AOV";
1053  ot->idname = "SCENE_OT_view_layer_add_aov";
1054  ot->description = "Add a Shader AOV";
1055 
1056  /* api callbacks */
1058 
1059  /* flags */
1061 }
1062 
1065 /* -------------------------------------------------------------------- */
1070 {
1072  ViewLayer *view_layer = CTX_data_view_layer(C);
1073 
1074  if (view_layer->active_aov == nullptr) {
1075  return OPERATOR_FINISHED;
1076  }
1077 
1078  BKE_view_layer_remove_aov(view_layer, view_layer->active_aov);
1079 
1080  RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
1081  if (engine_type->update_render_passes) {
1082  RenderEngine *engine = RE_engine_create(engine_type);
1083  if (engine) {
1084  BKE_view_layer_verify_aov(engine, scene, view_layer);
1085  }
1086  RE_engine_free(engine);
1087  engine = nullptr;
1088  }
1089 
1090  if (scene->nodetree) {
1092  }
1093 
1094  DEG_id_tag_update(&scene->id, 0);
1097 
1098  return OPERATOR_FINISHED;
1099 }
1100 
1102 {
1103  /* identifiers */
1104  ot->name = "Remove AOV";
1105  ot->idname = "SCENE_OT_view_layer_remove_aov";
1106  ot->description = "Remove Active AOV";
1107 
1108  /* api callbacks */
1110 
1111  /* flags */
1113 }
1114 
1117 /* -------------------------------------------------------------------- */
1122 {
1124  ViewLayer *view_layer = CTX_data_view_layer(C);
1125 
1126  char name[MAX_NAME];
1127  name[0] = '\0';
1128  /* If a name is provided, ensure that it is unique. */
1129  if (RNA_struct_property_is_set(op->ptr, "name")) {
1130  RNA_string_get(op->ptr, "name", name);
1131  /* Ensure that there are no dots in the name. */
1132  BLI_str_replace_char(name, '.', '_');
1133  LISTBASE_FOREACH (ViewLayerLightgroup *, lightgroup, &view_layer->lightgroups) {
1134  if (strcmp(lightgroup->name, name) == 0) {
1135  return OPERATOR_CANCELLED;
1136  }
1137  }
1138  }
1139 
1140  BKE_view_layer_add_lightgroup(view_layer, name);
1141 
1142  if (scene->nodetree) {
1144  }
1145 
1146  DEG_id_tag_update(&scene->id, 0);
1149 
1150  return OPERATOR_FINISHED;
1151 }
1152 
1154 {
1155  /* identifiers */
1156  ot->name = "Add Lightgroup";
1157  ot->idname = "SCENE_OT_view_layer_add_lightgroup";
1158  ot->description = "Add a Light Group";
1159 
1160  /* api callbacks */
1162 
1163  /* flags */
1165 
1166  /* properties */
1168  "name",
1169  nullptr,
1170  sizeof(((ViewLayerLightgroup *)nullptr)->name),
1171  "Name",
1172  "Name of newly created lightgroup");
1173 }
1174 
1177 /* -------------------------------------------------------------------- */
1182 {
1184  ViewLayer *view_layer = CTX_data_view_layer(C);
1185 
1186  if (view_layer->active_lightgroup == nullptr) {
1187  return OPERATOR_FINISHED;
1188  }
1189 
1190  BKE_view_layer_remove_lightgroup(view_layer, view_layer->active_lightgroup);
1191 
1192  if (scene->nodetree) {
1194  }
1195 
1196  DEG_id_tag_update(&scene->id, 0);
1199 
1200  return OPERATOR_FINISHED;
1201 }
1202 
1204 {
1205  /* identifiers */
1206  ot->name = "Remove Lightgroup";
1207  ot->idname = "SCENE_OT_view_layer_remove_lightgroup";
1208  ot->description = "Remove Active Lightgroup";
1209 
1210  /* api callbacks */
1212 
1213  /* flags */
1215 }
1216 
1219 /* -------------------------------------------------------------------- */
1224 {
1225  GSet *used_lightgroups = BLI_gset_str_new(__func__);
1226 
1228  if (ob->lightgroup && ob->lightgroup->name[0]) {
1229  BLI_gset_add(used_lightgroups, ob->lightgroup->name);
1230  }
1231  }
1233 
1234  if (scene->world && scene->world->lightgroup && scene->world->lightgroup->name[0]) {
1235  BLI_gset_add(used_lightgroups, scene->world->lightgroup->name);
1236  }
1237 
1238  return used_lightgroups;
1239 }
1240 
1242 {
1244  ViewLayer *view_layer = CTX_data_view_layer(C);
1245 
1246  GSet *used_lightgroups = get_used_lightgroups(scene);
1247  GSET_FOREACH_BEGIN (const char *, used_lightgroup, used_lightgroups) {
1248  if (!BLI_findstring(
1249  &view_layer->lightgroups, used_lightgroup, offsetof(ViewLayerLightgroup, name))) {
1250  BKE_view_layer_add_lightgroup(view_layer, used_lightgroup);
1251  }
1252  }
1253  GSET_FOREACH_END();
1254  BLI_gset_free(used_lightgroups, nullptr);
1255 
1256  if (scene->nodetree) {
1258  }
1259 
1260  DEG_id_tag_update(&scene->id, 0);
1263 
1264  return OPERATOR_FINISHED;
1265 }
1266 
1268 {
1269  /* identifiers */
1270  ot->name = "Add Used Lightgroups";
1271  ot->idname = "SCENE_OT_view_layer_add_used_lightgroups";
1272  ot->description = "Add all used Light Groups";
1273 
1274  /* api callbacks */
1276 
1277  /* flags */
1279 }
1280 
1283 /* -------------------------------------------------------------------- */
1288 {
1290  ViewLayer *view_layer = CTX_data_view_layer(C);
1291 
1292  GSet *used_lightgroups = get_used_lightgroups(scene);
1293  LISTBASE_FOREACH_MUTABLE (ViewLayerLightgroup *, lightgroup, &view_layer->lightgroups) {
1294  if (!BLI_gset_haskey(used_lightgroups, lightgroup->name)) {
1295  BKE_view_layer_remove_lightgroup(view_layer, lightgroup);
1296  }
1297  }
1298  BLI_gset_free(used_lightgroups, nullptr);
1299 
1300  if (scene->nodetree) {
1302  }
1303 
1304  DEG_id_tag_update(&scene->id, 0);
1307 
1308  return OPERATOR_FINISHED;
1309 }
1310 
1312 {
1313  /* identifiers */
1314  ot->name = "Remove Unused Lightgroups";
1315  ot->idname = "SCENE_OT_view_layer_remove_unused_lightgroups";
1316  ot->description = "Remove all unused Light Groups";
1317 
1318  /* api callbacks */
1320 
1321  /* flags */
1323 }
1324 
1327 /* -------------------------------------------------------------------- */
1331 enum {
1335 };
1336 
1338 {
1339  if (scene->eevee.light_cache_data != nullptr) {
1340  int subset = RNA_enum_get(op->ptr, "subset");
1341  switch (subset) {
1342  case LIGHTCACHE_SUBSET_ALL:
1344  break;
1347  break;
1349  /* Leave tag untouched. */
1350  break;
1351  }
1352  }
1353 }
1354 
1356 static int light_cache_bake_modal(bContext *C, wmOperator *op, const wmEvent *event)
1357 {
1358  Scene *scene = (Scene *)op->customdata;
1359 
1360  /* no running blender, remove handler and pass through */
1363  if (lcache && (lcache->flag & LIGHTCACHE_INVALID)) {
1364  BKE_report(op->reports, RPT_ERROR, "Lightcache cannot allocate resources");
1365  return OPERATOR_CANCELLED;
1366  }
1368  }
1369 
1370  /* running render */
1371  switch (event->type) {
1372  case EVT_ESCKEY:
1373  return OPERATOR_RUNNING_MODAL;
1374  }
1375  return OPERATOR_PASS_THROUGH;
1376 }
1377 
1379 {
1381  Scene *scene = (Scene *)op->customdata;
1382 
1383  /* kill on cancel, because job is using op->reports */
1385 }
1386 
1387 /* executes blocking render */
1389 {
1390  ViewLayer *view_layer = CTX_data_view_layer(C);
1391  Main *bmain = CTX_data_main(C);
1393 
1394  G.is_break = false;
1395 
1396  /* TODO: abort if selected engine is not eevee. */
1397  void *rj = EEVEE_lightbake_job_data_alloc(bmain, view_layer, scene, false, scene->r.cfra);
1398 
1400 
1401  short stop = 0, do_update;
1402  float progress; /* Not actually used. */
1403  EEVEE_lightbake_job(rj, &stop, &do_update, &progress);
1405 
1406  /* No redraw needed, we leave state as we entered it. */
1408 
1410 
1411  return OPERATOR_FINISHED;
1412 }
1413 
1414 static int light_cache_bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
1415 {
1417  wmWindow *win = CTX_wm_window(C);
1418  ViewLayer *view_layer = CTX_data_view_layer(C);
1419  Main *bmain = CTX_data_main(C);
1421  int delay = RNA_int_get(op->ptr, "delay");
1422 
1424  wm, win, bmain, view_layer, scene, delay, scene->r.cfra);
1425 
1426  if (!wm_job) {
1427  return OPERATOR_CANCELLED;
1428  }
1429 
1430  /* add modal handler for ESC */
1432 
1434 
1435  /* store actual owner of job, so modal operator could check for it,
1436  * the reason of this is that active scene could change when rendering
1437  * several layers from compositor T31800. */
1438  op->customdata = scene;
1439 
1440  WM_jobs_start(wm, wm_job);
1441 
1442  WM_cursor_wait(false);
1443 
1444  return OPERATOR_RUNNING_MODAL;
1445 }
1446 
1448 {
1449  static const EnumPropertyItem light_cache_subset_items[] = {
1451  "ALL",
1452  0,
1453  "All Light Probes",
1454  "Bake both irradiance grids and reflection cubemaps"},
1456  "DIRTY",
1457  0,
1458  "Dirty Only",
1459  "Only bake light probes that are marked as dirty"},
1461  "CUBEMAPS",
1462  0,
1463  "Cubemaps Only",
1464  "Try to only bake reflection cubemaps if irradiance grids are up to date"},
1465  {0, nullptr, 0, nullptr, nullptr},
1466  };
1467 
1468  /* identifiers */
1469  ot->name = "Bake Light Cache";
1470  ot->idname = "SCENE_OT_light_cache_bake";
1471  ot->description = "Bake the active view layer lighting";
1472 
1473  /* api callbacks */
1478 
1479  ot->prop = RNA_def_int(ot->srna,
1480  "delay",
1481  0,
1482  0,
1483  2000,
1484  "Delay",
1485  "Delay in millisecond before baking starts",
1486  0,
1487  2000);
1489 
1490  ot->prop = RNA_def_enum(
1491  ot->srna, "subset", light_cache_subset_items, 0, "Subset", "Subset of probes to update");
1493 }
1494 
1497 /* -------------------------------------------------------------------- */
1502 {
1504 
1505  return scene->eevee.light_cache_data;
1506 }
1507 
1509 {
1511 
1512  /* kill potential bake job first (see T57011) */
1515 
1516  if (!scene->eevee.light_cache_data) {
1517  return OPERATOR_CANCELLED;
1518  }
1519 
1521  scene->eevee.light_cache_data = nullptr;
1522 
1524 
1526 
1528 
1529  return OPERATOR_FINISHED;
1530 }
1531 
1533 {
1534  /* identifiers */
1535  ot->name = "Delete Light Cache";
1536  ot->idname = "SCENE_OT_light_cache_free";
1537  ot->description = "Delete cached indirect lighting";
1538 
1539  /* api callbacks */
1542 }
1543 
1546 /* -------------------------------------------------------------------- */
1551 {
1553 
1554  /* don't allow user to remove "left" and "right" views */
1555  return scene->r.actview > 1;
1556 }
1557 
1559 {
1561 
1562  BKE_scene_add_render_view(scene, nullptr);
1564 
1566 
1567  return OPERATOR_FINISHED;
1568 }
1569 
1571 {
1572  /* identifiers */
1573  ot->name = "Add Render View";
1574  ot->idname = "SCENE_OT_render_view_add";
1575  ot->description = "Add a render view";
1576 
1577  /* api callbacks */
1579 
1580  /* flags */
1582 }
1583 
1586 /* -------------------------------------------------------------------- */
1591 {
1593  SceneRenderView *rv = static_cast<SceneRenderView *>(
1595 
1596  if (!BKE_scene_remove_render_view(scene, rv)) {
1597  return OPERATOR_CANCELLED;
1598  }
1599 
1601 
1602  return OPERATOR_FINISHED;
1603 }
1604 
1606 {
1607  /* identifiers */
1608  ot->name = "Remove Render View";
1609  ot->idname = "SCENE_OT_render_view_remove";
1610  ot->description = "Remove the selected render view";
1611 
1612  /* api callbacks */
1615 
1616  /* flags */
1618 }
1619 
1622 #ifdef WITH_FREESTYLE
1623 
1624 /* -------------------------------------------------------------------- */
1628 static bool freestyle_linestyle_check_report(FreestyleLineSet *lineset, ReportList *reports)
1629 {
1630  if (!lineset) {
1631  BKE_report(reports,
1632  RPT_ERROR,
1633  "No active lineset and associated line style to manipulate the modifier");
1634  return false;
1635  }
1636  if (!lineset->linestyle) {
1637  BKE_report(reports,
1638  RPT_ERROR,
1639  "The active lineset does not have a line style (indicating data corruption)");
1640  return false;
1641  }
1642 
1643  return true;
1644 }
1645 
1646 static bool freestyle_active_module_poll(bContext *C)
1647 {
1648  PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
1650 
1651  return module != nullptr;
1652 }
1653 
1654 static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op))
1655 {
1657  ViewLayer *view_layer = CTX_data_view_layer(C);
1658 
1660 
1662 
1663  return OPERATOR_FINISHED;
1664 }
1665 
1666 void SCENE_OT_freestyle_module_add(wmOperatorType *ot)
1667 {
1668  /* identifiers */
1669  ot->name = "Add Freestyle Module";
1670  ot->idname = "SCENE_OT_freestyle_module_add";
1671  ot->description = "Add a style module into the list of modules";
1672 
1673  /* api callbacks */
1674  ot->exec = freestyle_module_add_exec;
1675 
1676  /* flags */
1678 }
1679 
1682 /* -------------------------------------------------------------------- */
1686 static int freestyle_module_remove_exec(bContext *C, wmOperator *UNUSED(op))
1687 {
1689  ViewLayer *view_layer = CTX_data_view_layer(C);
1690  PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
1692 
1694 
1695  DEG_id_tag_update(&scene->id, 0);
1697 
1698  return OPERATOR_FINISHED;
1699 }
1700 
1701 void SCENE_OT_freestyle_module_remove(wmOperatorType *ot)
1702 {
1703  /* identifiers */
1704  ot->name = "Remove Freestyle Module";
1705  ot->idname = "SCENE_OT_freestyle_module_remove";
1706  ot->description = "Remove the style module from the stack";
1707 
1708  /* api callbacks */
1709  ot->poll = freestyle_active_module_poll;
1710  ot->exec = freestyle_module_remove_exec;
1711 
1712  /* flags */
1714 }
1715 
1716 static int freestyle_module_move_exec(bContext *C, wmOperator *op)
1717 {
1719  ViewLayer *view_layer = CTX_data_view_layer(C);
1720  PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
1722  int dir = RNA_enum_get(op->ptr, "direction");
1723 
1724  if (BKE_freestyle_module_move(&view_layer->freestyle_config, module, dir)) {
1725  DEG_id_tag_update(&scene->id, 0);
1727  }
1728 
1729  return OPERATOR_FINISHED;
1730 }
1731 
1734 /* -------------------------------------------------------------------- */
1738 void SCENE_OT_freestyle_module_move(wmOperatorType *ot)
1739 {
1740  static const EnumPropertyItem direction_items[] = {
1741  {-1, "UP", 0, "Up", ""},
1742  {1, "DOWN", 0, "Down", ""},
1743  {0, nullptr, 0, nullptr, nullptr},
1744  };
1745 
1746  /* identifiers */
1747  ot->name = "Move Freestyle Module";
1748  ot->idname = "SCENE_OT_freestyle_module_move";
1749  ot->description = "Change the position of the style module within in the list of style modules";
1750 
1751  /* api callbacks */
1752  ot->poll = freestyle_active_module_poll;
1753  ot->exec = freestyle_module_move_exec;
1754 
1755  /* flags */
1757 
1758  /* props */
1759  RNA_def_enum(ot->srna,
1760  "direction",
1761  direction_items,
1762  0,
1763  "Direction",
1764  "Direction to move the chosen style module towards");
1765 }
1766 
1769 /* -------------------------------------------------------------------- */
1773 static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op))
1774 {
1775  Main *bmain = CTX_data_main(C);
1777  ViewLayer *view_layer = CTX_data_view_layer(C);
1778 
1779  BKE_freestyle_lineset_add(bmain, &view_layer->freestyle_config, nullptr);
1780 
1781  DEG_id_tag_update(&scene->id, 0);
1783 
1784  return OPERATOR_FINISHED;
1785 }
1786 
1787 void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot)
1788 {
1789  /* identifiers */
1790  ot->name = "Add Line Set";
1791  ot->idname = "SCENE_OT_freestyle_lineset_add";
1792  ot->description = "Add a line set into the list of line sets";
1793 
1794  /* api callbacks */
1795  ot->exec = freestyle_lineset_add_exec;
1796 
1797  /* flags */
1799 }
1800 
1803 /* -------------------------------------------------------------------- */
1807 static bool freestyle_active_lineset_poll(bContext *C)
1808 {
1809  ViewLayer *view_layer = CTX_data_view_layer(C);
1810 
1811  if (!view_layer) {
1812  return false;
1813  }
1814 
1815  return BKE_freestyle_lineset_get_active(&view_layer->freestyle_config) != nullptr;
1816 }
1817 
1818 static int freestyle_lineset_copy_exec(bContext *C, wmOperator *UNUSED(op))
1819 {
1820  ViewLayer *view_layer = CTX_data_view_layer(C);
1821 
1823 
1824  return OPERATOR_FINISHED;
1825 }
1826 
1827 void SCENE_OT_freestyle_lineset_copy(wmOperatorType *ot)
1828 {
1829  /* identifiers */
1830  ot->name = "Copy Line Set";
1831  ot->idname = "SCENE_OT_freestyle_lineset_copy";
1832  ot->description = "Copy the active line set to a buffer";
1833 
1834  /* api callbacks */
1835  ot->exec = freestyle_lineset_copy_exec;
1836  ot->poll = freestyle_active_lineset_poll;
1837 
1838  /* flags */
1840 }
1841 
1844 /* -------------------------------------------------------------------- */
1848 static int freestyle_lineset_paste_exec(bContext *C, wmOperator *UNUSED(op))
1849 {
1851  ViewLayer *view_layer = CTX_data_view_layer(C);
1852 
1854 
1855  DEG_id_tag_update(&scene->id, 0);
1857 
1858  return OPERATOR_FINISHED;
1859 }
1860 
1861 void SCENE_OT_freestyle_lineset_paste(wmOperatorType *ot)
1862 {
1863  /* identifiers */
1864  ot->name = "Paste Line Set";
1865  ot->idname = "SCENE_OT_freestyle_lineset_paste";
1866  ot->description = "Paste the buffer content to the active line set";
1867 
1868  /* api callbacks */
1869  ot->exec = freestyle_lineset_paste_exec;
1870  ot->poll = freestyle_active_lineset_poll;
1871 
1872  /* flags */
1874 }
1875 
1878 /* -------------------------------------------------------------------- */
1882 static int freestyle_lineset_remove_exec(bContext *C, wmOperator *UNUSED(op))
1883 {
1885  ViewLayer *view_layer = CTX_data_view_layer(C);
1886 
1888 
1889  DEG_id_tag_update(&scene->id, 0);
1891 
1892  return OPERATOR_FINISHED;
1893 }
1894 
1895 void SCENE_OT_freestyle_lineset_remove(wmOperatorType *ot)
1896 {
1897  /* identifiers */
1898  ot->name = "Remove Line Set";
1899  ot->idname = "SCENE_OT_freestyle_lineset_remove";
1900  ot->description = "Remove the active line set from the list of line sets";
1901 
1902  /* api callbacks */
1903  ot->exec = freestyle_lineset_remove_exec;
1904  ot->poll = freestyle_active_lineset_poll;
1905 
1906  /* flags */
1908 }
1909 
1912 /* -------------------------------------------------------------------- */
1916 static int freestyle_lineset_move_exec(bContext *C, wmOperator *op)
1917 {
1919  ViewLayer *view_layer = CTX_data_view_layer(C);
1920  int dir = RNA_enum_get(op->ptr, "direction");
1921 
1922  if (FRS_move_active_lineset(&view_layer->freestyle_config, dir)) {
1923  DEG_id_tag_update(&scene->id, 0);
1925  }
1926 
1927  return OPERATOR_FINISHED;
1928 }
1929 
1930 void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot)
1931 {
1932  static const EnumPropertyItem direction_items[] = {
1933  {-1, "UP", 0, "Up", ""},
1934  {1, "DOWN", 0, "Down", ""},
1935  {0, nullptr, 0, nullptr, nullptr},
1936  };
1937 
1938  /* identifiers */
1939  ot->name = "Move Line Set";
1940  ot->idname = "SCENE_OT_freestyle_lineset_move";
1941  ot->description = "Change the position of the active line set within the list of line sets";
1942 
1943  /* api callbacks */
1944  ot->exec = freestyle_lineset_move_exec;
1945  ot->poll = freestyle_active_lineset_poll;
1946 
1947  /* flags */
1949 
1950  /* props */
1951  RNA_def_enum(ot->srna,
1952  "direction",
1953  direction_items,
1954  0,
1955  "Direction",
1956  "Direction to move the active line set towards");
1957 }
1958 
1961 /* -------------------------------------------------------------------- */
1965 static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
1966 {
1967  Main *bmain = CTX_data_main(C);
1968  ViewLayer *view_layer = CTX_data_view_layer(C);
1970 
1971  if (!lineset) {
1972  BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to");
1973  return OPERATOR_CANCELLED;
1974  }
1975  if (lineset->linestyle) {
1976  id_us_min(&lineset->linestyle->id);
1977  lineset->linestyle = (FreestyleLineStyle *)BKE_id_copy(bmain, &lineset->linestyle->id);
1978  }
1979  else {
1980  lineset->linestyle = BKE_linestyle_new(bmain, "LineStyle");
1981  }
1982  DEG_id_tag_update(&lineset->linestyle->id, 0);
1984 
1985  return OPERATOR_FINISHED;
1986 }
1987 
1988 void SCENE_OT_freestyle_linestyle_new(wmOperatorType *ot)
1989 {
1990  /* identifiers */
1991  ot->name = "New Line Style";
1992  ot->idname = "SCENE_OT_freestyle_linestyle_new";
1993  ot->description = "Create a new line style, reusable by multiple line sets";
1994 
1995  /* api callbacks */
1996  ot->exec = freestyle_linestyle_new_exec;
1997  ot->poll = freestyle_active_lineset_poll;
1998 
1999  /* flags */
2001 }
2002 
2005 /* -------------------------------------------------------------------- */
2009 static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op)
2010 {
2011  ViewLayer *view_layer = CTX_data_view_layer(C);
2013  int type = RNA_enum_get(op->ptr, "type");
2014 
2015  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2016  return OPERATOR_CANCELLED;
2017  }
2018 
2019  if (BKE_linestyle_color_modifier_add(lineset->linestyle, nullptr, type) == nullptr) {
2020  BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type");
2021  return OPERATOR_CANCELLED;
2022  }
2023  DEG_id_tag_update(&lineset->linestyle->id, 0);
2025 
2026  return OPERATOR_FINISHED;
2027 }
2028 
2029 void SCENE_OT_freestyle_color_modifier_add(wmOperatorType *ot)
2030 {
2031  /* identifiers */
2032  ot->name = "Add Line Color Modifier";
2033  ot->idname = "SCENE_OT_freestyle_color_modifier_add";
2034  ot->description =
2035  "Add a line color modifier to the line style associated with the active lineset";
2036 
2037  /* api callbacks */
2039  ot->exec = freestyle_color_modifier_add_exec;
2040  ot->poll = freestyle_active_lineset_poll;
2041 
2042  /* flags */
2044 
2045  /* properties */
2046  ot->prop = RNA_def_enum(
2047  ot->srna, "type", rna_enum_linestyle_color_modifier_type_items, 0, "Type", "");
2048 }
2049 
2052 /* -------------------------------------------------------------------- */
2056 static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op)
2057 {
2058  ViewLayer *view_layer = CTX_data_view_layer(C);
2060  int type = RNA_enum_get(op->ptr, "type");
2061 
2062  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2063  return OPERATOR_CANCELLED;
2064  }
2065 
2066  if (BKE_linestyle_alpha_modifier_add(lineset->linestyle, nullptr, type) == nullptr) {
2067  BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type");
2068  return OPERATOR_CANCELLED;
2069  }
2070  DEG_id_tag_update(&lineset->linestyle->id, 0);
2072 
2073  return OPERATOR_FINISHED;
2074 }
2075 
2076 void SCENE_OT_freestyle_alpha_modifier_add(wmOperatorType *ot)
2077 {
2078  /* identifiers */
2079  ot->name = "Add Alpha Transparency Modifier";
2080  ot->idname = "SCENE_OT_freestyle_alpha_modifier_add";
2081  ot->description =
2082  "Add an alpha transparency modifier to the line style associated with the active lineset";
2083 
2084  /* api callbacks */
2086  ot->exec = freestyle_alpha_modifier_add_exec;
2087  ot->poll = freestyle_active_lineset_poll;
2088 
2089  /* flags */
2091 
2092  /* properties */
2093  ot->prop = RNA_def_enum(
2094  ot->srna, "type", rna_enum_linestyle_alpha_modifier_type_items, 0, "Type", "");
2095 }
2096 
2099 /* -------------------------------------------------------------------- */
2103 static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op)
2104 {
2105  ViewLayer *view_layer = CTX_data_view_layer(C);
2107  int type = RNA_enum_get(op->ptr, "type");
2108 
2109  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2110  return OPERATOR_CANCELLED;
2111  }
2112 
2113  if (BKE_linestyle_thickness_modifier_add(lineset->linestyle, nullptr, type) == nullptr) {
2114  BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type");
2115  return OPERATOR_CANCELLED;
2116  }
2117  DEG_id_tag_update(&lineset->linestyle->id, 0);
2119 
2120  return OPERATOR_FINISHED;
2121 }
2122 
2123 void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot)
2124 {
2125  /* identifiers */
2126  ot->name = "Add Line Thickness Modifier";
2127  ot->idname = "SCENE_OT_freestyle_thickness_modifier_add";
2128  ot->description =
2129  "Add a line thickness modifier to the line style associated with the active lineset";
2130 
2131  /* api callbacks */
2133  ot->exec = freestyle_thickness_modifier_add_exec;
2134  ot->poll = freestyle_active_lineset_poll;
2135 
2136  /* flags */
2138 
2139  /* properties */
2140  ot->prop = RNA_def_enum(
2141  ot->srna, "type", rna_enum_linestyle_thickness_modifier_type_items, 0, "Type", "");
2142 }
2143 
2146 /* -------------------------------------------------------------------- */
2150 static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op)
2151 {
2152  ViewLayer *view_layer = CTX_data_view_layer(C);
2154  int type = RNA_enum_get(op->ptr, "type");
2155 
2156  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2157  return OPERATOR_CANCELLED;
2158  }
2159 
2160  if (BKE_linestyle_geometry_modifier_add(lineset->linestyle, nullptr, type) == nullptr) {
2161  BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type");
2162  return OPERATOR_CANCELLED;
2163  }
2164  DEG_id_tag_update(&lineset->linestyle->id, 0);
2166 
2167  return OPERATOR_FINISHED;
2168 }
2169 
2170 void SCENE_OT_freestyle_geometry_modifier_add(wmOperatorType *ot)
2171 {
2172  /* identifiers */
2173  ot->name = "Add Stroke Geometry Modifier";
2174  ot->idname = "SCENE_OT_freestyle_geometry_modifier_add";
2175  ot->description =
2176  "Add a stroke geometry modifier to the line style associated with the active lineset";
2177 
2178  /* api callbacks */
2180  ot->exec = freestyle_geometry_modifier_add_exec;
2181  ot->poll = freestyle_active_lineset_poll;
2182 
2183  /* flags */
2185 
2186  /* properties */
2187  ot->prop = RNA_def_enum(
2188  ot->srna, "type", rna_enum_linestyle_geometry_modifier_type_items, 0, "Type", "");
2189 }
2190 
2193 /* -------------------------------------------------------------------- */
2197 static int freestyle_get_modifier_type(PointerRNA *ptr)
2198 {
2199  if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier)) {
2200  return LS_MODIFIER_TYPE_COLOR;
2201  }
2202  if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier)) {
2203  return LS_MODIFIER_TYPE_ALPHA;
2204  }
2205  if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier)) {
2207  }
2208  if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier)) {
2210  }
2211  return -1;
2212 }
2213 
2214 static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
2215 {
2216  ViewLayer *view_layer = CTX_data_view_layer(C);
2218  PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
2219  LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
2220 
2221  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2222  return OPERATOR_CANCELLED;
2223  }
2224 
2225  switch (freestyle_get_modifier_type(&ptr)) {
2227  BKE_linestyle_color_modifier_remove(lineset->linestyle, modifier);
2228  break;
2230  BKE_linestyle_alpha_modifier_remove(lineset->linestyle, modifier);
2231  break;
2234  break;
2237  break;
2238  default:
2239  BKE_report(
2240  op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier");
2241  return OPERATOR_CANCELLED;
2242  }
2243  DEG_id_tag_update(&lineset->linestyle->id, 0);
2245 
2246  return OPERATOR_FINISHED;
2247 }
2248 
2249 void SCENE_OT_freestyle_modifier_remove(wmOperatorType *ot)
2250 {
2251  /* identifiers */
2252  ot->name = "Remove Modifier";
2253  ot->idname = "SCENE_OT_freestyle_modifier_remove";
2254  ot->description = "Remove the modifier from the list of modifiers";
2255 
2256  /* api callbacks */
2257  ot->exec = freestyle_modifier_remove_exec;
2258  ot->poll = freestyle_active_lineset_poll;
2259 
2260  /* flags */
2262 }
2263 
2266 /* -------------------------------------------------------------------- */
2270 static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op)
2271 {
2272  ViewLayer *view_layer = CTX_data_view_layer(C);
2274  PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
2275  LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
2276 
2277  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2278  return OPERATOR_CANCELLED;
2279  }
2280 
2281  switch (freestyle_get_modifier_type(&ptr)) {
2283  BKE_linestyle_color_modifier_copy(lineset->linestyle, modifier, 0);
2284  break;
2286  BKE_linestyle_alpha_modifier_copy(lineset->linestyle, modifier, 0);
2287  break;
2289  BKE_linestyle_thickness_modifier_copy(lineset->linestyle, modifier, 0);
2290  break;
2292  BKE_linestyle_geometry_modifier_copy(lineset->linestyle, modifier, 0);
2293  break;
2294  default:
2295  BKE_report(
2296  op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier");
2297  return OPERATOR_CANCELLED;
2298  }
2299  DEG_id_tag_update(&lineset->linestyle->id, 0);
2301 
2302  return OPERATOR_FINISHED;
2303 }
2304 
2305 void SCENE_OT_freestyle_modifier_copy(wmOperatorType *ot)
2306 {
2307  /* identifiers */
2308  ot->name = "Copy Modifier";
2309  ot->idname = "SCENE_OT_freestyle_modifier_copy";
2310  ot->description = "Duplicate the modifier within the list of modifiers";
2311 
2312  /* api callbacks */
2313  ot->exec = freestyle_modifier_copy_exec;
2314  ot->poll = freestyle_active_lineset_poll;
2315 
2316  /* flags */
2318 }
2319 
2322 /* -------------------------------------------------------------------- */
2326 static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
2327 {
2328  ViewLayer *view_layer = CTX_data_view_layer(C);
2330  PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
2331  LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
2332  int dir = RNA_enum_get(op->ptr, "direction");
2333  bool changed = false;
2334 
2335  if (!freestyle_linestyle_check_report(lineset, op->reports)) {
2336  return OPERATOR_CANCELLED;
2337  }
2338 
2339  switch (freestyle_get_modifier_type(&ptr)) {
2341  changed = BKE_linestyle_color_modifier_move(lineset->linestyle, modifier, dir);
2342  break;
2344  changed = BKE_linestyle_alpha_modifier_move(lineset->linestyle, modifier, dir);
2345  break;
2347  changed = BKE_linestyle_thickness_modifier_move(lineset->linestyle, modifier, dir);
2348  break;
2350  changed = BKE_linestyle_geometry_modifier_move(lineset->linestyle, modifier, dir);
2351  break;
2352  default:
2353  BKE_report(
2354  op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier");
2355  return OPERATOR_CANCELLED;
2356  }
2357 
2358  if (changed) {
2359  DEG_id_tag_update(&lineset->linestyle->id, 0);
2361  }
2362 
2363  return OPERATOR_FINISHED;
2364 }
2365 
2366 void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot)
2367 {
2368  static const EnumPropertyItem direction_items[] = {
2369  {-1, "UP", 0, "Up", ""},
2370  {1, "DOWN", 0, "Down", ""},
2371  {0, nullptr, 0, nullptr, nullptr},
2372  };
2373 
2374  /* identifiers */
2375  ot->name = "Move Modifier";
2376  ot->idname = "SCENE_OT_freestyle_modifier_move";
2377  ot->description = "Move the modifier within the list of modifiers";
2378 
2379  /* api callbacks */
2380  ot->exec = freestyle_modifier_move_exec;
2381  ot->poll = freestyle_active_lineset_poll;
2382 
2383  /* flags */
2385 
2386  /* props */
2387  RNA_def_enum(ot->srna,
2388  "direction",
2389  direction_items,
2390  0,
2391  "Direction",
2392  "Direction to move the chosen modifier towards");
2393 }
2394 
2397 /* -------------------------------------------------------------------- */
2401 static int freestyle_stroke_material_create_exec(bContext *C, wmOperator *op)
2402 {
2403  Main *bmain = CTX_data_main(C);
2404  ViewLayer *view_layer = CTX_data_view_layer(C);
2406 
2407  if (!linestyle) {
2408  BKE_report(op->reports, RPT_ERROR, "No active line style in the current scene");
2409  return OPERATOR_CANCELLED;
2410  }
2411 
2413 
2414  return OPERATOR_FINISHED;
2415 }
2416 
2417 void SCENE_OT_freestyle_stroke_material_create(wmOperatorType *ot)
2418 {
2419  /* identifiers */
2420  ot->name = "Create Freestyle Stroke Material";
2421  ot->idname = "SCENE_OT_freestyle_stroke_material_create";
2422  ot->description = "Create Freestyle stroke material for testing";
2423 
2424  /* api callbacks */
2425  ot->exec = freestyle_stroke_material_create_exec;
2426 
2427  /* flags */
2429 }
2430 
2433 #endif /* WITH_FREESTYLE */
2434 
2435 /* -------------------------------------------------------------------- */
2440 {
2441  ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).owner_id;
2442 
2443  if (id) {
2444  MTex **mtex_ar, *mtexswap;
2445  short act;
2446  int type = RNA_enum_get(op->ptr, "type");
2447  struct AnimData *adt = BKE_animdata_from_id(id);
2448 
2449  give_active_mtex(id, &mtex_ar, &act);
2450 
2451  if (type == -1) { /* Up */
2452  if (act > 0) {
2453  mtexswap = mtex_ar[act];
2454  mtex_ar[act] = mtex_ar[act - 1];
2455  mtex_ar[act - 1] = mtexswap;
2456 
2458  id, adt, nullptr, "texture_slots", nullptr, nullptr, act - 1, -1, false);
2460  id, adt, nullptr, "texture_slots", nullptr, nullptr, act, act - 1, false);
2462  id, adt, nullptr, "texture_slots", nullptr, nullptr, -1, act, false);
2463 
2464  set_active_mtex(id, act - 1);
2465  }
2466  }
2467  else { /* Down */
2468  if (act < MAX_MTEX - 1) {
2469  mtexswap = mtex_ar[act];
2470  mtex_ar[act] = mtex_ar[act + 1];
2471  mtex_ar[act + 1] = mtexswap;
2472 
2474  id, adt, nullptr, "texture_slots", nullptr, nullptr, act + 1, -1, false);
2476  id, adt, nullptr, "texture_slots", nullptr, nullptr, act, act + 1, false);
2478  id, adt, nullptr, "texture_slots", nullptr, nullptr, -1, act, false);
2479 
2480  set_active_mtex(id, act + 1);
2481  }
2482  }
2483 
2484  DEG_id_tag_update(id, 0);
2486  }
2487 
2488  return OPERATOR_FINISHED;
2489 }
2490 
2492 {
2493  static const EnumPropertyItem slot_move[] = {
2494  {-1, "UP", 0, "Up", ""},
2495  {1, "DOWN", 0, "Down", ""},
2496  {0, nullptr, 0, nullptr, nullptr},
2497  };
2498 
2499  /* identifiers */
2500  ot->name = "Move Texture Slot";
2501  ot->idname = "TEXTURE_OT_slot_move";
2502  ot->description = "Move texture slots up and down";
2503 
2504  /* api callbacks */
2506 
2507  /* flags */
2509 
2510  RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
2511 }
2512 
2515 /* -------------------------------------------------------------------- */
2519 /* material copy/paste */
2521 {
2522  Material *ma = static_cast<Material *>(
2523  CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
2524 
2525  if (ma == nullptr) {
2526  return OPERATOR_CANCELLED;
2527  }
2528 
2530 
2531  return OPERATOR_FINISHED;
2532 }
2533 
2535 {
2536  /* identifiers */
2537  ot->name = "Copy Material";
2538  ot->idname = "MATERIAL_OT_copy";
2539  ot->description = "Copy the material settings and nodes";
2540 
2541  /* api callbacks */
2543 
2544  /* flags */
2545  /* no undo needed since no changes are made to the material */
2547 }
2548 
2551 /* -------------------------------------------------------------------- */
2556 {
2557  Material *ma = static_cast<Material *>(
2558  CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
2559 
2560  if (ma == nullptr) {
2561  return OPERATOR_CANCELLED;
2562  }
2563 
2565 
2568 
2569  return OPERATOR_FINISHED;
2570 }
2571 
2573 {
2574  /* identifiers */
2575  ot->name = "Paste Material";
2576  ot->idname = "MATERIAL_OT_paste";
2577  ot->description = "Paste the material settings and nodes";
2578 
2579  /* api callbacks */
2581 
2582  /* flags */
2584 }
2585 
2588 /* -------------------------------------------------------------------- */
2592 static short mtexcopied = 0; /* must be reset on file load */
2594 
2596 { /* use for file reload */
2597  mtexcopied = 0;
2598 }
2599 
2600 static void copy_mtex_copybuf(ID *id)
2601 {
2602  MTex **mtex = nullptr;
2603 
2604  switch (GS(id->name)) {
2605  case ID_PA:
2606  mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
2607  break;
2608  case ID_LS:
2609  mtex = &(((FreestyleLineStyle *)id)->mtex[(int)((FreestyleLineStyle *)id)->texact]);
2610  break;
2611  default:
2612  break;
2613  }
2614 
2615  if (mtex && *mtex) {
2616  mtexcopybuf = blender::dna::shallow_copy(**mtex);
2617  mtexcopied = 1;
2618  }
2619  else {
2620  mtexcopied = 0;
2621  }
2622 }
2623 
2624 static void paste_mtex_copybuf(ID *id)
2625 {
2626  MTex **mtex = nullptr;
2627 
2628  if (mtexcopied == 0 || mtexcopybuf.tex == nullptr) {
2629  return;
2630  }
2631 
2632  switch (GS(id->name)) {
2633  case ID_PA:
2634  mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
2635  break;
2636  case ID_LS:
2637  mtex = &(((FreestyleLineStyle *)id)->mtex[(int)((FreestyleLineStyle *)id)->texact]);
2638  break;
2639  default:
2640  BLI_assert_msg(0, "invalid id type");
2641  return;
2642  }
2643 
2644  if (mtex) {
2645  if (*mtex == nullptr) {
2646  *mtex = MEM_new<MTex>("mtex copy");
2647  }
2648  else if ((*mtex)->tex) {
2649  id_us_min(&(*mtex)->tex->id);
2650  }
2651 
2652  **mtex = blender::dna::shallow_copy(mtexcopybuf);
2653 
2655  }
2656 }
2657 
2660 /* -------------------------------------------------------------------- */
2665 {
2666  ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).owner_id;
2667 
2668  if (id == nullptr) {
2669  /* copying empty slot */
2671  return OPERATOR_CANCELLED;
2672  }
2673 
2674  copy_mtex_copybuf(id);
2675 
2676  return OPERATOR_FINISHED;
2677 }
2678 
2680 {
2681  ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).owner_id;
2682 
2683  return (id != nullptr);
2684 }
2685 
2687 {
2688  /* identifiers */
2689  ot->name = "Copy Texture Slot Settings";
2690  ot->idname = "TEXTURE_OT_slot_copy";
2691  ot->description = "Copy the material texture settings and nodes";
2692 
2693  /* api callbacks */
2694  ot->exec = copy_mtex_exec;
2695  ot->poll = copy_mtex_poll;
2696 
2697  /* flags */
2698  /* no undo needed since no changes are made to the mtex */
2700 }
2701 
2704 /* -------------------------------------------------------------------- */
2709 {
2710  ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).owner_id;
2711 
2712  if (id == nullptr) {
2713  Material *ma = static_cast<Material *>(
2714  CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
2715  Light *la = static_cast<Light *>(CTX_data_pointer_get_type(C, "light", &RNA_Light).data);
2716  World *wo = static_cast<World *>(CTX_data_pointer_get_type(C, "world", &RNA_World).data);
2717  ParticleSystem *psys = static_cast<ParticleSystem *>(
2718  CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data);
2720  CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data);
2721 
2722  if (ma) {
2723  id = &ma->id;
2724  }
2725  else if (la) {
2726  id = &la->id;
2727  }
2728  else if (wo) {
2729  id = &wo->id;
2730  }
2731  else if (psys) {
2732  id = &psys->part->id;
2733  }
2734  else if (linestyle) {
2735  id = &linestyle->id;
2736  }
2737 
2738  if (id == nullptr) {
2739  return OPERATOR_CANCELLED;
2740  }
2741  }
2742 
2743  paste_mtex_copybuf(id);
2744 
2746 
2747  return OPERATOR_FINISHED;
2748 }
2749 
2751 {
2752  /* identifiers */
2753  ot->name = "Paste Texture Slot Settings";
2754  ot->idname = "TEXTURE_OT_slot_paste";
2755  ot->description = "Copy the texture settings and nodes";
2756 
2757  /* api callbacks */
2758  ot->exec = paste_mtex_exec;
2759 
2760  /* flags */
2762 }
2763 
struct AnimData * BKE_animdata_from_id(const struct ID *id)
void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, struct ID *ref_id, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
Definition: anim_data.c:958
#define FOREACH_SCENE_OBJECT_END
#define FOREACH_SCENE_OBJECT_BEGIN(scene, _instance)
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
#define CTX_DATA_BEGIN(C, Type, instance, member)
Definition: BKE_context.h:269
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:473
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
#define CTX_DATA_END
Definition: BKE_context.h:278
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
struct ListBase * BKE_curve_editNurbs_get(struct Curve *cu)
Definition: curve.cc:426
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
Definition: editmesh.c:58
struct FreestyleModuleConfig * BKE_freestyle_module_add(struct FreestyleConfig *config)
Definition: freestyle.c:115
struct FreestyleLineSet * BKE_freestyle_lineset_add(struct Main *bmain, struct FreestyleConfig *config, const char *name)
Definition: freestyle.c:162
struct FreestyleLineSet * BKE_freestyle_lineset_get_active(struct FreestyleConfig *config)
Definition: freestyle.c:213
bool BKE_freestyle_module_move(struct FreestyleConfig *config, struct FreestyleModuleConfig *module_conf, int direction)
Definition: freestyle.c:139
bool BKE_freestyle_module_delete(struct FreestyleConfig *config, struct FreestyleModuleConfig *module_conf)
Definition: freestyle.c:130
struct ViewLayerLightgroup * BKE_view_layer_add_lightgroup(struct ViewLayer *view_layer, const char *name)
Definition: layer.c:2544
@ VIEWLAYER_ADD_NEW
Definition: BKE_layer.h:37
@ VIEWLAYER_ADD_EMPTY
Definition: BKE_layer.h:38
@ VIEWLAYER_ADD_COPY
Definition: BKE_layer.h:39
void BKE_view_layer_verify_aov(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
Definition: layer.c:2476
struct ViewLayer * BKE_view_layer_add(struct Scene *scene, const char *name, struct ViewLayer *view_layer_source, int type)
Definition: layer.c:185
struct ViewLayerAOV * BKE_view_layer_add_aov(struct ViewLayer *view_layer)
Definition: layer.c:2421
void BKE_view_layer_remove_lightgroup(struct ViewLayer *view_layer, struct ViewLayerLightgroup *lightgroup)
Definition: layer.c:2561
void BKE_view_layer_remove_aov(struct ViewLayer *view_layer, struct ViewLayerAOV *aov)
Definition: layer.c:2433
struct ID * BKE_id_copy(struct Main *bmain, const struct ID *id)
@ LIB_ID_COPY_ACTIONS
Definition: BKE_lib_id.h:166
@ LIB_ID_COPY_DEFAULT
Definition: BKE_lib_id.h:181
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag)
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
Blender kernel freestyle line style functionality.
int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
Definition: linestyle.c:1261
LineStyleModifier * BKE_linestyle_alpha_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
FreestyleLineStyle * BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer)
Definition: linestyle.c:806
LineStyleModifier * BKE_linestyle_geometry_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
Definition: linestyle.c:1022
LineStyleModifier * BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
Definition: linestyle.c:1638
bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
Definition: linestyle.c:1912
#define LS_MODIFIER_TYPE_COLOR
Definition: BKE_linestyle.h:17
#define LS_MODIFIER_TYPE_ALPHA
Definition: BKE_linestyle.h:18
bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
Definition: linestyle.c:1900
LineStyleModifier * BKE_linestyle_thickness_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
Definition: linestyle.c:1335
LineStyleModifier * BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
Definition: linestyle.c:872
int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
Definition: linestyle.c:1550
#define LS_MODIFIER_TYPE_GEOMETRY
Definition: BKE_linestyle.h:20
LineStyleModifier * BKE_linestyle_thickness_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
Definition: linestyle.c:1429
bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
Definition: linestyle.c:1906
FreestyleLineStyle * BKE_linestyle_new(struct Main *bmain, const char *name)
Definition: linestyle.c:795
bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
Definition: linestyle.c:1918
#define LS_MODIFIER_TYPE_THICKNESS
Definition: BKE_linestyle.h:19
LineStyleModifier * BKE_linestyle_color_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
Definition: linestyle.c:930
LineStyleModifier * BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
Definition: linestyle.c:1092
int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
Definition: linestyle.c:1891
General operations, lookup, etc. for materials.
struct Material *** BKE_object_material_array_p(struct Object *ob)
Definition: material.c:311
bool BKE_object_material_slot_remove(struct Main *bmain, struct Object *ob)
Definition: material.c:1248
struct Material * BKE_object_material_get(struct Object *ob, short act)
Definition: material.c:687
bool BKE_object_material_slot_used(struct Object *object, short actcol)
Definition: material.c:452
struct Material * BKE_gpencil_material_add(struct Main *bmain, const char *name)
Definition: material.c:298
void BKE_material_copybuf_paste(struct Main *bmain, struct Material *ma)
Definition: material.c:1907
void BKE_material_copybuf_copy(struct Main *bmain, struct Material *ma)
Definition: material.c:1889
void BKE_object_material_array_assign(struct Main *bmain, struct Object *ob, struct Material ***matar, int totcol, bool to_object_only)
Definition: material.c:1173
void BKE_object_material_remap(struct Object *ob, const unsigned int *remap)
Definition: material.c:1060
struct Material * BKE_material_add(struct Main *bmain, const char *name)
Definition: material.c:289
bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob)
Definition: material.c:1232
struct Material ** BKE_object_material_get_p(struct Object *ob, short act)
Definition: material.c:644
short * BKE_object_material_len_p(struct Object *ob)
Definition: material.c:344
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const struct Object *ob)
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
struct SceneRenderView * BKE_scene_add_render_view(struct Scene *sce, const char *name)
Definition: scene.cc:2740
bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *srv)
Definition: scene.cc:2759
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act)
Definition: texture.c:483
void set_active_mtex(struct ID *id, short act)
Definition: texture.c:509
struct Tex * BKE_texture_add(struct Main *bmain, const char *name)
Definition: texture.c:373
int BKE_vfont_select_get(struct Object *ob, int *r_start, int *r_end)
Definition: vfont.c:618
struct World * BKE_world_add(struct Main *bmain, const char *name)
Definition: world.c:212
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
GSet * BLI_gset_str_new(const char *info)
struct GSet GSet
Definition: BLI_ghash.h:340
#define GSET_FOREACH_END()
Definition: BLI_ghash.h:540
bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:1007
#define GSET_FOREACH_BEGIN(type, var, what)
Definition: BLI_ghash.h:534
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
Definition: BLI_ghash.c:1037
bool BLI_gset_add(GSet *gs, void *key)
Definition: BLI_ghash.c:969
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void range_vn_u(unsigned int *array_tar, int size, unsigned int start)
Definition: math_vector.c:1031
void BLI_str_replace_char(char *str, char src, char dst) ATTR_NONNULL()
Definition: string.c:503
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
#define ELEM(...)
#define DATA_(msgid)
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_SELECT
Definition: DNA_ID.h:818
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
@ ID_LS
Definition: DNA_ID_enums.h:75
@ ID_PA
Definition: DNA_ID_enums.h:70
#define MAX_NAME
Definition: DNA_defs.h:48
@ LIGHTCACHE_UPDATE_GRID
@ LIGHTCACHE_INVALID
@ LIGHTCACHE_UPDATE_CUBE
@ OB_MODE_TEXTURE_PAINT
Object is a sort of wrapper for general info.
@ OB_SURF
@ OB_FONT
@ OB_MESH
@ OB_CURVES_LEGACY
@ OB_GPENCIL
#define OB_TYPE_SUPPORT_MATERIAL(_type)
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
bool EDBM_deselect_by_material(struct BMEditMesh *em, short index, bool select)
void ED_node_shader_default(const struct bContext *C, struct ID *id)
struct Object * ED_object_context(const struct bContext *C)
Object ** ED_object_array_in_mode_or_selected(struct bContext *C, bool(*filter_fn)(const struct Object *ob, void *user_data), void *filter_user_data, uint *r_objects_len)
bool ED_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
bool ED_scene_view_layer_delete(struct Main *bmain, struct Scene *scene, struct ViewLayer *layer, struct ReportList *reports) ATTR_NONNULL(1
void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph)
Definition: screen_edit.c:1694
bool ED_operator_object_active_local_editable_ex(struct bContext *C, const Object *ob)
Definition: screen_ops.c:402
struct Material * FRS_create_stroke_material(struct Main *bmain, struct FreestyleLineStyle *linestyle)
bool FRS_move_active_lineset(struct FreestyleConfig *config, int direction)
void FRS_paste_active_lineset(struct FreestyleConfig *config)
void FRS_copy_active_lineset(struct FreestyleConfig *config)
void FRS_delete_active_lineset(struct FreestyleConfig *config)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
#define C
Definition: RandGen.cpp:25
#define MAX_MTEX
Definition: Stroke.h:31
void UI_context_active_but_prop_get_templateID(struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop)
@ WM_JOB_TYPE_LIGHT_BAKE
Definition: WM_api.h:1369
@ WM_JOB_TYPE_RENDER
Definition: WM_api.h:1349
#define NC_WORLD
Definition: WM_types.h:337
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DRAW
Definition: WM_types.h:410
#define ND_DATA
Definition: WM_types.h:456
#define NC_LINESTYLE
Definition: WM_types.h:350
#define ND_RENDER_OPTIONS
Definition: WM_types.h:383
#define ND_SHADING_PREVIEW
Definition: WM_types.h:428
#define NC_SCENE
Definition: WM_types.h:328
#define NA_ADDED
Definition: WM_types.h:525
#define ND_TOOLSETTINGS
Definition: WM_types.h:397
#define NA_EDITED
Definition: WM_types.h:523
#define NC_MATERIAL
Definition: WM_types.h:330
#define ND_SELECT
Definition: WM_types.h:455
#define NC_TEXTURE
Definition: WM_types.h:331
#define ND_LAYER
Definition: WM_types.h:398
#define ND_OB_SHADING
Definition: WM_types.h:406
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_SHADING_LINKS
Definition: WM_types.h:427
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_FACES_OF_MESH
#define SELECT
Scene scene
FreestyleLineStyle linestyle
void * user_data
bool ED_curve_nurb_select_check(const View3D *v3d, const Nurb *nu)
void * EEVEE_lightbake_job_data_alloc(struct Main *bmain, struct ViewLayer *view_layer, struct Scene *scene, bool run_as_job, int frame)
void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress)
wmJob * EEVEE_lightbake_job_create(struct wmWindowManager *wm, struct wmWindow *win, struct Main *bmain, struct ViewLayer *view_layer, struct Scene *scene, int delay, int frame)
void EEVEE_lightbake_job_data_free(void *custom_data)
void EEVEE_lightcache_free(LightCache *lcache)
void EEVEE_lightcache_info_update(SceneEEVEE *eevee)
RenderEngine * RE_engine_create(RenderEngineType *type)
Definition: engine.c:136
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:98
void RE_engine_free(RenderEngine *engine)
Definition: engine.c:164
#define GS(x)
Definition: iris.c:225
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define G(x, y, z)
static unsigned a[3]
Definition: RandGen.cpp:78
void ntreeCompositUpdateRLayers(bNodeTree *ntree)
static struct PyModuleDef module
Definition: python.cpp:972
static Object ** object_array_for_shading_edit_mode_enabled(bContext *C, uint *r_objects_len)
static int light_cache_free_exec(bContext *C, wmOperator *UNUSED(op))
void ED_render_clear_mtex_copybuf()
static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_add(wmOperatorType *ot)
void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
static int view_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
static int view_layer_add_exec(bContext *C, wmOperator *op)
static int view_layer_remove_lightgroup_exec(bContext *C, wmOperator *UNUSED(op))
static int light_cache_bake_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int render_view_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
static bool object_array_for_shading_edit_mode_enabled_filter(const Object *ob, void *user_data)
static MTex mtexcopybuf
void SCENE_OT_view_layer_remove_unused_lightgroups(wmOperatorType *ot)
static bool view_layer_remove_poll(bContext *C)
static void paste_mtex_copybuf(ID *id)
static int view_layer_add_used_lightgroups_exec(bContext *C, wmOperator *UNUSED(op))
static bool light_cache_free_poll(bContext *C)
static void copy_mtex_copybuf(ID *id)
static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op))
static int material_slot_de_select(bContext *C, bool select)
void OBJECT_OT_material_slot_select(wmOperatorType *ot)
void WORLD_OT_new(wmOperatorType *ot)
void OBJECT_OT_material_slot_remove_unused(wmOperatorType *ot)
static int view_layer_add_aov_exec(bContext *C, wmOperator *UNUSED(op))
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
static int material_slot_remove_unused_exec(bContext *C, wmOperator *op)
void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
static bool object_array_for_shading_edit_mode_disabled_filter(const Object *ob, void *user_data)
void MATERIAL_OT_paste(wmOperatorType *ot)
void MATERIAL_OT_new(wmOperatorType *ot)
static int material_slot_remove_exec(bContext *C, wmOperator *op)
void SCENE_OT_view_layer_add(wmOperatorType *ot)
static int view_layer_remove_aov_exec(bContext *C, wmOperator *UNUSED(op))
static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_move(wmOperatorType *ot)
void SCENE_OT_view_layer_add_used_lightgroups(wmOperatorType *ot)
@ LIGHTCACHE_SUBSET_DIRTY
@ LIGHTCACHE_SUBSET_CUBE
@ LIGHTCACHE_SUBSET_ALL
static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
void TEXTURE_OT_new(wmOperatorType *ot)
static bool render_view_remove_poll(bContext *C)
static bool object_materials_supported_poll(bContext *C)
static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
static void light_cache_bake_tag_cache(Scene *scene, wmOperator *op)
static int material_slot_move_exec(bContext *C, wmOperator *op)
void MATERIAL_OT_copy(wmOperatorType *ot)
void SCENE_OT_light_cache_free(wmOperatorType *ot)
static int light_cache_bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void SCENE_OT_view_layer_remove_lightgroup(wmOperatorType *ot)
static int texture_slot_move_exec(bContext *C, wmOperator *op)
void TEXTURE_OT_slot_paste(wmOperatorType *ot)
void SCENE_OT_view_layer_add_aov(wmOperatorType *ot)
static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
void TEXTURE_OT_slot_copy(wmOperatorType *ot)
void SCENE_OT_light_cache_bake(wmOperatorType *ot)
static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
static int light_cache_bake_exec(bContext *C, wmOperator *op)
void SCENE_OT_render_view_add(wmOperatorType *ot)
void SCENE_OT_view_layer_remove_aov(wmOperatorType *ot)
void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
void TEXTURE_OT_slot_move(wmOperatorType *ot)
void SCENE_OT_view_layer_remove(wmOperatorType *ot)
void SCENE_OT_view_layer_add_lightgroup(wmOperatorType *ot)
static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
static Object ** object_array_for_shading_edit_mode_disabled(bContext *C, uint *r_objects_len)
static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
static int view_layer_add_lightgroup_exec(bContext *C, wmOperator *op)
void SCENE_OT_render_view_remove(wmOperatorType *ot)
static int render_view_remove_exec(bContext *C, wmOperator *UNUSED(op))
static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
static bool object_materials_supported_poll_ex(bContext *C, const Object *ob)
static bool copy_mtex_poll(bContext *C)
static GSet * get_used_lightgroups(Scene *scene)
static void light_cache_bake_cancel(bContext *C, wmOperator *op)
static short mtexcopied
static int view_layer_remove_unused_lightgroups_exec(bContext *C, wmOperator *UNUSED(op))
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:695
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
Definition: rna_access.c:3532
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
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
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[]
Definition: rna_linestyle.c:64
const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[]
Definition: rna_linestyle.c:85
const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[]
Definition: rna_linestyle.c:24
const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[]
Definition: rna_linestyle.c:44
struct BMesh * bm
Definition: BKE_editmesh.h:40
short mat_nr
Definition: bmesh_class.h:281
short hide
uint8_t f1
uint8_t f3
uint8_t f1
uint8_t f2
struct CharInfo * textbufinfo
Definition: BKE_vfont.h:33
struct FreestyleLineStyle * linestyle
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
struct Tex * tex
Definition: BKE_main.h:121
struct Nurb * next
BezTriple * bezt
BPoint * bp
short mat_nr
struct Material ** mat
char * matbits
void * data
ParticleSettings * part
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
char engine[32]
ListBase views
void(* update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
Definition: RE_engine.h:109
struct LightCache * light_cache_data
struct bNodeTree * nodetree
struct RenderData r
ListBase view_layers
struct World * world
struct SceneEEVEE eevee
struct FreestyleConfig freestyle_config
ListBase lightgroups
ViewLayerLightgroup * active_lightgroup
ViewLayerAOV * active_aov
char name[64]
struct LightgroupMembership * lightgroup
short use_nodes
short type
Definition: WM_types.h:678
Definition: wm_jobs.c:57
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
PropertyRNA * prop
Definition: WM_types.h:981
struct ReportList * reports
struct PointerRNA * ptr
void WM_cursor_wait(bool val)
Definition: wm_cursors.c:209
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ EVT_ESCKEY
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition: wm_jobs.c:437
void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:572
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:214
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217
void WM_window_set_active_view_layer(wmWindow *win, ViewLayer *view_layer)
Definition: wm_window.c:2237