From 5505697ac508c02b8a2e196c5a8c07431bc687cf Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Wed, 14 Jul 2010 14:11:03 +0000 Subject: Merge GSOC Sculpt Branch: 28499-30319 https://svn.blender.org/svnroot/bf-blender/branches/soc-2010-jwilkins See log of that branch for details. --- source/blender/blenkernel/intern/colortools.c | 56 ++++++++++++++++++++------- 1 file changed, 43 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern/colortools.c') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c8a01b1c12f..a07c18f42f3 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -126,6 +126,9 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa cumap->cm[a].curve[1].x= maxx; cumap->cm[a].curve[1].y= maxy; } + + cumap->changed_timestamp = 0; + return cumap; } @@ -240,10 +243,12 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) switch(preset) { case CURVE_PRESET_LINE: cuma->totpoint= 2; break; - case CURVE_PRESET_SHARP: cuma->totpoint= 3; break; + case CURVE_PRESET_SHARP: cuma->totpoint= 4; break; case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break; case CURVE_PRESET_MAX: cuma->totpoint= 2; break; - case CURVE_PRESET_MID9: cuma->totpoint= 9; + case CURVE_PRESET_MID9: cuma->totpoint= 9; break; + case CURVE_PRESET_ROUND: cuma->totpoint= 4; break; + case CURVE_PRESET_ROOT: cuma->totpoint= 4; break; } cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points"); @@ -251,27 +256,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) switch(preset) { case CURVE_PRESET_LINE: cuma->curve[0].x= clipr->xmin; - cuma->curve[0].y= clipr->ymin; + cuma->curve[0].y= clipr->ymax; cuma->curve[0].flag= 0; cuma->curve[1].x= clipr->xmax; - cuma->curve[1].y= clipr->ymax; + cuma->curve[1].y= clipr->ymin; cuma->curve[1].flag= 0; break; case CURVE_PRESET_SHARP: cuma->curve[0].x= 0; cuma->curve[0].y= 1; - cuma->curve[1].x= 0.33; - cuma->curve[1].y= 0.33; - cuma->curve[2].x= 1; - cuma->curve[2].y= 0; + cuma->curve[1].x= 0.25; + cuma->curve[1].y= 0.50; + cuma->curve[2].x= 0.75; + cuma->curve[2].y= 0.04; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; break; case CURVE_PRESET_SMOOTH: cuma->curve[0].x= 0; cuma->curve[0].y= 1; cuma->curve[1].x= 0.25; - cuma->curve[1].y= 0.92; + cuma->curve[1].y= 0.94; cuma->curve[2].x= 0.75; - cuma->curve[2].y= 0.08; + cuma->curve[2].y= 0.06; cuma->curve[3].x= 1; cuma->curve[3].y= 0; break; @@ -290,8 +297,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) cuma->curve[i].y= 0.5; } } + break; + case CURVE_PRESET_ROUND: + cuma->curve[0].x= 0; + cuma->curve[0].y= 1; + cuma->curve[1].x= 0.5; + cuma->curve[1].y= 0.90; + cuma->curve[2].x= 0.86; + cuma->curve[2].y= 0.5; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; + break; + case CURVE_PRESET_ROOT: + cuma->curve[0].x= 0; + cuma->curve[0].y= 1; + cuma->curve[1].x= 0.25; + cuma->curve[1].y= 0.95; + cuma->curve[2].x= 0.75; + cuma->curve[2].y= 0.44; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; + break; } - + if(cuma->table) { MEM_freeN(cuma->table); cuma->table= NULL; @@ -619,7 +647,9 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) float thresh= 0.01f*(clipr->xmax - clipr->xmin); float dx= 0.0f, dy= 0.0f; int a; - + + cumap->changed_timestamp++; + /* clamp with clip */ if(cumap->flag & CUMA_DO_CLIP) { for(a=0; atotpoint; a++) { @@ -701,7 +731,7 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value) if(cuma->table==NULL) { curvemap_make_table(cuma, &cumap->clipr); if(cuma->table==NULL) - return value; + return 1.0f-value; } return curvemap_evaluateF(cuma, value); } -- cgit v1.2.3