diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-09-29 08:53:52 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-09-29 08:53:52 +0300 |
commit | 222c71ec4b298ff7fe4c0a3272fde31af880b948 (patch) | |
tree | e415c14eb5b74cc4fade57adfa3dcd8cbf80e9a6 | |
parent | c63d6e3698f89e310db91f72e3920a8be18e451c (diff) |
temp-sculpt-normals-masking: cleanup code a bit
Also, don't reuse automask stroke id if view normal
occlusion is on.
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_automasking.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc index 86b879440b9..ef64cbabe4f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc @@ -857,7 +857,7 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object } } - if (SCULPT_is_automasking_mode_enabled(sd, brush, BRUSH_AUTOMASKING_CAVITY_ALL)) { + if (mode & BRUSH_AUTOMASKING_CAVITY_ALL) { use_stroke_id = true; if (SCULPT_is_automasking_mode_enabled(sd, brush, BRUSH_AUTOMASKING_CAVITY_USE_CURVE)) { @@ -868,14 +868,21 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object if (!ss->attrs.automasking_cavity) { SculptAttributeParams params = {0}; ss->attrs.automasking_cavity = BKE_sculpt_attribute_ensure( - ob, ATTR_DOMAIN_POINT, CD_PROP_FLOAT, SCULPT_ATTRIBUTE_NAME(automasking_cavity), ¶ms); + ob, + ATTR_DOMAIN_POINT, + CD_PROP_FLOAT, + SCULPT_ATTRIBUTE_NAME(automasking_cavity), + ¶ms); } } if (use_stroke_id) { SCULPT_stroke_id_ensure(ob); - if (brush && SCULPT_tool_can_reuse_automask(brush->sculpt_tool)) { + bool have_occlusion = (mode & BRUSH_AUTOMASKING_VIEW_OCCLUSION) && + (mode & BRUSH_AUTOMASKING_VIEW_NORMAL); + + if (brush && SCULPT_tool_can_reuse_automask(brush->sculpt_tool) && !have_occlusion) { int hash = SCULPT_automasking_settings_hash(ob, automasking); if (hash == ss->last_automasking_settings_hash) { @@ -883,7 +890,8 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object automasking->can_reuse_mask = true; } } - else { + + if (!automasking->can_reuse_mask) { ss->last_automask_stroke_id = ss->stroke_id; } } |