Fix #122355: Opacity modifier hardness mode not working

This was introduced by 944be3d619e07b6f28b6e355aa1f9ab4241da9a1.

In order to keep the behavior the same at the user level,
we can't invert the factor. We have to invert the values, then
apply the factor and convert back.

Pull Request: https://projects.blender.org/blender/blender/pulls/122360
This commit is contained in:
Falk David 2024-05-28 12:12:31 +02:00 committed by Falk David
parent 1080a94a3d
commit e4c0055591

@ -162,10 +162,9 @@ static void modify_softness(const GreasePencilOpacityModifierData &omd,
bke::SpanAttributeWriter<float> softness = attributes.lookup_or_add_for_write_span<float>(
"softness", bke::AttrDomain::Curve);
const float factor = 1.0f - omd.hardness_factor;
curves_mask.foreach_index(GrainSize(512), [&](int64_t curve_i) {
softness.span[curve_i] = std::clamp(softness.span[curve_i] * factor, 0.0f, 1.0f);
softness.span[curve_i] =
1.0f - std::clamp((1.0f - softness.span[curve_i]) * omd.hardness_factor, 0.0f, 1.0f);
});
softness.finish();