Sculpt: fix T102348: Don't fold area normal automasking into cache
Certain automasking modes build a factor cache. Modes that rely on the mirror symmetry pass should not fold into this pass.
This commit is contained in:
parent
2e1a479e29
commit
b1cc2a48f2
Notes:
blender-bot
2023-02-14 07:53:51 +01:00
Referenced by issue #102348, Sculpt Mode: Area and Topology auto-masking don't work with Mirror
|
@ -185,9 +185,8 @@ static bool SCULPT_automasking_needs_factors_cache(const Sculpt *sd, const Brush
|
|||
return true;
|
||||
}
|
||||
|
||||
if (automasking_flags &
|
||||
(BRUSH_AUTOMASKING_BOUNDARY_EDGES | BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS |
|
||||
BRUSH_AUTOMASKING_BRUSH_NORMAL | BRUSH_AUTOMASKING_VIEW_NORMAL)) {
|
||||
if (automasking_flags & (BRUSH_AUTOMASKING_BOUNDARY_EDGES |
|
||||
BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS | BRUSH_AUTOMASKING_VIEW_NORMAL)) {
|
||||
return brush && brush->automasking_boundary_edges_propagation_steps != 1;
|
||||
}
|
||||
return false;
|
||||
|
@ -507,6 +506,16 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
|
|||
return 1.0f;
|
||||
}
|
||||
|
||||
float mask = 1.0f;
|
||||
|
||||
/* Since brush normal mode depends on the current mirror symmery pass
|
||||
* it is not folded into the factor cache (when it exists).
|
||||
*/
|
||||
if ((ss->cache || ss->filter_cache) &&
|
||||
(automasking->settings.flags & BRUSH_AUTOMASKING_BRUSH_NORMAL)) {
|
||||
mask *= automasking_brush_normal_factor(automasking, ss, vert, automask_data);
|
||||
}
|
||||
|
||||
/* If the cache is initialized with valid info, use the cache. This is used when the
|
||||
* automasking information can't be computed in real time per vertex and needs to be
|
||||
* initialized for the whole mesh when the stroke starts. */
|
||||
|
@ -517,7 +526,7 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
|
|||
factor *= sculpt_automasking_cavity_factor(automasking, ss, vert);
|
||||
}
|
||||
|
||||
return factor;
|
||||
return factor * mask;
|
||||
}
|
||||
|
||||
uchar stroke_id = ss->attrs.automasking_stroke_id ?
|
||||
|
@ -554,13 +563,6 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
|
|||
}
|
||||
}
|
||||
|
||||
float mask = 1.0f;
|
||||
|
||||
if ((ss->cache || ss->filter_cache) &&
|
||||
(automasking->settings.flags & BRUSH_AUTOMASKING_BRUSH_NORMAL)) {
|
||||
mask *= automasking_brush_normal_factor(automasking, ss, vert, automask_data);
|
||||
}
|
||||
|
||||
if ((ss->cache || ss->filter_cache) &&
|
||||
(automasking->settings.flags & BRUSH_AUTOMASKING_VIEW_NORMAL)) {
|
||||
mask *= automasking_view_normal_factor(automasking, ss, vert, automask_data);
|
||||
|
@ -782,9 +784,6 @@ static void sculpt_normal_occlusion_automasking_fill(AutomaskingCache *automaski
|
|||
|
||||
float f = *(float *)SCULPT_vertex_attr_get(vertex, ss->attrs.automasking_factor);
|
||||
|
||||
if (int(mode) & BRUSH_AUTOMASKING_BRUSH_NORMAL) {
|
||||
f *= automasking_brush_normal_factor(automasking, ss, vertex, &nodedata);
|
||||
}
|
||||
if (int(mode) & BRUSH_AUTOMASKING_VIEW_NORMAL) {
|
||||
if (int(mode) & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
|
||||
f *= automasking_view_occlusion_factor(automasking, ss, vertex, -1, &nodedata);
|
||||
|
@ -940,8 +939,7 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object
|
|||
|
||||
/* Subtractive modes. */
|
||||
int normal_bits = sculpt_automasking_mode_effective_bits(sd, brush) &
|
||||
(BRUSH_AUTOMASKING_BRUSH_NORMAL | BRUSH_AUTOMASKING_VIEW_NORMAL |
|
||||
BRUSH_AUTOMASKING_VIEW_OCCLUSION);
|
||||
(BRUSH_AUTOMASKING_VIEW_NORMAL | BRUSH_AUTOMASKING_VIEW_OCCLUSION);
|
||||
|
||||
if (normal_bits) {
|
||||
sculpt_normal_occlusion_automasking_fill(automasking, ob, (eAutomasking_flag)normal_bits);
|
||||
|
|
Loading…
Reference in New Issue