Fix: 'Reset Curve' applies incorrect transformation for positive slopes
Currently, the 'Reset Curve' button, corresponding to the `BKE_curvemap_reset` function, converts a predefined negative slope curve to a positive slope by inverting the order of y axis points. This has the implicit dependency on these points being at inverse x positions. For most preset curves, this works well, but for the round curve, which has points at 0, 0.5, 0.86, and 1, this condition does not hold true. To fix this, take the inverted x value for a given control point instead of the raw value. For the above example this means that the round curve now has x values at 0, 0.14, 0.5, and 1. Pull Request: https://projects.blender.org/blender/blender/pulls/147008
This commit is contained in:
@@ -433,6 +433,7 @@ void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, CurveMapS
|
||||
CurveMapPoint *newpoints = static_cast<CurveMapPoint *>(MEM_dupallocN(cuma->curve));
|
||||
|
||||
for (i = 0; i < cuma->totpoint; i++) {
|
||||
newpoints[i].x = 1.0f - cuma->curve[last - i].x;
|
||||
newpoints[i].y = cuma->curve[last - i].y;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user