Fix #129670: Curves not drawn outside of clip range

Curve maps in nodes like RGB Curves are not drawn nor evaluated outside
of clipping range. This is a regression in 8812be59a4, where the range
of the curve didn't account for points that lie outside of the clipping
range. That's because the table_range variable was initialized before
the loop that updates the minimum and maximum points of the table.

To fix this, we move the table_range initialization after the loop that
updates the minimum and maximum points of the table.

Pull Request: https://projects.blender.org/blender/blender/pulls/129777
This commit is contained in:
Omar Emara
2024-11-04 16:11:43 +01:00
committed by Omar Emara
parent ecba71ae91
commit a1b489ec71

View File

@@ -669,7 +669,6 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
/* default rect also is table range */
cuma->mintable = clipr->xmin;
cuma->maxtable = clipr->xmax;
float table_range = cuma->maxtable - cuma->mintable;
const int bezt_totpoint = max_ii(cuma->totpoint, 2);
/* Rely on Blender interpolation for bezier curves, support extra functionality here as well. */
@@ -717,6 +716,7 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
BezTriple *bezt_post_ptr;
float table_range = cuma->maxtable - cuma->mintable;
if (use_wrapping) {
/* Handle location of pre and post points for wrapping curves. */
bezt_pre.h1 = bezt_pre.h2 = bezt[bezt_totpoint - 1].h2;