sculpt-dev: fix draw face sets brush

This commit is contained in:
Joseph Eagar 2022-10-06 02:18:21 -07:00
parent 42948e2389
commit 5e2b234855
3 changed files with 16 additions and 10 deletions

View File

@ -975,7 +975,13 @@ struct PBVHBatches {
uchar face_set_color[4];
int fset = BM_ELEM_CD_GET_INT(l->f, cd_fset);
BKE_paint_face_set_overlay_color_get(fset, args->face_sets_color_seed, face_set_color);
if (fset != args->face_sets_color_default) {
BKE_paint_face_set_overlay_color_get(
fset, args->face_sets_color_seed, face_set_color);
}
else {
face_set_color[0] = face_set_color[1] = face_set_color[2] = 255;
}
*static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = face_set_color;
});

View File

@ -83,9 +83,6 @@ bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd,
bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, const Brush *br)
{
if (br && SCULPT_stroke_is_dynamic_topology(ss, br)) {
return false;
}
if (SCULPT_is_automasking_mode_enabled(sd, br, BRUSH_AUTOMASKING_TOPOLOGY)) {
return true;
}
@ -746,7 +743,6 @@ void SCULPT_automasking_cache_settings_update(AutomaskingCache *automasking,
const Brush *brush)
{
automasking->settings.flags = sculpt_automasking_mode_effective_bits(sd, brush);
automasking->settings.initial_face_set = SCULPT_active_face_set_get(ss);
automasking->settings.view_normal_limit = sd->automasking_view_normal_limit;
automasking->settings.view_normal_falloff = sd->automasking_view_normal_falloff;
@ -820,6 +816,10 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, const Brush *brush,
AutomaskingCache *automasking = (AutomaskingCache *)MEM_callocN(sizeof(AutomaskingCache),
"automasking cache");
automasking->settings.initial_face_set = SCULPT_active_face_set_get(ss);
automasking->settings.current_face_set = automasking->settings.initial_face_set;
SCULPT_automasking_cache_settings_update(automasking, ss, sd, brush);
SCULPT_boundary_info_ensure(ob);

View File

@ -306,9 +306,9 @@ static int new_fset_apply_curve(SculptSession *ss,
return new_fset;
}
void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
ATTR_NO_OPT void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
{
SculptFaceSetDrawData *data = (SculptFaceSetDrawData *)userdata;
SculptSession *ss = data->ob->sculpt;
@ -340,7 +340,7 @@ void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
/*check if we need to sample the current face set*/
bool set_active_faceset = ss->cache->automasking &&
(brush->automasking_flags & BRUSH_AUTOMASKING_FACE_SETS);
(ss->cache->automasking->settings.flags & BRUSH_AUTOMASKING_FACE_SETS);
set_active_faceset = set_active_faceset && ss->cache->invert;
set_active_faceset = set_active_faceset && ss->cache->automasking->settings.initial_face_set ==
ss->cache->automasking->settings.current_face_set;
@ -661,7 +661,7 @@ static void do_relax_face_sets_brush_task_cb_ex(void *__restrict userdata,
BKE_pbvh_vertex_iter_end;
}
void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
ATTR_NO_OPT void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
Brush *brush = ss->cache->brush ? ss->cache->brush : BKE_paint_brush(&sd->paint);