diff options
author | Matt Ebb <matt@mke3.net> | 2010-07-30 04:06:59 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-07-30 04:06:59 +0400 |
commit | eec131899647cdf17c50553e265a925857f35cfe (patch) | |
tree | 7b71e94792babf0f3191115d6f4c6e5344d54169 /source/blender/blenkernel/intern/colortools.c | |
parent | b1f53d98e4332cfa17b7e30fb8fa11feda5d826e (diff) |
Preview commit in sculpt brushes broke resetting curves in other areas (rgb curves etc).
Fixed by adding a 'slope' parameter to curvemap_reset() to mirror curve presets around Y axis.
Also removed curve preset with 'random' icon, wasn't doing what it looked like it should,
this was intended only for hue correct node anyway.
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index a07c18f42f3..11801557c99 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -236,7 +236,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y) cuma->curve= cmp; } -void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) +void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope) { if(cuma->curve) MEM_freeN(cuma->curve); @@ -320,6 +320,20 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) break; } + /* mirror curve in x direction to have positive slope + * rather than default negative slope */ + if (slope == CURVEMAP_SLOPE_POSITIVE) { + int i, last=cuma->totpoint-1; + CurveMapPoint *newpoints= MEM_dupallocN(cuma->curve); + + for (i=0; i<cuma->totpoint; i++) { + newpoints[i].y = cuma->curve[last-i].y; + } + + MEM_freeN(cuma->curve); + cuma->curve = newpoints; + } + if(cuma->table) { MEM_freeN(cuma->table); cuma->table= NULL; |