Fix #156993: Mask from Cavity creates inverted mask

When calculating the mask values, calculate the relative `factor` of the
automask for a given vertex and apply that as the value of the
.sculpt_mask. This is incorrect, as the `factor` is inversely related to
the mask value (i.e. a mask value of 1.0 corresponds to a factor value
of 0.0).

This was already fixed for creating a mask from boundary elements, to
extend the fix, simply remove the ability to specify whether the mask
should be based on the inverted factor or not in
`apply_mask_from_settings`, and always assume that it should be.

Pull Request: https://projects.blender.org/blender/blender/pulls/157021
This commit is contained in:
Sean Kim 2026-04-07 22:09:30 +02:00 • committed by Sean Kim
parent c0b9d89101
commit be36644bfe
2 changed files with 14 additions and 34 deletions

View file

@ -221,11 +221,11 @@ class MaskFromCavityTest(unittest.TestCase):
if position_data[i][2] < 0.0:
self.assertEqual(
mask_data[i],
1.0,
f"Vertex {i} should be fully masked ({position_data[i]}) -> {mask_data[i]}")
0.0,
f"Vertex {i} should not be masked ({position_data[i]}) -> {mask_data[i]}")
else:
self.assertNotEqual(mask_data[i], 1.0,
f"Vertex {i} should not be fully masked ({position_data[i]}) -> {mask_data[i]}")
self.assertNotEqual(mask_data[i], 0.0,
f"Vertex {i} should be masked ({position_data[i]}) -> {mask_data[i]}")
def main():