Blender  V2.93
paint.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  * The Original Code is Copyright (C) 2009 by Nicholas Bishop
17  * All rights reserved.
18  */
19 
24 #include <stdlib.h>
25 #include <string.h>
26 
27 #include "MEM_guardedalloc.h"
28 
29 #include "DNA_brush_types.h"
30 #include "DNA_gpencil_types.h"
31 #include "DNA_mesh_types.h"
32 #include "DNA_meshdata_types.h"
33 #include "DNA_modifier_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_scene_types.h"
36 #include "DNA_space_types.h"
37 #include "DNA_view3d_types.h"
38 #include "DNA_workspace_types.h"
39 
40 #include "BLI_bitmap.h"
41 #include "BLI_hash.h"
42 #include "BLI_listbase.h"
43 #include "BLI_math_vector.h"
44 #include "BLI_utildefines.h"
45 
46 #include "BLT_translation.h"
47 
48 #include "BKE_brush.h"
49 #include "BKE_ccg.h"
50 #include "BKE_colortools.h"
51 #include "BKE_context.h"
52 #include "BKE_crazyspace.h"
53 #include "BKE_deform.h"
54 #include "BKE_gpencil.h"
55 #include "BKE_idtype.h"
56 #include "BKE_image.h"
57 #include "BKE_key.h"
58 #include "BKE_lib_id.h"
59 #include "BKE_main.h"
60 #include "BKE_mesh.h"
61 #include "BKE_mesh_mapping.h"
62 #include "BKE_mesh_runtime.h"
63 #include "BKE_modifier.h"
64 #include "BKE_multires.h"
65 #include "BKE_object.h"
66 #include "BKE_paint.h"
67 #include "BKE_pbvh.h"
68 #include "BKE_subdiv_ccg.h"
69 #include "BKE_subsurf.h"
70 
71 #include "DEG_depsgraph.h"
72 #include "DEG_depsgraph_query.h"
73 
74 #include "RNA_enum_types.h"
75 
76 #include "BLO_read_write.h"
77 
78 #include "bmesh.h"
79 
80 static void palette_init_data(ID *id)
81 {
82  Palette *palette = (Palette *)id;
83 
85 
86  /* Enable fake user by default. */
87  id_fake_user_set(&palette->id);
88 }
89 
90 static void palette_copy_data(Main *UNUSED(bmain),
91  ID *id_dst,
92  const ID *id_src,
93  const int UNUSED(flag))
94 {
95  Palette *palette_dst = (Palette *)id_dst;
96  const Palette *palette_src = (const Palette *)id_src;
97 
98  BLI_duplicatelist(&palette_dst->colors, &palette_src->colors);
99 }
100 
101 static void palette_free_data(ID *id)
102 {
103  Palette *palette = (Palette *)id;
104 
105  BLI_freelistN(&palette->colors);
106 }
107 
108 static void palette_blend_write(BlendWriter *writer, ID *id, const void *id_address)
109 {
110  Palette *palette = (Palette *)id;
111  if (palette->id.us > 0 || BLO_write_is_undo(writer)) {
112  PaletteColor *color;
113  BLO_write_id_struct(writer, Palette, id_address, &palette->id);
114  BKE_id_blend_write(writer, &palette->id);
115 
116  for (color = palette->colors.first; color; color = color->next) {
117  BLO_write_struct(writer, PaletteColor, color);
118  }
119  }
120 }
121 
122 static void palette_blend_read_data(BlendDataReader *reader, ID *id)
123 {
124  Palette *palette = (Palette *)id;
125  BLO_read_list(reader, &palette->colors);
126 }
127 
128 static void palette_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
129 {
130  /* Whole Palette is preserved across undo-steps, and it has no extra pointer, simple. */
131  /* Note: We do not care about potential internal references to self here, Palette has none. */
132  /* Note: We do not swap IDProperties, as dealing with potential ID pointers in those would be
133  * fairly delicate. */
134  BKE_lib_id_swap(NULL, id_new, id_old);
135  SWAP(IDProperty *, id_new->properties, id_old->properties);
136 }
137 
139  .id_code = ID_PAL,
140  .id_filter = FILTER_ID_PAL,
141  .main_listbase_index = INDEX_ID_PAL,
142  .struct_size = sizeof(Palette),
143  .name = "Palette",
144  .name_plural = "palettes",
145  .translation_context = BLT_I18NCONTEXT_ID_PALETTE,
146  .flags = IDTYPE_FLAGS_NO_ANIMDATA,
147 
149  .copy_data = palette_copy_data,
150  .free_data = palette_free_data,
151  .make_local = NULL,
152  .foreach_id = NULL,
153  .foreach_cache = NULL,
154  .owner_get = NULL,
155 
156  .blend_write = palette_blend_write,
157  .blend_read_data = palette_blend_read_data,
158  .blend_read_lib = NULL,
159  .blend_read_expand = NULL,
160 
161  .blend_read_undo_preserve = palette_undo_preserve,
162 
163  .lib_override_apply_post = NULL,
164 };
165 
166 static void paint_curve_copy_data(Main *UNUSED(bmain),
167  ID *id_dst,
168  const ID *id_src,
169  const int UNUSED(flag))
170 {
171  PaintCurve *paint_curve_dst = (PaintCurve *)id_dst;
172  const PaintCurve *paint_curve_src = (const PaintCurve *)id_src;
173 
174  if (paint_curve_src->tot_points != 0) {
175  paint_curve_dst->points = MEM_dupallocN(paint_curve_src->points);
176  }
177 }
178 
179 static void paint_curve_free_data(ID *id)
180 {
181  PaintCurve *paint_curve = (PaintCurve *)id;
182 
183  MEM_SAFE_FREE(paint_curve->points);
184  paint_curve->tot_points = 0;
185 }
186 
187 static void paint_curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
188 {
189  PaintCurve *pc = (PaintCurve *)id;
190  if (pc->id.us > 0 || BLO_write_is_undo(writer)) {
191  BLO_write_id_struct(writer, PaintCurve, id_address, &pc->id);
192  BKE_id_blend_write(writer, &pc->id);
193 
195  }
196 }
197 
199 {
200  PaintCurve *pc = (PaintCurve *)id;
201  BLO_read_data_address(reader, &pc->points);
202 }
203 
205  .id_code = ID_PC,
206  .id_filter = FILTER_ID_PC,
207  .main_listbase_index = INDEX_ID_PC,
208  .struct_size = sizeof(PaintCurve),
209  .name = "PaintCurve",
210  .name_plural = "paint_curves",
211  .translation_context = BLT_I18NCONTEXT_ID_PAINTCURVE,
212  .flags = IDTYPE_FLAGS_NO_ANIMDATA,
213 
214  .init_data = NULL,
215  .copy_data = paint_curve_copy_data,
216  .free_data = paint_curve_free_data,
217  .make_local = NULL,
218  .foreach_id = NULL,
219  .foreach_cache = NULL,
220  .owner_get = NULL,
221 
222  .blend_write = paint_curve_blend_write,
223  .blend_read_data = paint_curve_blend_read_data,
224  .blend_read_lib = NULL,
225  .blend_read_expand = NULL,
226 
227  .blend_read_undo_preserve = NULL,
228 
229  .lib_override_apply_post = NULL,
230 };
231 
232 const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100};
233 const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255};
234 const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255};
235 const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
236 
238 
240 {
241  Paint *p = BKE_paint_get_active(scene, view_layer);
242  if (!p) {
243  return;
244  }
245 
246  Brush *br = p->brush;
247  if (!br) {
248  return;
249  }
250 
251  if (br->mtex.tex == tex) {
253  }
254  if (br->mask_mtex.tex == tex) {
256  }
257 }
258 
260 {
261  Paint *p = BKE_paint_get_active(scene, view_layer);
262  if (p == NULL) {
263  return;
264  }
265 
266  Brush *br = p->brush;
267  if (br && br->curve == curve) {
269  }
270 }
271 
273 {
276 }
277 
279 {
280  return overlay_flags;
281 }
282 
284 {
285  if (flags & BRUSH_OVERLAY_OVERRIDE_MASK) {
288  }
291  }
294  }
295  }
296  else {
298  }
299 }
300 
302 {
303  overlay_flags &= ~(flag);
304 }
305 
307 {
308  ToolSettings *ts = sce->toolsettings;
309  Paint **paint_ptr = NULL;
310  /* Some paint modes don't store paint settings as pointer, for these this can be set and
311  * referenced by paint_ptr. */
312  Paint *paint_tmp = NULL;
313 
314  switch (mode) {
315  case PAINT_MODE_SCULPT:
316  paint_ptr = (Paint **)&ts->sculpt;
317  break;
318  case PAINT_MODE_VERTEX:
319  paint_ptr = (Paint **)&ts->vpaint;
320  break;
321  case PAINT_MODE_WEIGHT:
322  paint_ptr = (Paint **)&ts->wpaint;
323  break;
326  paint_tmp = (Paint *)&ts->imapaint;
327  paint_ptr = &paint_tmp;
328  break;
330  paint_ptr = (Paint **)&ts->uvsculpt;
331  break;
332  case PAINT_MODE_GPENCIL:
333  paint_ptr = (Paint **)&ts->gp_paint;
334  break;
336  paint_ptr = (Paint **)&ts->gp_vertexpaint;
337  break;
339  paint_ptr = (Paint **)&ts->gp_sculptpaint;
340  break;
342  paint_ptr = (Paint **)&ts->gp_weightpaint;
343  break;
344  case PAINT_MODE_INVALID:
345  break;
346  }
347  if (paint_ptr) {
348  BKE_paint_ensure(ts, paint_ptr);
349  return true;
350  }
351  return false;
352 }
353 
355 {
356  if (sce) {
357  ToolSettings *ts = sce->toolsettings;
358 
359  switch (mode) {
360  case PAINT_MODE_SCULPT:
361  return &ts->sculpt->paint;
362  case PAINT_MODE_VERTEX:
363  return &ts->vpaint->paint;
364  case PAINT_MODE_WEIGHT:
365  return &ts->wpaint->paint;
368  return &ts->imapaint.paint;
370  return &ts->uvsculpt->paint;
371  case PAINT_MODE_GPENCIL:
372  return &ts->gp_paint->paint;
374  return &ts->gp_vertexpaint->paint;
376  return &ts->gp_sculptpaint->paint;
378  return &ts->gp_weightpaint->paint;
379  case PAINT_MODE_INVALID:
380  return NULL;
381  default:
382  return &ts->imapaint.paint;
383  }
384  }
385 
386  return NULL;
387 }
388 
390 {
391  switch (mode) {
392  case PAINT_MODE_SCULPT:
394  case PAINT_MODE_VERTEX:
396  case PAINT_MODE_WEIGHT:
403  case PAINT_MODE_GPENCIL:
411  case PAINT_MODE_INVALID:
412  break;
413  }
414  return NULL;
415 }
416 
418 {
419  switch (mode) {
420  case PAINT_MODE_SCULPT:
421  return "sculpt_tool";
422  case PAINT_MODE_VERTEX:
423  return "vertex_tool";
424  case PAINT_MODE_WEIGHT:
425  return "weight_tool";
428  return "image_tool";
430  return "uv_sculpt_tool";
431  case PAINT_MODE_GPENCIL:
432  return "gpencil_tool";
434  return "gpencil_vertex_tool";
436  return "gpencil_sculpt_tool";
438  return "gpencil_weight_tool";
439  case PAINT_MODE_INVALID:
440  break;
441  }
442 
443  /* Invalid paint mode. */
444  return NULL;
445 }
446 
448 {
449  if (sce && view_layer) {
450  ToolSettings *ts = sce->toolsettings;
451 
452  if (view_layer->basact && view_layer->basact->object) {
453  switch (view_layer->basact->object->mode) {
454  case OB_MODE_SCULPT:
455  return &ts->sculpt->paint;
457  return &ts->vpaint->paint;
459  return &ts->wpaint->paint;
461  return &ts->imapaint.paint;
463  return &ts->gp_paint->paint;
465  return &ts->gp_vertexpaint->paint;
467  return &ts->gp_sculptpaint->paint;
469  return &ts->gp_weightpaint->paint;
470  case OB_MODE_EDIT:
471  return ts->uvsculpt ? &ts->uvsculpt->paint : NULL;
472  default:
473  break;
474  }
475  }
476 
477  /* default to image paint */
478  return &ts->imapaint.paint;
479  }
480 
481  return NULL;
482 }
483 
485 {
486  Scene *sce = CTX_data_scene(C);
487  ViewLayer *view_layer = CTX_data_view_layer(C);
488  SpaceImage *sima;
489 
490  if (sce && view_layer) {
491  ToolSettings *ts = sce->toolsettings;
492  Object *obact = NULL;
493 
494  if (view_layer->basact && view_layer->basact->object) {
495  obact = view_layer->basact->object;
496  }
497 
498  if ((sima = CTX_wm_space_image(C)) != NULL) {
499  if (obact && obact->mode == OB_MODE_EDIT) {
500  if (sima->mode == SI_MODE_PAINT) {
501  return &ts->imapaint.paint;
502  }
503  if (sima->mode == SI_MODE_UV) {
504  return &ts->uvsculpt->paint;
505  }
506  }
507  else {
508  return &ts->imapaint.paint;
509  }
510  }
511  else {
512  return BKE_paint_get_active(sce, view_layer);
513  }
514  }
515 
516  return NULL;
517 }
518 
520 {
521  Scene *sce = CTX_data_scene(C);
522  ViewLayer *view_layer = CTX_data_view_layer(C);
523  SpaceImage *sima;
524 
525  if (sce && view_layer) {
526  Object *obact = NULL;
527 
528  if (view_layer->basact && view_layer->basact->object) {
529  obact = view_layer->basact->object;
530  }
531 
532  if ((sima = CTX_wm_space_image(C)) != NULL) {
533  if (obact && obact->mode == OB_MODE_EDIT) {
534  if (sima->mode == SI_MODE_PAINT) {
535  return PAINT_MODE_TEXTURE_2D;
536  }
537  if (sima->mode == SI_MODE_UV) {
538  return PAINT_MODE_SCULPT_UV;
539  }
540  }
541  else {
542  return PAINT_MODE_TEXTURE_2D;
543  }
544  }
545  else if (obact) {
546  switch (obact->mode) {
547  case OB_MODE_SCULPT:
548  return PAINT_MODE_SCULPT;
550  return PAINT_MODE_VERTEX;
552  return PAINT_MODE_WEIGHT;
554  return PAINT_MODE_TEXTURE_3D;
555  case OB_MODE_EDIT:
556  return PAINT_MODE_SCULPT_UV;
557  default:
558  return PAINT_MODE_TEXTURE_2D;
559  }
560  }
561  else {
562  /* default to image paint */
563  return PAINT_MODE_TEXTURE_2D;
564  }
565  }
566 
567  return PAINT_MODE_INVALID;
568 }
569 
571 {
572  if (tref->space_type == SPACE_VIEW3D) {
573  switch (tref->mode) {
574  case CTX_MODE_SCULPT:
575  return PAINT_MODE_SCULPT;
577  return PAINT_MODE_VERTEX;
579  return PAINT_MODE_WEIGHT;
581  return PAINT_MODE_GPENCIL;
583  return PAINT_MODE_TEXTURE_3D;
590  }
591  }
592  else if (tref->space_type == SPACE_IMAGE) {
593  switch (tref->mode) {
594  case SI_MODE_PAINT:
595  return PAINT_MODE_TEXTURE_2D;
596  case SI_MODE_UV:
597  return PAINT_MODE_SCULPT_UV;
598  }
599  }
600 
601  return PAINT_MODE_INVALID;
602 }
603 
605 {
606  return p ? p->brush : NULL;
607 }
608 
610 {
611  if (p) {
612  id_us_min((ID *)p->brush);
613  id_us_plus((ID *)br);
614  p->brush = br;
615 
617  }
618 }
619 
621 {
622  if (paint == &ts->imapaint.paint) {
623  paint->runtime.tool_offset = offsetof(Brush, imagepaint_tool);
625  }
626  else if (ts->sculpt && paint == &ts->sculpt->paint) {
627  paint->runtime.tool_offset = offsetof(Brush, sculpt_tool);
628  paint->runtime.ob_mode = OB_MODE_SCULPT;
629  }
630  else if (ts->vpaint && paint == &ts->vpaint->paint) {
631  paint->runtime.tool_offset = offsetof(Brush, vertexpaint_tool);
633  }
634  else if (ts->wpaint && paint == &ts->wpaint->paint) {
635  paint->runtime.tool_offset = offsetof(Brush, weightpaint_tool);
637  }
638  else if (ts->uvsculpt && paint == &ts->uvsculpt->paint) {
639  paint->runtime.tool_offset = offsetof(Brush, uv_sculpt_tool);
640  paint->runtime.ob_mode = OB_MODE_EDIT;
641  }
642  else if (ts->gp_paint && paint == &ts->gp_paint->paint) {
643  paint->runtime.tool_offset = offsetof(Brush, gpencil_tool);
645  }
646  else if (ts->gp_vertexpaint && paint == &ts->gp_vertexpaint->paint) {
647  paint->runtime.tool_offset = offsetof(Brush, gpencil_vertex_tool);
649  }
650  else if (ts->gp_sculptpaint && paint == &ts->gp_sculptpaint->paint) {
651  paint->runtime.tool_offset = offsetof(Brush, gpencil_sculpt_tool);
653  }
654  else if (ts->gp_weightpaint && paint == &ts->gp_weightpaint->paint) {
655  paint->runtime.tool_offset = offsetof(Brush, gpencil_weight_tool);
657  }
658  else {
660  }
661 }
662 
664 {
665  switch (mode) {
668  return offsetof(Brush, imagepaint_tool);
669  case PAINT_MODE_SCULPT:
670  return offsetof(Brush, sculpt_tool);
671  case PAINT_MODE_VERTEX:
672  return offsetof(Brush, vertexpaint_tool);
673  case PAINT_MODE_WEIGHT:
674  return offsetof(Brush, weightpaint_tool);
676  return offsetof(Brush, uv_sculpt_tool);
677  case PAINT_MODE_GPENCIL:
678  return offsetof(Brush, gpencil_tool);
680  return offsetof(Brush, gpencil_vertex_tool);
682  return offsetof(Brush, gpencil_sculpt_tool);
684  return offsetof(Brush, gpencil_weight_tool);
685  case PAINT_MODE_INVALID:
686  break; /* We don't use these yet. */
687  }
688  return 0;
689 }
690 
691 PaintCurve *BKE_paint_curve_add(Main *bmain, const char *name)
692 {
693  PaintCurve *pc;
694 
695  pc = BKE_id_new(bmain, ID_PC, name);
696 
697  return pc;
698 }
699 
701 {
702  return p ? p->palette : NULL;
703 }
704 
706 {
707  if (p) {
708  id_us_min((ID *)p->palette);
709  p->palette = palette;
710  id_us_plus((ID *)p->palette);
711  }
712 }
713 
715 {
716  if (br) {
717  id_us_min((ID *)br->paint_curve);
718  br->paint_curve = pc;
719  id_us_plus((ID *)br->paint_curve);
720  }
721 }
722 
724 {
725  pc->add_index = (add_index || pc->tot_points == 1) ? (add_index + 1) : 0;
726 }
727 
730 {
731  if (BLI_listbase_count_at_most(&palette->colors, palette->active_color) ==
732  palette->active_color) {
733  palette->active_color--;
734  }
735 
736  BLI_remlink(&palette->colors, color);
737 
738  if (palette->active_color < 0 && !BLI_listbase_is_empty(&palette->colors)) {
739  palette->active_color = 0;
740  }
741 
742  MEM_freeN(color);
743 }
744 
746 {
747  BLI_freelistN(&palette->colors);
748  palette->active_color = 0;
749 }
750 
751 Palette *BKE_palette_add(Main *bmain, const char *name)
752 {
753  Palette *palette = BKE_id_new(bmain, ID_PAL, name);
754  return palette;
755 }
756 
758 {
759  PaletteColor *color = MEM_callocN(sizeof(*color), "Palette Color");
760  BLI_addtail(&palette->colors, color);
761  return color;
762 }
763 
764 bool BKE_palette_is_empty(const struct Palette *palette)
765 {
766  return BLI_listbase_is_empty(&palette->colors);
767 }
768 
769 /* helper function to sort using qsort */
770 static int palettecolor_compare_hsv(const void *a1, const void *a2)
771 {
772  const tPaletteColorHSV *ps1 = a1, *ps2 = a2;
773 
774  /* Hue */
775  if (ps1->h > ps2->h) {
776  return 1;
777  }
778  if (ps1->h < ps2->h) {
779  return -1;
780  }
781 
782  /* Saturation. */
783  if (ps1->s > ps2->s) {
784  return 1;
785  }
786  if (ps1->s < ps2->s) {
787  return -1;
788  }
789 
790  /* Value. */
791  if (1.0f - ps1->v > 1.0f - ps2->v) {
792  return 1;
793  }
794  if (1.0f - ps1->v < 1.0f - ps2->v) {
795  return -1;
796  }
797 
798  return 0;
799 }
800 
801 /* helper function to sort using qsort */
802 static int palettecolor_compare_svh(const void *a1, const void *a2)
803 {
804  const tPaletteColorHSV *ps1 = a1, *ps2 = a2;
805 
806  /* Saturation. */
807  if (ps1->s > ps2->s) {
808  return 1;
809  }
810  if (ps1->s < ps2->s) {
811  return -1;
812  }
813 
814  /* Value. */
815  if (1.0f - ps1->v > 1.0f - ps2->v) {
816  return 1;
817  }
818  if (1.0f - ps1->v < 1.0f - ps2->v) {
819  return -1;
820  }
821 
822  /* Hue */
823  if (ps1->h > ps2->h) {
824  return 1;
825  }
826  if (ps1->h < ps2->h) {
827  return -1;
828  }
829 
830  return 0;
831 }
832 
833 static int palettecolor_compare_vhs(const void *a1, const void *a2)
834 {
835  const tPaletteColorHSV *ps1 = a1, *ps2 = a2;
836 
837  /* Value. */
838  if (1.0f - ps1->v > 1.0f - ps2->v) {
839  return 1;
840  }
841  if (1.0f - ps1->v < 1.0f - ps2->v) {
842  return -1;
843  }
844 
845  /* Hue */
846  if (ps1->h > ps2->h) {
847  return 1;
848  }
849  if (ps1->h < ps2->h) {
850  return -1;
851  }
852 
853  /* Saturation. */
854  if (ps1->s > ps2->s) {
855  return 1;
856  }
857  if (ps1->s < ps2->s) {
858  return -1;
859  }
860 
861  return 0;
862 }
863 
864 static int palettecolor_compare_luminance(const void *a1, const void *a2)
865 {
866  const tPaletteColorHSV *ps1 = a1, *ps2 = a2;
867 
868  float lumi1 = (ps1->rgb[0] + ps1->rgb[1] + ps1->rgb[2]) / 3.0f;
869  float lumi2 = (ps2->rgb[0] + ps2->rgb[1] + ps2->rgb[2]) / 3.0f;
870 
871  if (lumi1 > lumi2) {
872  return -1;
873  }
874  if (lumi1 < lumi2) {
875  return 1;
876  }
877 
878  return 0;
879 }
880 
881 void BKE_palette_sort_hsv(tPaletteColorHSV *color_array, const int totcol)
882 {
883  /* Sort by Hue , Saturation and Value. */
884  qsort(color_array, totcol, sizeof(tPaletteColorHSV), palettecolor_compare_hsv);
885 }
886 
887 void BKE_palette_sort_svh(tPaletteColorHSV *color_array, const int totcol)
888 {
889  /* Sort by Saturation, Value and Hue. */
890  qsort(color_array, totcol, sizeof(tPaletteColorHSV), palettecolor_compare_svh);
891 }
892 
893 void BKE_palette_sort_vhs(tPaletteColorHSV *color_array, const int totcol)
894 {
895  /* Sort by Saturation, Value and Hue. */
896  qsort(color_array, totcol, sizeof(tPaletteColorHSV), palettecolor_compare_vhs);
897 }
898 
899 void BKE_palette_sort_luminance(tPaletteColorHSV *color_array, const int totcol)
900 {
901  /* Sort by Luminance (calculated with the average, enough for sorting). */
902  qsort(color_array, totcol, sizeof(tPaletteColorHSV), palettecolor_compare_luminance);
903 }
904 
905 bool BKE_palette_from_hash(Main *bmain, GHash *color_table, const char *name, const bool linear)
906 {
907  tPaletteColorHSV *color_array = NULL;
908  tPaletteColorHSV *col_elm = NULL;
909  bool done = false;
910 
911  const int totpal = BLI_ghash_len(color_table);
912 
913  if (totpal > 0) {
914  color_array = MEM_calloc_arrayN(totpal, sizeof(tPaletteColorHSV), __func__);
915  /* Put all colors in an array. */
916  GHashIterator gh_iter;
917  int t = 0;
918  GHASH_ITER (gh_iter, color_table) {
920  float r, g, b;
921  float h, s, v;
922  cpack_to_rgb(col, &r, &g, &b);
923  rgb_to_hsv(r, g, b, &h, &s, &v);
924 
925  col_elm = &color_array[t];
926  col_elm->rgb[0] = r;
927  col_elm->rgb[1] = g;
928  col_elm->rgb[2] = b;
929  col_elm->h = h;
930  col_elm->s = s;
931  col_elm->v = v;
932  t++;
933  }
934  }
935 
936  /* Create the Palette. */
937  if (totpal > 0) {
938  /* Sort by Hue and saturation. */
939  BKE_palette_sort_hsv(color_array, totpal);
940 
941  Palette *palette = BKE_palette_add(bmain, name);
942  if (palette) {
943  for (int i = 0; i < totpal; i++) {
944  col_elm = &color_array[i];
945  PaletteColor *palcol = BKE_palette_color_add(palette);
946  if (palcol) {
947  copy_v3_v3(palcol->rgb, col_elm->rgb);
948  if (linear) {
949  linearrgb_to_srgb_v3_v3(palcol->rgb, palcol->rgb);
950  }
951  }
952  }
953  done = true;
954  }
955  }
956  else {
957  done = false;
958  }
959 
960  if (totpal > 0) {
961  MEM_SAFE_FREE(color_array);
962  }
963 
964  return done;
965 }
966 
967 /* are we in vertex paint or weight paint face select mode? */
969 {
970  return ((ob != NULL) && (ob->type == OB_MESH) && (ob->data != NULL) &&
971  (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) &&
973 }
974 
975 /* are we in weight paint vertex select mode? */
977 {
978  return ((ob != NULL) && (ob->type == OB_MESH) && (ob->data != NULL) &&
979  (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_VERT_SEL) &&
981 }
982 
988 {
990 }
991 
993 {
994  CurveMapping *cumap = NULL;
995  CurveMap *cuma = NULL;
996 
997  if (!p->cavity_curve) {
998  p->cavity_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
999  }
1000  cumap = p->cavity_curve;
1001  cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
1002  cumap->preset = preset;
1003 
1004  cuma = cumap->cm;
1005  BKE_curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
1006  BKE_curvemapping_changed(cumap, false);
1007 }
1008 
1010 {
1011  switch (mode) {
1012  case PAINT_MODE_SCULPT:
1013  return OB_MODE_SCULPT;
1014  case PAINT_MODE_VERTEX:
1015  return OB_MODE_VERTEX_PAINT;
1016  case PAINT_MODE_WEIGHT:
1017  return OB_MODE_WEIGHT_PAINT;
1018  case PAINT_MODE_TEXTURE_2D:
1019  case PAINT_MODE_TEXTURE_3D:
1020  return OB_MODE_TEXTURE_PAINT;
1021  case PAINT_MODE_SCULPT_UV:
1022  return OB_MODE_EDIT;
1023  case PAINT_MODE_INVALID:
1024  default:
1025  return 0;
1026  }
1027 }
1028 
1032 bool BKE_paint_ensure(ToolSettings *ts, struct Paint **r_paint)
1033 {
1034  Paint *paint = NULL;
1035  if (*r_paint) {
1036  /* Tool offset should never be 0 for initialized paint settings, so it's a reliable way to
1037  * check if already initialized. */
1038  if ((*r_paint)->runtime.tool_offset == 0) {
1039  /* Currently only image painting is initialized this way, others have to be allocated. */
1040  BLI_assert(ELEM(*r_paint, (Paint *)&ts->imapaint));
1041 
1042  BKE_paint_runtime_init(ts, *r_paint);
1043  }
1044  else {
1045  BLI_assert(ELEM(*r_paint,
1046  /* Cast is annoying, but prevent NULL-pointer access. */
1047  (Paint *)ts->gp_paint,
1048  (Paint *)ts->gp_vertexpaint,
1049  (Paint *)ts->gp_sculptpaint,
1050  (Paint *)ts->gp_weightpaint,
1051  (Paint *)ts->sculpt,
1052  (Paint *)ts->vpaint,
1053  (Paint *)ts->wpaint,
1054  (Paint *)ts->uvsculpt,
1055  (Paint *)&ts->imapaint));
1056 #ifdef DEBUG
1057  struct Paint paint_test = **r_paint;
1058  BKE_paint_runtime_init(ts, *r_paint);
1059  /* Swap so debug doesn't hide errors when release fails. */
1060  SWAP(Paint, **r_paint, paint_test);
1061  BLI_assert(paint_test.runtime.ob_mode == (*r_paint)->runtime.ob_mode);
1062  BLI_assert(paint_test.runtime.tool_offset == (*r_paint)->runtime.tool_offset);
1063 #endif
1064  }
1065  return true;
1066  }
1067 
1068  if (((VPaint **)r_paint == &ts->vpaint) || ((VPaint **)r_paint == &ts->wpaint)) {
1069  VPaint *data = MEM_callocN(sizeof(*data), __func__);
1070  paint = &data->paint;
1071  }
1072  else if ((Sculpt **)r_paint == &ts->sculpt) {
1073  Sculpt *data = MEM_callocN(sizeof(*data), __func__);
1074  paint = &data->paint;
1075 
1076  /* Turn on X plane mirror symmetry by default */
1077  paint->symmetry_flags |= PAINT_SYMM_X;
1078 
1079  /* Make sure at least dyntopo subdivision is enabled */
1081  }
1082  else if ((GpPaint **)r_paint == &ts->gp_paint) {
1083  GpPaint *data = MEM_callocN(sizeof(*data), __func__);
1084  paint = &data->paint;
1085  }
1086  else if ((GpVertexPaint **)r_paint == &ts->gp_vertexpaint) {
1087  GpVertexPaint *data = MEM_callocN(sizeof(*data), __func__);
1088  paint = &data->paint;
1089  }
1090  else if ((GpSculptPaint **)r_paint == &ts->gp_sculptpaint) {
1091  GpSculptPaint *data = MEM_callocN(sizeof(*data), __func__);
1092  paint = &data->paint;
1093  }
1094  else if ((GpWeightPaint **)r_paint == &ts->gp_weightpaint) {
1095  GpWeightPaint *data = MEM_callocN(sizeof(*data), __func__);
1096  paint = &data->paint;
1097  }
1098  else if ((UvSculpt **)r_paint == &ts->uvsculpt) {
1099  UvSculpt *data = MEM_callocN(sizeof(*data), __func__);
1100  paint = &data->paint;
1101  }
1102  else if (*r_paint == &ts->imapaint.paint) {
1103  paint = &ts->imapaint.paint;
1104  }
1105 
1106  paint->flags |= PAINT_SHOW_BRUSH;
1107 
1108  *r_paint = paint;
1109 
1110  BKE_paint_runtime_init(ts, paint);
1111 
1112  return false;
1113 }
1114 
1115 void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
1116 {
1118  Paint *paint = BKE_paint_get_active_from_paintmode(sce, mode);
1119 
1121 
1122  /* If there's no brush, create one */
1123  if (PAINT_MODE_HAS_BRUSH(mode)) {
1124  Brush *brush = BKE_paint_brush(paint);
1125  if (brush == NULL) {
1127  brush = BKE_brush_first_search(bmain, ob_mode);
1128  if (!brush) {
1129  brush = BKE_brush_add(bmain, "Brush", ob_mode);
1130  id_us_min(&brush->id); /* fake user only */
1131  }
1132  BKE_paint_brush_set(paint, brush);
1133  }
1134  }
1135 
1136  memcpy(paint->paint_cursor_col, col, 3);
1137  paint->paint_cursor_col[3] = 128;
1138  ups->last_stroke_valid = false;
1140  ups->average_stroke_counter = 0;
1141  if (!paint->cavity_curve) {
1143  }
1144 }
1145 
1146 void BKE_paint_free(Paint *paint)
1147 {
1149  MEM_SAFE_FREE(paint->tool_slots);
1150 }
1151 
1152 /* called when copying scene settings, so even if 'src' and 'tar' are the same
1153  * still do a id_us_plus(), rather than if we were copying between 2 existing
1154  * scenes where a matching value should decrease the existing user count as
1155  * with paint_brush_set() */
1156 void BKE_paint_copy(Paint *src, Paint *tar, const int flag)
1157 {
1158  tar->brush = src->brush;
1160  tar->tool_slots = MEM_dupallocN(src->tool_slots);
1161 
1162  if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
1163  id_us_plus((ID *)tar->brush);
1164  id_us_plus((ID *)tar->palette);
1165  if (src->tool_slots != NULL) {
1166  for (int i = 0; i < tar->tool_slots_len; i++) {
1167  id_us_plus((ID *)tar->tool_slots[i].brush);
1168  }
1169  }
1170  }
1171 }
1172 
1173 void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3])
1174 {
1176  if (ups->last_stroke_valid && ups->average_stroke_counter > 0) {
1177  float fac = 1.0f / ups->average_stroke_counter;
1178  mul_v3_v3fl(stroke, ups->average_stroke_accum, fac);
1179  }
1180  else {
1181  copy_v3_v3(stroke, ob->obmat[3]);
1182  }
1183 }
1184 
1186 {
1187  if (p->cavity_curve) {
1189  }
1191 }
1192 
1194 {
1195  if (p->num_input_samples < 1) {
1196  p->num_input_samples = 1;
1197  }
1198 
1199  BLO_read_data_address(reader, &p->cavity_curve);
1200  if (p->cavity_curve) {
1202  }
1203  else {
1205  }
1206 
1207  BLO_read_data_address(reader, &p->tool_slots);
1208 
1209  /* Workaround for invalid data written in older versions. */
1210  const size_t expected_size = sizeof(PaintToolSlot) * p->tool_slots_len;
1211  if (p->tool_slots && MEM_allocN_len(p->tool_slots) < expected_size) {
1212  MEM_freeN(p->tool_slots);
1213  p->tool_slots = MEM_callocN(expected_size, "PaintToolSlot");
1214  }
1215 
1217 }
1218 
1220 {
1221  if (p) {
1222  BLO_read_id_address(reader, sce->id.lib, &p->brush);
1223  for (int i = 0; i < p->tool_slots_len; i++) {
1224  if (p->tool_slots[i].brush != NULL) {
1225  BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush);
1226  }
1227  }
1228  BLO_read_id_address(reader, sce->id.lib, &p->palette);
1229  p->paint_cursor = NULL;
1230 
1232  }
1233 }
1234 
1235 /* returns non-zero if any of the face's vertices
1236  * are hidden, zero otherwise */
1237 bool paint_is_face_hidden(const MLoopTri *lt, const MVert *mvert, const MLoop *mloop)
1238 {
1239  return ((mvert[mloop[lt->tri[0]].v].flag & ME_HIDE) ||
1240  (mvert[mloop[lt->tri[1]].v].flag & ME_HIDE) ||
1241  (mvert[mloop[lt->tri[2]].v].flag & ME_HIDE));
1242 }
1243 
1244 /* returns non-zero if any of the corners of the grid
1245  * face whose inner corner is at (x, y) are hidden,
1246  * zero otherwise */
1247 bool paint_is_grid_face_hidden(const uint *grid_hidden, int gridsize, int x, int y)
1248 {
1249  /* skip face if any of its corners are hidden */
1250  return (BLI_BITMAP_TEST(grid_hidden, y * gridsize + x) ||
1251  BLI_BITMAP_TEST(grid_hidden, y * gridsize + x + 1) ||
1252  BLI_BITMAP_TEST(grid_hidden, (y + 1) * gridsize + x + 1) ||
1253  BLI_BITMAP_TEST(grid_hidden, (y + 1) * gridsize + x));
1254 }
1255 
1256 /* Return true if all vertices in the face are visible, false otherwise */
1258 {
1259  BMLoop *l_iter;
1260  BMLoop *l_first;
1261 
1262  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
1263  do {
1264  if (BM_elem_flag_test(l_iter->v, BM_ELEM_HIDDEN)) {
1265  return true;
1266  }
1267  } while ((l_iter = l_iter->next) != l_first);
1268 
1269  return false;
1270 }
1271 
1273 {
1274  int factor = BKE_ccg_factor(level, gpm->level);
1275  int gridsize = BKE_ccg_gridsize(gpm->level);
1276 
1277  return gpm->data[(y * factor) * gridsize + (x * factor)];
1278 }
1279 
1280 /* threshold to move before updating the brush rotation */
1281 #define RAKE_THRESHHOLD 20
1282 
1284 {
1286  ups->brush_rotation = rotation;
1287  }
1288  else {
1289  ups->brush_rotation = 0.0f;
1290  }
1291 
1293  ups->brush_rotation_sec = rotation;
1294  }
1295  else {
1296  ups->brush_rotation_sec = 0.0f;
1297  }
1298 }
1299 
1301  Brush *brush,
1302  const float mouse_pos[2])
1303 {
1304  bool ok = false;
1307  const float r = RAKE_THRESHHOLD;
1308  float rotation;
1309 
1310  float dpos[2];
1311  sub_v2_v2v2(dpos, ups->last_rake, mouse_pos);
1312 
1313  if (len_squared_v2(dpos) >= r * r) {
1314  rotation = atan2f(dpos[0], dpos[1]);
1315 
1316  copy_v2_v2(ups->last_rake, mouse_pos);
1317 
1318  ups->last_rake_angle = rotation;
1319 
1320  paint_update_brush_rake_rotation(ups, brush, rotation);
1321  ok = true;
1322  }
1323  /* make sure we reset here to the last rotation to avoid accumulating
1324  * values in case a random rotation is also added */
1325  else {
1327  ok = false;
1328  }
1329  }
1330  else {
1331  ups->brush_rotation = ups->brush_rotation_sec = 0.0f;
1332  ok = true;
1333  }
1334  return ok;
1335 }
1336 
1338 {
1339  MEM_SAFE_FREE(ss->orig_cos);
1342 }
1343 
1345 {
1346  struct SculptVertexPaintGeomMap *gmap = NULL;
1347  if (ss->mode_type == OB_MODE_VERTEX_PAINT) {
1348  gmap = &ss->mode.vpaint.gmap;
1349 
1350  MEM_SAFE_FREE(ss->mode.vpaint.previous_color);
1351  }
1352  else if (ss->mode_type == OB_MODE_WEIGHT_PAINT) {
1353  gmap = &ss->mode.wpaint.gmap;
1354 
1355  MEM_SAFE_FREE(ss->mode.wpaint.alpha_weight);
1356  if (ss->mode.wpaint.dvert_prev) {
1357  BKE_defvert_array_free_elems(ss->mode.wpaint.dvert_prev, ss->totvert);
1358  MEM_freeN(ss->mode.wpaint.dvert_prev);
1359  ss->mode.wpaint.dvert_prev = NULL;
1360  }
1361  }
1362  else {
1363  return;
1364  }
1365  MEM_SAFE_FREE(gmap->vert_to_loop);
1366  MEM_SAFE_FREE(gmap->vert_map_mem);
1367  MEM_SAFE_FREE(gmap->vert_to_poly);
1368  MEM_SAFE_FREE(gmap->poly_map_mem);
1369 }
1370 
1374 static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
1375 {
1376  SculptSession *ss = ob->sculpt;
1377 
1378  if (ss->bm) {
1379  if (ob->data) {
1380  BMIter iter;
1381  BMFace *efa;
1382  BM_ITER_MESH (efa, &iter, ss->bm, BM_FACES_OF_MESH) {
1384  }
1385  if (reorder) {
1387  }
1389  ss->bm,
1390  ob->data,
1391  (&(struct BMeshToMeshParams){
1392  .calc_object_remap = false,
1393  }));
1394  }
1395  }
1396 }
1397 
1398 void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
1399 {
1400  if (ob && ob->sculpt) {
1402 
1403  /* Ensure the objects evaluated mesh doesn't hold onto arrays
1404  * now realloc'd in the mesh T34473. */
1406  }
1407 }
1408 
1409 static void sculptsession_free_pbvh(Object *object)
1410 {
1411  SculptSession *ss = object->sculpt;
1412 
1413  if (!ss) {
1414  return;
1415  }
1416 
1417  if (ss->pbvh) {
1418  BKE_pbvh_free(ss->pbvh);
1419  ss->pbvh = NULL;
1420  }
1421 
1422  MEM_SAFE_FREE(ss->pmap);
1423  MEM_SAFE_FREE(ss->pmap_mem);
1424 
1425  MEM_SAFE_FREE(ss->epmap);
1426  MEM_SAFE_FREE(ss->epmap_mem);
1427 
1428  MEM_SAFE_FREE(ss->vemap);
1429  MEM_SAFE_FREE(ss->vemap_mem);
1430 
1432 
1434  ss->preview_vert_index_count = 0;
1435 
1437 
1440 
1442 }
1443 
1445 {
1446  if (object && object->sculpt) {
1447  if (object->sculpt->bm) {
1448  /* Ensure no points to old arrays are stored in DM
1449  *
1450  * Apparently, we could not use DEG_id_tag_update
1451  * here because this will lead to the while object
1452  * surface to disappear, so we'll release DM in place.
1453  */
1455 
1457 
1458  /* In contrast with sculptsession_bm_to_me no need in
1459  * DAG tag update here - derived mesh was freed and
1460  * old pointers are nowhere stored.
1461  */
1462  }
1463  }
1464 }
1465 
1467 {
1468  if (ob && ob->sculpt) {
1469  SculptSession *ss = ob->sculpt;
1470 
1471  if (ss->bm) {
1472  BKE_sculptsession_bm_to_me(ob, true);
1473  BM_mesh_free(ss->bm);
1474  }
1475 
1477 
1478  MEM_SAFE_FREE(ss->pmap);
1479  MEM_SAFE_FREE(ss->pmap_mem);
1480 
1481  MEM_SAFE_FREE(ss->epmap);
1482  MEM_SAFE_FREE(ss->epmap_mem);
1483 
1484  MEM_SAFE_FREE(ss->vemap);
1485  MEM_SAFE_FREE(ss->vemap_mem);
1486 
1487  if (ss->bm_log) {
1488  BM_log_free(ss->bm_log);
1489  }
1490 
1491  MEM_SAFE_FREE(ss->texcache);
1492 
1493  if (ss->tex_pool) {
1495  }
1496 
1497  MEM_SAFE_FREE(ss->orig_cos);
1500 
1501  if (ss->pose_ik_chain_preview) {
1502  for (int i = 0; i < ss->pose_ik_chain_preview->tot_segments; i++) {
1504  }
1507  }
1508 
1509  if (ss->boundary_preview) {
1515  }
1516 
1518 
1519  MEM_freeN(ss);
1520 
1521  ob->sculpt = NULL;
1522  }
1523 }
1524 
1525 /* Sculpt mode handles multires differently from regular meshes, but only if
1526  * it's the last modifier on the stack and it is not on the first level */
1528 {
1529  Mesh *me = (Mesh *)ob->data;
1530  ModifierData *md;
1531  VirtualModifierData virtualModifierData;
1532 
1533  if (ob->sculpt && ob->sculpt->bm) {
1534  /* can't combine multires and dynamic topology */
1535  return NULL;
1536  }
1537 
1538  if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
1539  /* multires can't work without displacement layer */
1540  return NULL;
1541  }
1542 
1543  /* Weight paint operates on original vertices, and needs to treat multires as regular modifier
1544  * to make it so that PBVH vertices are at the multires surface. */
1545  if ((ob->mode & OB_MODE_SCULPT) == 0) {
1546  return NULL;
1547  }
1548 
1549  for (md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData); md; md = md->next) {
1550  if (md->type == eModifierType_Multires) {
1552 
1554  continue;
1555  }
1556 
1557  if (mmd->sculptlvl > 0 && !(mmd->flags & eMultiresModifierFlag_UseSculptBaseMesh)) {
1558  return mmd;
1559  }
1560 
1561  return NULL;
1562  }
1563  }
1564 
1565  return NULL;
1566 }
1567 
1568 /* Checks if there are any supported deformation modifiers active */
1570 {
1571  ModifierData *md;
1572  Mesh *me = (Mesh *)ob->data;
1573  VirtualModifierData virtualModifierData;
1574 
1575  if (ob->sculpt->bm || BKE_sculpt_multires_active(scene, ob)) {
1576  return false;
1577  }
1578 
1579  /* non-locked shape keys could be handled in the same way as deformed mesh */
1580  if ((ob->shapeflag & OB_SHAPE_LOCK) == 0 && me->key && ob->shapenr) {
1581  return true;
1582  }
1583 
1584  md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData);
1585 
1586  /* exception for shape keys because we can edit those */
1587  for (; md; md = md->next) {
1588  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
1590  continue;
1591  }
1592  if (md->type == eModifierType_Multires && (ob->mode & OB_MODE_SCULPT)) {
1595  continue;
1596  }
1597  }
1598  if (md->type == eModifierType_ShapeKey) {
1599  continue;
1600  }
1601 
1602  if (mti->type == eModifierTypeType_OnlyDeform) {
1603  return true;
1604  }
1605  if ((sd->flags & SCULPT_ONLY_DEFORM) == 0) {
1606  return true;
1607  }
1608  }
1609 
1610  return false;
1611 }
1612 
1617  Object *ob,
1618  Mesh *me_eval,
1619  bool need_pmap,
1620  bool need_mask,
1621  bool UNUSED(need_colors))
1622 {
1624  Sculpt *sd = scene->toolsettings->sculpt;
1625  SculptSession *ss = ob->sculpt;
1626  const Mesh *me = BKE_object_get_original_mesh(ob);
1628  const bool use_face_sets = (ob->mode & OB_MODE_SCULPT) != 0;
1629 
1630  ss->depsgraph = depsgraph;
1631 
1633  ss->show_mask = (sd->flags & SCULPT_HIDE_MASK) == 0;
1634  ss->show_face_sets = (sd->flags & SCULPT_HIDE_FACE_SETS) == 0;
1635 
1636  ss->building_vp_handle = false;
1637 
1638  ss->scene = scene;
1639 
1640  if (need_mask) {
1641  if (mmd == NULL) {
1643  }
1644  else {
1646  }
1647  }
1648 
1649  ss->shapekey_active = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL;
1650 
1651  /* NOTE: Weight pPaint require mesh info for loop lookup, but it never uses multires code path,
1652  * so no extra checks is needed here. */
1653  if (mmd) {
1654  ss->multires.active = true;
1655  ss->multires.modifier = mmd;
1656  ss->multires.level = mmd->sculptlvl;
1657  ss->totvert = me_eval->totvert;
1658  ss->totpoly = me_eval->totpoly;
1659  ss->totfaces = me->totpoly;
1660 
1661  /* These are assigned to the base mesh in Multires. This is needed because Face Sets operators
1662  * and tools use the Face Sets data from the base mesh when Multires is active. */
1663  ss->mvert = me->mvert;
1664  ss->mpoly = me->mpoly;
1665  ss->mloop = me->mloop;
1666  }
1667  else {
1668  ss->totvert = me->totvert;
1669  ss->totpoly = me->totpoly;
1670  ss->totfaces = me->totpoly;
1671  ss->mvert = me->mvert;
1672  ss->mpoly = me->mpoly;
1673  ss->mloop = me->mloop;
1674  ss->multires.active = false;
1675  ss->multires.modifier = NULL;
1676  ss->multires.level = 0;
1677  ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
1678  ss->vcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
1679  }
1680 
1681  /* Sculpt Face Sets. */
1682  if (use_face_sets) {
1685  }
1686  else {
1687  ss->face_sets = NULL;
1688  }
1689 
1690  ss->subdiv_ccg = me_eval->runtime.subdiv_ccg;
1691 
1693  BLI_assert(pbvh == ss->pbvh);
1694  UNUSED_VARS_NDEBUG(pbvh);
1695 
1698 
1700 
1701  if (need_pmap && ob->type == OB_MESH && !ss->pmap) {
1703  &ss->pmap, &ss->pmap_mem, me->mpoly, me->mloop, me->totvert, me->totpoly, me->totloop);
1704  }
1705 
1706  pbvh_show_mask_set(ss->pbvh, ss->show_mask);
1708 
1709  if (ss->deform_modifiers_active) {
1710  if (!ss->orig_cos) {
1711  int a;
1712 
1714 
1715  ss->orig_cos = (ss->shapekey_active) ?
1718 
1721 
1722  for (a = 0; a < me->totvert; a++) {
1723  invert_m3(ss->deform_imats[a]);
1724  }
1725  }
1726  }
1727  else {
1729  }
1730 
1731  if (ss->shapekey_active != NULL && ss->deform_cos == NULL) {
1733  }
1734 
1735  /* if pbvh is deformed, key block is already applied to it */
1736  if (ss->shapekey_active) {
1737  bool pbvh_deformed = BKE_pbvh_is_deformed(ss->pbvh);
1738  if (!pbvh_deformed || ss->deform_cos == NULL) {
1739  float(*vertCos)[3] = BKE_keyblock_convert_to_vertcos(ob, ss->shapekey_active);
1740 
1741  if (vertCos) {
1742  if (!pbvh_deformed) {
1743  /* apply shape keys coordinates to PBVH */
1744  BKE_pbvh_vert_coords_apply(ss->pbvh, vertCos, me->totvert);
1745  }
1746  if (ss->deform_cos == NULL) {
1747  ss->deform_cos = vertCos;
1748  }
1749  if (vertCos != ss->deform_cos) {
1750  MEM_freeN(vertCos);
1751  }
1752  }
1753  }
1754  }
1755 }
1756 
1758 {
1759  /* Update before mesh evaluation in the dependency graph. */
1760  SculptSession *ss = ob->sculpt;
1761 
1762  if (ss && ss->building_vp_handle == false) {
1763  if (!ss->cache && !ss->filter_cache && !ss->expand_cache) {
1764  /* We free pbvh on changes, except in the middle of drawing a stroke
1765  * since it can't deal with changing PVBH node organization, we hope
1766  * topology does not change in the meantime .. weak. */
1768 
1770 
1771  /* In vertex/weight paint, force maps to be rebuilt. */
1773  }
1774  else {
1775  PBVHNode **nodes;
1776  int n, totnode;
1777 
1778  BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
1779 
1780  for (n = 0; n < totnode; n++) {
1781  BKE_pbvh_node_mark_update(nodes[n]);
1782  }
1783 
1784  MEM_freeN(nodes);
1785  }
1786  }
1787 }
1788 
1790 {
1791  /* Update after mesh evaluation in the dependency graph, to rebuild PBVH or
1792  * other data when modifiers change the mesh. */
1793  Object *ob_orig = DEG_get_original_object(ob_eval);
1794  Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval);
1795 
1796  BLI_assert(me_eval != NULL);
1797  sculpt_update_object(depsgraph, ob_orig, me_eval, false, false, false);
1798 }
1799 
1801 {
1802  Mesh *orig_me = BKE_object_get_original_mesh(object);
1803  if (!U.experimental.use_sculpt_vertex_colors) {
1804  return;
1805  }
1806 
1807  if (CustomData_has_layer(&orig_me->vdata, CD_PROP_COLOR)) {
1808  return;
1809  }
1810 
1811  CustomData_add_layer(&orig_me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, orig_me->totvert);
1812  BKE_mesh_update_customdata_pointers(orig_me, true);
1814 }
1815 
1818  Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool need_colors)
1819 {
1820  BLI_assert(ob_orig == DEG_get_original_object(ob_orig));
1821 
1822  Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob_orig);
1823  Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval);
1824  BLI_assert(me_eval != NULL);
1825 
1826  sculpt_update_object(depsgraph, ob_orig, me_eval, need_pmap, need_mask, need_colors);
1827 }
1828 
1830 {
1831  const float *paint_mask;
1832  Mesh *me = ob->data;
1833  int ret = 0;
1834 
1835  paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
1836 
1837  /* if multires is active, create a grid paint mask layer if there
1838  * isn't one already */
1839  if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
1840  GridPaintMask *gmask;
1841  int level = max_ii(1, mmd->sculptlvl);
1842  int gridsize = BKE_ccg_gridsize(level);
1843  int gridarea = gridsize * gridsize;
1844  int i, j;
1845 
1847 
1848  for (i = 0; i < me->totloop; i++) {
1849  GridPaintMask *gpm = &gmask[i];
1850 
1851  gpm->level = level;
1852  gpm->data = MEM_callocN(sizeof(float) * gridarea, "GridPaintMask.data");
1853  }
1854 
1855  /* if vertices already have mask, copy into multires data */
1856  if (paint_mask) {
1857  for (i = 0; i < me->totpoly; i++) {
1858  const MPoly *p = &me->mpoly[i];
1859  float avg = 0;
1860 
1861  /* mask center */
1862  for (j = 0; j < p->totloop; j++) {
1863  const MLoop *l = &me->mloop[p->loopstart + j];
1864  avg += paint_mask[l->v];
1865  }
1866  avg /= (float)p->totloop;
1867 
1868  /* fill in multires mask corner */
1869  for (j = 0; j < p->totloop; j++) {
1870  GridPaintMask *gpm = &gmask[p->loopstart + j];
1871  const MLoop *l = &me->mloop[p->loopstart + j];
1872  const MLoop *prev = ME_POLY_LOOP_PREV(me->mloop, p, j);
1873  const MLoop *next = ME_POLY_LOOP_NEXT(me->mloop, p, j);
1874 
1875  gpm->data[0] = avg;
1876  gpm->data[1] = (paint_mask[l->v] + paint_mask[next->v]) * 0.5f;
1877  gpm->data[2] = (paint_mask[l->v] + paint_mask[prev->v]) * 0.5f;
1878  gpm->data[3] = paint_mask[l->v];
1879  }
1880  }
1881  }
1882 
1884  }
1885 
1886  /* create vertex paint mask layer if there isn't one already */
1887  if (!paint_mask) {
1890  }
1891 
1892  return ret;
1893 }
1894 
1896 {
1898 
1899  Sculpt *sd = scene->toolsettings->sculpt;
1900  if (!sd->detail_size) {
1901  sd->detail_size = 12;
1902  }
1903  if (!sd->detail_percent) {
1904  sd->detail_percent = 25;
1905  }
1906  if (sd->constant_detail == 0.0f) {
1907  sd->constant_detail = 3.0f;
1908  }
1909 
1910  /* Set sane default tiling offsets */
1911  if (!sd->paint.tile_offset[0]) {
1912  sd->paint.tile_offset[0] = 1.0f;
1913  }
1914  if (!sd->paint.tile_offset[1]) {
1915  sd->paint.tile_offset[1] = 1.0f;
1916  }
1917  if (!sd->paint.tile_offset[2]) {
1918  sd->paint.tile_offset[2] = 1.0f;
1919  }
1920 }
1921 
1922 static bool check_sculpt_object_deformed(Object *object, const bool for_construction)
1923 {
1924  bool deformed = false;
1925 
1926  /* Active modifiers means extra deformation, which can't be handled correct
1927  * on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
1928  * stuff and show final evaluated mesh so user would see actual object shape.
1929  */
1930  deformed |= object->sculpt->deform_modifiers_active;
1931 
1932  if (for_construction) {
1933  deformed |= object->sculpt->shapekey_active != NULL;
1934  }
1935  else {
1936  /* As in case with modifiers, we can't synchronize deformation made against
1937  * PBVH and non-locked keyblock, so also use PBVH only for brushes and
1938  * final DM to give final result to user.
1939  */
1940  deformed |= object->sculpt->shapekey_active && (object->shapeflag & OB_SHAPE_LOCK) == 0;
1941  }
1942 
1943  return deformed;
1944 }
1945 
1951 {
1952  const int face_sets_default_visible_id = 1;
1953  const int face_sets_default_hidden_id = -(face_sets_default_visible_id + 1);
1954 
1955  bool initialize_new_face_sets = false;
1956 
1958  /* Make everything visible. */
1959  int *current_face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
1960  for (int i = 0; i < mesh->totpoly; i++) {
1961  current_face_sets[i] = abs(current_face_sets[i]);
1962  }
1963  }
1964  else {
1965  initialize_new_face_sets = true;
1966  int *new_face_sets = CustomData_add_layer(
1968 
1969  /* Initialize the new Face Set data-layer with a default valid visible ID and set the default
1970  * color to render it white. */
1971  for (int i = 0; i < mesh->totpoly; i++) {
1972  new_face_sets[i] = face_sets_default_visible_id;
1973  }
1974  mesh->face_sets_color_default = face_sets_default_visible_id;
1975  }
1976 
1977  int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
1978 
1979  for (int i = 0; i < mesh->totpoly; i++) {
1980  if (!(mesh->mpoly[i].flag & ME_HIDE)) {
1981  continue;
1982  }
1983 
1984  if (initialize_new_face_sets) {
1985  /* When initializing a new Face Set data-layer, assign a new hidden Face Set ID to hidden
1986  * vertices. This way, we get at initial split in two Face Sets between hidden and
1987  * visible vertices based on the previous mesh visibly from other mode that can be
1988  * useful in some cases. */
1989  face_sets[i] = face_sets_default_hidden_id;
1990  }
1991  else {
1992  /* Otherwise, set the already existing Face Set ID to hidden. */
1993  face_sets[i] = -abs(face_sets[i]);
1994  }
1995  }
1996 }
1997 
1999 {
2000  int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
2001  if (!face_sets) {
2002  return;
2003  }
2004 
2005  for (int i = 0; i < mesh->totpoly; i++) {
2006  const bool is_face_set_visible = face_sets[i] >= 0;
2007  SET_FLAG_FROM_TEST(mesh->mpoly[i].flag, !is_face_set_visible, ME_HIDE);
2008  }
2009 
2011 }
2012 
2014 {
2015  int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
2016  if (!face_sets) {
2017  return;
2018  }
2019 
2020  if (!subdiv_ccg) {
2021  return;
2022  }
2023 
2024  CCGKey key;
2025  BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
2026  for (int i = 0; i < mesh->totloop; i++) {
2027  const int face_index = BKE_subdiv_ccg_grid_to_face_index(subdiv_ccg, i);
2028  const bool is_hidden = (face_sets[face_index] < 0);
2029 
2030  /* Avoid creating and modifying the grid_hidden bitmap if the base mesh face is visible and
2031  * there is not bitmap for the grid. This is because missing grid_hidden implies grid is fully
2032  * visible. */
2033  if (is_hidden) {
2034  BKE_subdiv_ccg_grid_hidden_ensure(subdiv_ccg, i);
2035  }
2036 
2037  BLI_bitmap *gh = subdiv_ccg->grid_hidden[i];
2038  if (gh) {
2039  BLI_bitmap_set_all(gh, is_hidden, key.grid_area);
2040  }
2041  }
2042 }
2043 
2044 void BKE_sculpt_sync_face_set_visibility(struct Mesh *mesh, struct SubdivCCG *subdiv_ccg)
2045 {
2049 }
2050 
2058 {
2059  Mesh *mesh = BKE_mesh_from_object(object);
2061 
2062  BLI_assert(object->mode == OB_MODE_SCULPT);
2063 
2064  /* Copy the current mesh visibility to the Face Sets. */
2066  if (object->sculpt != NULL) {
2067  /* If a sculpt session is active, ensure we have its faceset data porperly up-to-date. */
2068  object->sculpt->face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
2069 
2070  /* Note: In theory we could add that on the fly when required by sculpt code.
2071  * But this then requires proper update of depsgraph etc. For now we play safe, optimization is
2072  * always possible later if it's worth it. */
2073  BKE_sculpt_mask_layers_ensure(object, mmd);
2074  }
2075 
2076  /* Tessfaces aren't used and will become invalid. */
2078 
2079  /* We always need to flush updates from depsgraph here, since at the very least
2080  * `BKE_sculpt_face_sets_ensure_from_base_mesh_visibility()` will have updated some data layer of
2081  * the mesh.
2082  *
2083  * All known potential sources of updates:
2084  * - Addition of, or changes to, the `CD_SCULPT_FACE_SETS` data layer
2085  * (`BKE_sculpt_face_sets_ensure_from_base_mesh_visibility`).
2086  * - Addition of a `CD_PAINT_MASK` data layer (`BKE_sculpt_mask_layers_ensure`).
2087  * - Object has any active modifier (modifier stack can be different in Sculpt mode).
2088  * - Multires:
2089  * + Differences of subdiv levels between sculpt and object modes
2090  * (`mmd->sculptlvl != mmd->lvl`).
2091  * + Addition of a `CD_GRID_PAINT_MASK` data layer (`BKE_sculpt_mask_layers_ensure`).
2092  */
2094 }
2095 
2097 {
2098  PBVH *pbvh = BKE_pbvh_new();
2099  BKE_pbvh_build_bmesh(pbvh,
2100  ob->sculpt->bm,
2102  ob->sculpt->bm_log,
2105  pbvh_show_mask_set(pbvh, ob->sculpt->show_mask);
2106  pbvh_show_face_sets_set(pbvh, false);
2107  return pbvh;
2108 }
2109 
2110 static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool respect_hide)
2111 {
2113  const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop);
2114  PBVH *pbvh = BKE_pbvh_new();
2115  BKE_pbvh_respect_hide_set(pbvh, respect_hide);
2116 
2117  MLoopTri *looptri = MEM_malloc_arrayN(looptris_num, sizeof(*looptri), __func__);
2118 
2119  BKE_mesh_recalc_looptri(me->mloop, me->mpoly, me->mvert, me->totloop, me->totpoly, looptri);
2120 
2122 
2123  BKE_pbvh_build_mesh(pbvh,
2124  me,
2125  me->mpoly,
2126  me->mloop,
2127  me->mvert,
2128  me->totvert,
2129  &me->vdata,
2130  &me->ldata,
2131  &me->pdata,
2132  looptri,
2133  looptris_num);
2134 
2135  pbvh_show_mask_set(pbvh, ob->sculpt->show_mask);
2137 
2138  const bool is_deformed = check_sculpt_object_deformed(ob, true);
2139  if (is_deformed && me_eval_deform != NULL) {
2140  int totvert;
2141  float(*v_cos)[3] = BKE_mesh_vert_coords_alloc(me_eval_deform, &totvert);
2142  BKE_pbvh_vert_coords_apply(pbvh, v_cos, totvert);
2143  MEM_freeN(v_cos);
2144  }
2145 
2146  return pbvh;
2147 }
2148 
2149 static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect_hide)
2150 {
2151  CCGKey key;
2152  BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
2153  PBVH *pbvh = BKE_pbvh_new();
2154  BKE_pbvh_respect_hide_set(pbvh, respect_hide);
2155 
2156  Mesh *base_mesh = BKE_mesh_from_object(ob);
2157  BKE_sculpt_sync_face_set_visibility(base_mesh, subdiv_ccg);
2158 
2159  BKE_pbvh_build_grids(pbvh,
2160  subdiv_ccg->grids,
2161  subdiv_ccg->num_grids,
2162  &key,
2163  (void **)subdiv_ccg->grid_faces,
2164  subdiv_ccg->grid_flag_mats,
2165  subdiv_ccg->grid_hidden);
2166  pbvh_show_mask_set(pbvh, ob->sculpt->show_mask);
2168  return pbvh;
2169 }
2170 
2172 {
2173  if (ob == NULL || ob->sculpt == NULL) {
2174  return NULL;
2175  }
2176 
2177  bool respect_hide = true;
2180  respect_hide = false;
2181  }
2182  }
2183 
2184  PBVH *pbvh = ob->sculpt->pbvh;
2185  if (pbvh != NULL) {
2186  /* NOTE: It is possible that grids were re-allocated due to modifier
2187  * stack. Need to update those pointers. */
2188  if (BKE_pbvh_type(pbvh) == PBVH_GRIDS) {
2189  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
2190  Mesh *mesh_eval = object_eval->data;
2191  SubdivCCG *subdiv_ccg = mesh_eval->runtime.subdiv_ccg;
2192  if (subdiv_ccg != NULL) {
2193  BKE_sculpt_bvh_update_from_ccg(pbvh, subdiv_ccg);
2194  }
2195  }
2196  return pbvh;
2197  }
2198 
2199  if (ob->sculpt->bm != NULL) {
2200  /* Sculpting on a BMesh (dynamic-topology) gets a special PBVH. */
2202  }
2203  else {
2204  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
2205  Mesh *mesh_eval = object_eval->data;
2206  if (mesh_eval->runtime.subdiv_ccg != NULL) {
2207  pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime.subdiv_ccg, respect_hide);
2208  }
2209  else if (ob->type == OB_MESH) {
2210  Mesh *me_eval_deform = object_eval->runtime.mesh_deform_eval;
2211  pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform, respect_hide);
2212  }
2213  }
2214 
2215  ob->sculpt->pbvh = pbvh;
2216  return pbvh;
2217 }
2218 
2220 {
2221  BKE_pbvh_grids_update(pbvh,
2222  subdiv_ccg->grids,
2223  (void **)subdiv_ccg->grid_faces,
2224  subdiv_ccg->grid_flag_mats,
2225  subdiv_ccg->grid_hidden);
2226 }
2227 
2228 /* Test if PBVH can be used directly for drawing, which is faster than
2229  * drawing the mesh and all updates that come with it. */
2230 bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
2231 {
2232  SculptSession *ss = ob->sculpt;
2233  if (ss == NULL || ss->pbvh == NULL || ss->mode_type != OB_MODE_SCULPT) {
2234  return false;
2235  }
2236 
2237  if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
2238  /* Regular mesh only draws from PBVH without modifiers and shape keys. */
2239  const bool full_shading = (v3d && (v3d->shading.type > OB_SOLID));
2240  return !(ss->shapekey_active || ss->deform_modifiers_active || full_shading);
2241  }
2242 
2243  /* Multires and dyntopo always draw directly from the PBVH. */
2244  return true;
2245 }
2246 
2247 /* Returns the Face Set random color for rendering in the overlay given its ID and a color seed. */
2248 #define GOLDEN_RATIO_CONJUGATE 0.618033988749895f
2249 void BKE_paint_face_set_overlay_color_get(const int face_set, const int seed, uchar r_color[4])
2250 {
2251  float rgba[4];
2252  float random_mod_hue = GOLDEN_RATIO_CONJUGATE * (abs(face_set) + (seed % 10));
2253  random_mod_hue = random_mod_hue - floorf(random_mod_hue);
2254  const float random_mod_sat = BLI_hash_int_01(abs(face_set) + seed + 1);
2255  const float random_mod_val = BLI_hash_int_01(abs(face_set) + seed + 2);
2256  hsv_to_rgb(random_mod_hue,
2257  0.6f + (random_mod_sat * 0.25f),
2258  1.0f - (random_mod_val * 0.35f),
2259  &rgba[0],
2260  &rgba[1],
2261  &rgba[2]);
2262  rgba_float_to_uchar(r_color, rgba);
2263 }
typedef float(TangentPoint)[2]
struct Brush * BKE_brush_add(struct Main *bmain, const char *name, const eObjectMode ob_mode)
Definition: brush.c:492
struct Brush * BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode)
Definition: brush.c:1559
struct CurveMapping * BKE_curvemapping_copy(const struct CurveMapping *cumap)
void BKE_curvemapping_blend_read(struct BlendDataReader *reader, struct CurveMapping *cumap)
Definition: colortools.c:1252
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
void BKE_curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles)
Definition: colortools.c:877
void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap)
void BKE_curvemapping_free(struct CurveMapping *cumap)
Definition: colortools.c:119
@ CURVEMAP_SLOPE_POSITIVE
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:88
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
@ CTX_MODE_PAINT_TEXTURE
Definition: BKE_context.h:126
@ CTX_MODE_WEIGHT_GPENCIL
Definition: BKE_context.h:132
@ CTX_MODE_SCULPT
Definition: BKE_context.h:123
@ CTX_MODE_VERTEX_GPENCIL
Definition: BKE_context.h:133
@ CTX_MODE_SCULPT_GPENCIL
Definition: BKE_context.h:131
@ CTX_MODE_PAINT_GPENCIL
Definition: BKE_context.h:129
@ CTX_MODE_PAINT_VERTEX
Definition: BKE_context.h:125
@ CTX_MODE_PAINT_WEIGHT
Definition: BKE_context.h:124
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:800
void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float(**deformmats)[3][3], float(**deformcos)[3])
Definition: crazyspace.c:440
@ CD_CALLOC
@ CD_DEFAULT
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_get_layer(const struct CustomData *data, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
Definition: customdata.c:2620
support for deformation groups and hooks.
void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert)
Definition: deform.c:959
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition: BKE_idtype.h:51
void BKE_image_pool_free(struct ImagePool *pool)
Definition: image.c:5181
float(* BKE_keyblock_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3]
Definition: key.c:2413
struct KeyBlock * BKE_keyblock_from_object(struct Object *ob)
Definition: key.c:1902
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void id_fake_user_set(struct ID *id)
Definition: lib_id.c:328
@ LIB_ID_CREATE_NO_USER_REFCOUNT
Definition: BKE_lib_id.h:92
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2395
void * BKE_id_new(struct Main *bmain, const short type, const char *name)
Definition: lib_id.c:1177
void BKE_lib_id_swap(struct Main *bmain, struct ID *id_a, struct ID *id_b)
Definition: lib_id.c:729
void BKE_mesh_tessface_clear(struct Mesh *mesh)
Definition: mesh.c:1567
struct Mesh * BKE_mesh_from_object(struct Object *ob)
Definition: mesh.c:1271
void BKE_mesh_recalc_looptri(const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
Definition: mesh.c:766
float(* BKE_mesh_vert_coords_alloc(const struct Mesh *mesh, int *r_vert_len))[3]
void BKE_mesh_flush_hidden_from_polys(struct Mesh *me)
void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, const struct MLoop *mloop, int totvert, int totpoly, int totloop)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:58
General operations, lookup, etc. for blender objects.
struct Mesh * BKE_object_get_original_mesh(struct Object *object)
Definition: object.c:4493
struct Mesh * BKE_object_get_evaluated_mesh(struct Object *object)
Definition: object.c:4459
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.c:1719
#define PAINT_MODE_HAS_BRUSH(mode)
Definition: BKE_paint.h:98
void BKE_paint_toolslots_brush_update(struct Paint *paint)
ePaintOverlayControlFlags
Definition: BKE_paint.h:101
@ PAINT_OVERLAY_INVALID_CURVE
Definition: BKE_paint.h:104
@ PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY
Definition: BKE_paint.h:103
@ PAINT_OVERLAY_OVERRIDE_CURSOR
Definition: BKE_paint.h:105
@ PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY
Definition: BKE_paint.h:102
@ PAINT_OVERLAY_OVERRIDE_SECONDARY
Definition: BKE_paint.h:107
@ PAINT_OVERLAY_OVERRIDE_PRIMARY
Definition: BKE_paint.h:106
#define PAINT_OVERRIDE_MASK
Definition: BKE_paint.h:110
ePaintMode
Definition: BKE_paint.h:78
@ PAINT_MODE_INVALID
Definition: BKE_paint.h:95
@ PAINT_MODE_GPENCIL
Definition: BKE_paint.h:88
@ PAINT_MODE_SCULPT_UV
Definition: BKE_paint.h:87
@ PAINT_MODE_VERTEX_GPENCIL
Definition: BKE_paint.h:90
@ PAINT_MODE_TEXTURE_3D
Definition: BKE_paint.h:84
@ PAINT_MODE_WEIGHT_GPENCIL
Definition: BKE_paint.h:92
@ PAINT_MODE_SCULPT
Definition: BKE_paint.h:79
@ PAINT_MODE_SCULPT_GPENCIL
Definition: BKE_paint.h:91
@ PAINT_MODE_WEIGHT
Definition: BKE_paint.h:82
@ PAINT_MODE_TEXTURE_2D
Definition: BKE_paint.h:86
@ PAINT_MODE_VERTEX
Definition: BKE_paint.h:81
@ SCULPT_MASK_LAYER_CALC_VERT
Definition: BKE_paint.h:655
@ SCULPT_MASK_LAYER_CALC_LOOP
Definition: BKE_paint.h:656
A BVH for high poly meshes.
void BKE_pbvh_build_grids(PBVH *pbvh, struct CCGElem **grids, int totgrid, struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden)
Definition: pbvh.c:625
void BKE_pbvh_node_mark_update(PBVHNode *node)
Definition: pbvh.c:1732
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask)
Definition: pbvh.c:3016
void BKE_pbvh_free(PBVH *pbvh)
Definition: pbvh.c:679
bool BKE_pbvh_is_deformed(struct PBVH *pbvh)
Definition: pbvh.c:2842
PBVHType BKE_pbvh_type(const PBVH *pbvh)
Definition: pbvh.c:1661
void pbvh_show_face_sets_set(PBVH *pbvh, bool show_face_sets)
Definition: pbvh.c:3021
void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, struct SubdivCCG *subdiv_ccg)
Definition: pbvh.c:3056
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default)
Definition: pbvh.c:2680
void BKE_pbvh_build_mesh(PBVH *pbvh, const struct Mesh *mesh, const struct MPoly *mpoly, const struct MLoop *mloop, struct MVert *verts, int totvert, struct CustomData *vdata, struct CustomData *ldata, struct CustomData *pdata, const struct MLoopTri *looptri, int looptri_num)
void BKE_pbvh_build_bmesh(PBVH *pbvh, struct BMesh *bm, bool smooth_shading, struct BMLog *log, const int cd_vert_node_offset, const int cd_face_node_offset)
Definition: pbvh_bmesh.c:1879
@ PBVH_GRIDS
Definition: BKE_pbvh.h:211
@ PBVH_FACES
Definition: BKE_pbvh.h:210
PBVH * BKE_pbvh_new(void)
Definition: pbvh.c:672
void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide)
Definition: pbvh.c:3066
void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float(*vertCos)[3], const int totvert)
Definition: pbvh.c:2798
void BKE_pbvh_grids_update(PBVH *pbvh, struct CCGElem **grids, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden)
Definition: pbvh.c:2764
void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets)
Definition: pbvh.c:3061
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
Definition: pbvh.c:843
void BKE_subdiv_ccg_key_top_level(struct CCGKey *key, const SubdivCCG *subdiv_ccg)
Definition: subdiv_ccg.c:677
void BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG *subdiv_ccg, int grid_index)
Definition: subdiv_ccg.c:1927
int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *subdiv_ccg, const int grid_index)
Definition: subdiv_ccg.c:1832
int BKE_ccg_gridsize(int level)
Definition: CCGSubSurf.c:37
int BKE_ccg_factor(int low_level, int high_level)
Definition: CCGSubSurf.c:42
#define BLI_assert_unreachable()
Definition: BLI_assert.h:96
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define BLI_BITMAP_TEST(_bitmap, _index)
Definition: BLI_bitmap.h:63
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
Definition: bitmap.c:33
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:32
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.h:150
#define GHASH_ITER(gh_iter_, ghash_)
Definition: BLI_ghash.h:169
unsigned int BLI_ghash_len(GHash *gh) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:744
BLI_INLINE float BLI_hash_int_01(unsigned int k)
Definition: BLI_hash.h:108
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
MINLINE int max_ii(int a, int b)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
Definition: math_color.c:229
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
Definition: math_color.c:31
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
Definition: math_color.c:427
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void cpack_to_rgb(unsigned int col, float *r_r, float *r_g, float *r_b)
Definition: math_color.c:400
MINLINE int poly_to_tri_count(const int poly_count, const int corner_count)
bool invert_m3(float R[3][3])
Definition: math_matrix.c:1152
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define SWAP(type, a, b)
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_list(BlendDataReader *reader, struct ListBase *list)
Definition: readfile.c:5654
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
bool BLO_write_is_undo(BlendWriter *writer)
Definition: writefile.c:1412
#define BLT_I18NCONTEXT_ID_PALETTE
#define BLT_I18NCONTEXT_ID_PAINTCURVE
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_id_tag_update(struct ID *id, int flag)
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
struct Object * DEG_get_original_object(struct Object *object)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
#define FILTER_ID_PC
Definition: DNA_ID.h:724
#define FILTER_ID_PAL
Definition: DNA_ID.h:723
@ INDEX_ID_PC
Definition: DNA_ID.h:846
@ INDEX_ID_PAL
Definition: DNA_ID.h:845
@ ID_PAL
Definition: DNA_ID_enums.h:88
@ ID_PC
Definition: DNA_ID_enums.h:89
eOverlayFlags
@ BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE
@ BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE
@ BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE
#define BRUSH_OVERLAY_OVERRIDE_MASK
struct PaintCurve PaintCurve
struct Palette Palette
@ CUMA_EXTEND_EXTRAPOLATE
@ CURVE_PRESET_LINE
@ CD_PAINT_MASK
@ CD_PROP_COLOR
@ CD_SCULPT_FACE_SETS
@ CD_GRID_PAINT_MASK
@ ME_EDIT_PAINT_VERT_SEL
@ ME_EDIT_PAINT_FACE_SEL
@ ME_HIDE
#define ME_POLY_LOOP_PREV(mloop, mp, i)
#define ME_POLY_LOOP_NEXT(mloop, mp, i)
@ eMultiresModifierFlag_UseSculptBaseMesh
@ eModifierMode_Realtime
@ eModifierType_ShapeKey
@ eModifierType_Multires
@ OB_SOLID
eObjectMode
@ OB_MODE_VERTEX_GPENCIL
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_WEIGHT_GPENCIL
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_GPENCIL
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_VERTEX_PAINT
@ OB_MODE_PAINT_GPENCIL
Object is a sort of wrapper for general info.
@ OB_SHAPE_LOCK
@ OB_MESH
@ SCULPT_HIDE_MASK
@ SCULPT_ONLY_DEFORM
@ SCULPT_DYNTOPO_SUBDIVIDE
@ SCULPT_HIDE_FACE_SETS
@ SCULPT_DYNTOPO_COLLAPSE
struct PaintToolSlot PaintToolSlot
@ PAINT_SHOW_BRUSH
@ PAINT_SYMM_X
@ SPACE_IMAGE
@ SPACE_VIEW3D
@ SI_MODE_PAINT
@ SI_MODE_UV
#define MTEX_ANGLE_RAKE
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
static void init_data(ModifierData *md)
#define C
Definition: RandGen.cpp:39
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
@ BM_ELEM_SMOOTH
Definition: bmesh_class.h:477
#define BM_FACE_FIRST_LOOP(p)
Definition: bmesh_class.h:553
#define BM_elem_flag_set(ele, hflag, val)
Definition: bmesh_inline.h:30
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:26
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_FACES_OF_MESH
void BM_log_free(BMLog *log)
Definition: bmesh_log.c:559
void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:591
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
Definition: bmesh_mesh.c:307
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int U
Definition: btGjkEpa3.h:78
static unsigned long seed
Definition: btSoftBody.h:39
Scene scene
Curve curve
const Depsgraph * depsgraph
uint col
#define atan2f(x, y)
#define floorf(x)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:48
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:46
size_t(* MEM_allocN_len)(const void *vmemh)
Definition: mallocn.c:40
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static ulong * next
static unsigned a[3]
Definition: RandGen.cpp:92
void BKE_palette_sort_vhs(tPaletteColorHSV *color_array, const int totcol)
Definition: paint.c:893
void BKE_sculpt_update_object_after_eval(Depsgraph *depsgraph, Object *ob_eval)
Definition: paint.c:1789
void BKE_paint_runtime_init(const ToolSettings *ts, Paint *paint)
Definition: paint.c:620
void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss)
Definition: paint.c:1344
void BKE_paint_set_overlay_override(eOverlayFlags flags)
Definition: paint.c:283
eObjectMode BKE_paint_object_mode_from_paintmode(ePaintMode mode)
Definition: paint.c:1009
void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
Definition: paint.c:2219
void BKE_sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh)
Definition: paint.c:1998
bool BKE_paint_select_vert_test(Object *ob)
Definition: paint.c:976
static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
Definition: paint.c:1569
void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *view_layer, CurveMapping *curve)
Definition: paint.c:259
static PBVH * build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect_hide)
Definition: paint.c:2149
float paint_grid_paint_mask(const GridPaintMask *gpm, uint level, uint x, uint y)
Definition: paint.c:1272
#define RAKE_THRESHHOLD
Definition: paint.c:1281
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode)
Definition: paint.c:354
void BKE_paint_curve_set(Brush *br, PaintCurve *pc)
Definition: paint.c:714
void BKE_sculpt_sync_face_set_visibility(struct Mesh *mesh, struct SubdivCCG *subdiv_ccg)
Definition: paint.c:2044
static void palette_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
Definition: paint.c:90
void BKE_paint_invalidate_overlay_tex(Scene *scene, ViewLayer *view_layer, const Tex *tex)
Definition: paint.c:239
static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
Definition: paint.c:1374
void BKE_paint_copy(Paint *src, Paint *tar, const int flag)
Definition: paint.c:1156
void BKE_paint_blend_write(BlendWriter *writer, Paint *p)
Definition: paint.c:1185
void BKE_sculpt_sync_face_sets_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg)
Definition: paint.c:2013
void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
Definition: paint.c:1398
void BKE_sculpt_ensure_orig_mesh_data(Scene *scene, Object *object)
Definition: paint.c:2057
void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene)
Definition: paint.c:1895
static PBVH * build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool respect_hide)
Definition: paint.c:2110
static bool check_sculpt_object_deformed(Object *object, const bool for_construction)
Definition: paint.c:1922
bool BKE_palette_from_hash(Main *bmain, GHash *color_table, const char *name, const bool linear)
Definition: paint.c:905
static void palette_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
Definition: paint.c:128
static void paint_curve_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
Definition: paint.c:166
void BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(Mesh *mesh)
Definition: paint.c:1950
void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3])
Definition: paint.c:1173
static int palettecolor_compare_luminance(const void *a1, const void *a2)
Definition: paint.c:864
void BKE_sculptsession_free(Object *ob)
Definition: paint.c:1466
void BKE_paint_blend_read_lib(BlendLibReader *reader, Scene *sce, Paint *p)
Definition: paint.c:1219
const char PAINT_CURSOR_VERTEX_PAINT[3]
Definition: paint.c:233
Palette * BKE_palette_add(Main *bmain, const char *name)
Definition: paint.c:751
ePaintMode BKE_paintmode_get_active_from_context(const bContext *C)
Definition: paint.c:519
Paint * BKE_paint_get_active_from_context(const bContext *C)
Definition: paint.c:484
void BKE_sculptsession_free_deformMats(SculptSession *ss)
Definition: paint.c:1337
const char PAINT_CURSOR_SCULPT[3]
Definition: paint.c:232
uint BKE_paint_get_brush_tool_offset_from_paintmode(const ePaintMode mode)
Definition: paint.c:663
PaintCurve * BKE_paint_curve_add(Main *bmain, const char *name)
Definition: paint.c:691
void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
Definition: paint.c:729
bool BKE_paint_ensure_from_paintmode(Scene *sce, ePaintMode mode)
Definition: paint.c:306
Brush * BKE_paint_brush(Paint *p)
Definition: paint.c:604
void BKE_palette_sort_hsv(tPaletteColorHSV *color_array, const int totcol)
Definition: paint.c:881
void BKE_paint_blend_read_data(BlendDataReader *reader, const Scene *scene, Paint *p)
Definition: paint.c:1193
static int palettecolor_compare_svh(const void *a1, const void *a2)
Definition: paint.c:802
void BKE_paint_reset_overlay_invalid(ePaintOverlayControlFlags flag)
Definition: paint.c:301
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
Definition: paint.c:2230
bool paint_is_grid_face_hidden(const uint *grid_hidden, int gridsize, int x, int y)
Definition: paint.c:1247
void BKE_palette_sort_svh(tPaletteColorHSV *color_array, const int totcol)
Definition: paint.c:887
void BKE_paint_brush_set(Paint *p, Brush *br)
Definition: paint.c:609
static PBVH * build_pbvh_for_dynamic_topology(Object *ob)
Definition: paint.c:2096
const EnumPropertyItem * BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode)
Definition: paint.c:389
bool paint_is_face_hidden(const MLoopTri *lt, const MVert *mvert, const MLoop *mloop)
Definition: paint.c:1237
void BKE_paint_free(Paint *paint)
Definition: paint.c:1146
int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
Definition: paint.c:1829
void BKE_palette_sort_luminance(tPaletteColorHSV *color_array, const int totcol)
Definition: paint.c:899
static void palette_free_data(ID *id)
Definition: paint.c:101
bool BKE_paint_select_elem_test(Object *ob)
Definition: paint.c:987
static void paint_curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: paint.c:187
void paint_update_brush_rake_rotation(UnifiedPaintSettings *ups, Brush *brush, float rotation)
Definition: paint.c:1283
const char PAINT_CURSOR_WEIGHT_PAINT[3]
Definition: paint.c:234
MultiresModifierData * BKE_sculpt_multires_active(Scene *scene, Object *ob)
Definition: paint.c:1527
bool BKE_paint_select_face_test(Object *ob)
Definition: paint.c:968
static void paint_curve_free_data(ID *id)
Definition: paint.c:179
const char PAINT_CURSOR_TEXTURE_PAINT[3]
Definition: paint.c:235
void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
Definition: paint.c:1115
#define GOLDEN_RATIO_CONJUGATE
Definition: paint.c:2248
void BKE_palette_clear(Palette *palette)
Definition: paint.c:745
void BKE_sculptsession_bm_to_me_for_render(Object *object)
Definition: paint.c:1444
bool BKE_paint_ensure(ToolSettings *ts, struct Paint **r_paint)
Definition: paint.c:1032
static void sculptsession_free_pbvh(Object *object)
Definition: paint.c:1409
bool paint_calculate_rake_rotation(UnifiedPaintSettings *ups, Brush *brush, const float mouse_pos[2])
Definition: paint.c:1300
static ePaintOverlayControlFlags overlay_flags
Definition: paint.c:237
bool paint_is_bmesh_face_hidden(BMFace *f)
Definition: paint.c:1257
void BKE_paint_invalidate_overlay_all(void)
Definition: paint.c:272
IDTypeInfo IDType_ID_PAL
Definition: paint.c:138
static void palette_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: paint.c:108
static void paint_curve_blend_read_data(BlendDataReader *reader, ID *id)
Definition: paint.c:198
PBVH * BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
Definition: paint.c:2171
IDTypeInfo IDType_ID_PC
Definition: paint.c:204
static int palettecolor_compare_vhs(const void *a1, const void *a2)
Definition: paint.c:833
void BKE_paint_palette_set(Paint *p, Palette *palette)
Definition: paint.c:705
static void palette_init_data(ID *id)
Definition: paint.c:80
static int palettecolor_compare_hsv(const void *a1, const void *a2)
Definition: paint.c:770
const char * BKE_paint_get_tool_prop_id_from_paintmode(ePaintMode mode)
Definition: paint.c:417
void BKE_paint_face_set_overlay_color_get(const int face_set, const int seed, uchar r_color[4])
Definition: paint.c:2249
PaletteColor * BKE_palette_color_add(Palette *palette)
Definition: paint.c:757
void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, const int add_index)
Definition: paint.c:723
void BKE_sculpt_update_object_for_edit(Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool need_colors)
Definition: paint.c:1817
Palette * BKE_paint_palette(Paint *p)
Definition: paint.c:700
ePaintOverlayControlFlags BKE_paint_get_overlay_flags(void)
Definition: paint.c:278
static void palette_blend_read_data(BlendDataReader *reader, ID *id)
Definition: paint.c:122
void BKE_sculpt_color_layer_create_if_needed(struct Object *object)
Definition: paint.c:1800
static void sculpt_update_object(Depsgraph *depsgraph, Object *ob, Mesh *me_eval, bool need_pmap, bool need_mask, bool UNUSED(need_colors))
Definition: paint.c:1616
void BKE_paint_cavity_curve_preset(Paint *p, int preset)
Definition: paint.c:992
void BKE_sculpt_update_object_before_eval(Object *ob)
Definition: paint.c:1757
ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref)
Definition: paint.c:570
Paint * BKE_paint_get_active(Scene *sce, ViewLayer *view_layer)
Definition: paint.c:447
bool BKE_palette_is_empty(const struct Palette *palette)
Definition: paint.c:764
return ret
const EnumPropertyItem rna_enum_brush_image_tool_items[]
Definition: rna_brush.c:168
const EnumPropertyItem rna_enum_brush_weight_tool_items[]
Definition: rna_brush.c:160
const EnumPropertyItem rna_enum_brush_gpencil_sculpt_types_items[]
Definition: rna_brush.c:207
const EnumPropertyItem rna_enum_brush_sculpt_tool_items[]
Definition: rna_brush.c:105
const EnumPropertyItem rna_enum_brush_vertex_tool_items[]
Definition: rna_brush.c:152
const EnumPropertyItem rna_enum_brush_uv_sculpt_tool_items[]
Definition: rna_brush.c:145
const EnumPropertyItem rna_enum_brush_gpencil_vertex_types_items[]
Definition: rna_brush.c:198
const EnumPropertyItem rna_enum_brush_gpencil_weight_types_items[]
Definition: rna_brush.c:251
const EnumPropertyItem rna_enum_brush_gpencil_types_items[]
Definition: rna_brush.c:178
struct BMVert * v
Definition: bmesh_class.h:165
struct BMLoop * next
Definition: bmesh_class.h:245
struct Object * object
struct MTex mtex
struct CurveMapping * curve
struct MTex mask_mtex
struct PaintCurve * paint_curve
Definition: BKE_ccg.h:48
int grid_area
Definition: BKE_ccg.h:58
CurveMap cm[4]
unsigned int level
short id_code
Definition: BKE_idtype.h:120
Definition: DNA_ID.h:273
struct Library * lib
Definition: DNA_ID.h:277
int us
Definition: DNA_ID.h:293
IDProperty * properties
Definition: DNA_ID.h:314
void * first
Definition: DNA_listBase.h:47
unsigned int tri[3]
unsigned int v
char brush_angle_mode
struct Tex * tex
Definition: BKE_main.h:116
struct SubdivCCG * subdiv_ccg
struct CustomData pdata ldata
struct MVert * mvert
int totvert
struct MLoop * mloop
Mesh_Runtime runtime
int totpoly
int face_sets_color_seed
int face_sets_color_default
int totloop
struct Key * key
struct MPoly * mpoly
struct ModifierData * next
ModifierTypeType type
Definition: BKE_modifier.h:173
struct Mesh * mesh_deform_eval
short shapenr
Object_Runtime runtime
float obmat[4][4]
struct SculptSession * sculpt
void * data
char shapeflag
PaintCurvePoint * points
struct Brush * brush
unsigned short ob_mode
unsigned int tool_offset
struct Paint_Runtime runtime
float tile_offset[3]
int tool_slots_len
int num_input_samples
struct PaintToolSlot * tool_slots
int symmetry_flags
void * paint_cursor
unsigned char paint_cursor_col[4]
struct CurveMapping * cavity_curve
struct Palette * palette
struct Brush * brush
struct PaletteColor * next
int active_color
ListBase colors
struct ToolSettings * toolsettings
struct SculptBoundaryEditInfo * edit_info
Definition: BKE_paint.h:416
int * vertices
Definition: BKE_paint.h:380
float * distance
Definition: BKE_paint.h:387
SculptBoundaryPreviewEdge * edges
Definition: BKE_paint.h:390
int * fake_neighbor_index
Definition: BKE_paint.h:443
SculptPoseIKChainSegment * segments
Definition: BKE_paint.h:260
struct SubdivCCG * subdiv_ccg
Definition: BKE_paint.h:501
struct ImagePool * tex_pool
Definition: BKE_paint.h:516
int cd_face_node_offset
Definition: BKE_paint.h:495
SculptPoseIKChain * pose_ik_chain_preview
Definition: BKE_paint.h:554
struct MeshElemMap * epmap
Definition: BKE_paint.h:478
bool bm_smooth_shading
Definition: BKE_paint.h:496
int cd_vert_node_offset
Definition: BKE_paint.h:494
int preview_vert_index_count
Definition: BKE_paint.h:550
struct Depsgraph * depsgraph
Definition: BKE_paint.h:458
SculptVertexInfo vertex_info
Definition: BKE_paint.h:563
bool show_mask
Definition: BKE_paint.h:505
float(* orig_cos)[3]
Definition: BKE_paint.h:510
int * face_sets
Definition: BKE_paint.h:490
int * pmap_mem
Definition: BKE_paint.h:475
struct MVert * mvert
Definition: BKE_paint.h:461
struct MPropCol * vcol
Definition: BKE_paint.h:469
struct KeyBlock * shapekey_active
Definition: BKE_paint.h:468
struct SculptSession::@54::@55 vpaint
bool show_face_sets
Definition: BKE_paint.h:506
union SculptSession::@54 mode
struct BMesh * bm
Definition: BKE_paint.h:493
int * preview_vert_index_list
Definition: BKE_paint.h:549
SculptBoundary * boundary_preview
Definition: BKE_paint.h:557
struct MeshElemMap * vemap
Definition: BKE_paint.h:482
struct BMLog * bm_log
Definition: BKE_paint.h:498
struct Scene * scene
Definition: BKE_paint.h:546
int * epmap_mem
Definition: BKE_paint.h:479
float * vmask
Definition: BKE_paint.h:470
struct MeshElemMap * pmap
Definition: BKE_paint.h:474
struct MLoop * mloop
Definition: BKE_paint.h:463
struct MPoly * mpoly
Definition: BKE_paint.h:462
eObjectMode mode_type
Definition: BKE_paint.h:600
struct MultiresModifierData * modifier
Definition: BKE_paint.h:453
float(* deform_imats)[3][3]
Definition: BKE_paint.h:512
struct StrokeCache * cache
Definition: BKE_paint.h:518
struct SculptSession::@53 multires
float(* deform_cos)[3]
Definition: BKE_paint.h:511
struct ExpandCache * expand_cache
Definition: BKE_paint.h:520
struct SculptSession::@54::@56 wpaint
SculptFakeNeighbors fake_neighbors
Definition: BKE_paint.h:564
unsigned int * texcache
Definition: BKE_paint.h:515
SculptPersistentBase * persistent_base
Definition: BKE_paint.h:561
struct FilterCache * filter_cache
Definition: BKE_paint.h:519
bool building_vp_handle
Definition: BKE_paint.h:603
struct PBVH * pbvh
Definition: BKE_paint.h:504
int * vemap_mem
Definition: BKE_paint.h:483
bool deform_modifiers_active
Definition: BKE_paint.h:509
int * connected_component
Definition: BKE_paint.h:355
BLI_bitmap * boundary
Definition: BKE_paint.h:358
struct MeshElemMap * vert_to_loop
Definition: BKE_paint.h:235
struct MeshElemMap * vert_to_poly
Definition: BKE_paint.h:237
float detail_percent
Paint paint
float detail_size
float constant_detail
struct CCGElem ** grids
SubdivCCGFace ** grid_faces
BLI_bitmap ** grid_hidden
struct DMFlagMat * grid_flag_mats
GpWeightPaint * gp_weightpaint
struct ImagePaintSettings imapaint
GpPaint * gp_paint
GpSculptPaint * gp_sculptpaint
struct UnifiedPaintSettings unified_paint_settings
UvSculpt * uvsculpt
GpVertexPaint * gp_vertexpaint
View3DShading shading
struct Base * basact
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186