Fix: GPv3: Division by zero for single point curves

Makes sure to map curves with a single point to 0.0f in the
custom curve mapping.
This commit is contained in:
Falk David
2024-04-30 13:17:27 +02:00
parent 99f5433445
commit 5ebce2c72c

View File

@@ -131,7 +131,7 @@ static void deform_drawing(const ModifierData &md,
(mmd.influence.custom_curve))
{
/* Normalize value to evaluate curve. */
const float value = float(i) / (points.size() - 1);
const float value = points.size() > 1 ? (float(i) / float(points.size() - 1)) : 0.0f;
return BKE_curvemapping_evaluateF(mmd.influence.custom_curve, 0, value);
}
return 1.0f;