diff options
author | Ton Roosendaal <ton@blender.org> | 2007-01-17 17:12:48 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-01-17 17:12:48 +0300 |
commit | 9bc90c1669176e7b86964ae078b0b2993835d3dc (patch) | |
tree | e7dbce65af5f838949386ebe7490376a69e5b568 /source/blender/blenkernel/intern/colortools.c | |
parent | fc633e46c56135eb371123a4d604adc1fd6748f1 (diff) |
Bugfix #5725
Curves widget: using "clipping" option didn't work well when dragging
multiple points. Now it clips based on entire selection.
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 6249bb2f21b..fda31d9e7c0 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -511,23 +511,32 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) CurveMapPoint *cmp= cuma->curve; rctf *clipr= &cumap->clipr; float thresh= 0.01f*(clipr->xmax - clipr->xmin); - float dx, dy; + float dx= 0.0f, dy= 0.0f; int a; /* clamp with clip */ if(cumap->flag & CUMA_DO_CLIP) { for(a=0; a<cuma->totpoint; a++) { - if(cmp[a].x < clipr->xmin) - cmp[a].x= clipr->xmin; - else if(cmp[a].x > clipr->xmax) - cmp[a].x= clipr->xmax; - if(cmp[a].y < clipr->ymin) - cmp[a].y= clipr->ymin; - else if(cmp[a].y > clipr->ymax) - cmp[a].y= clipr->ymax; + if(cmp[a].flag & CUMA_SELECT) { + if(cmp[a].x < clipr->xmin) + dx= MIN2(dx, cmp[a].x - clipr->xmin); + else if(cmp[a].x > clipr->xmax) + dx= MAX2(dx, cmp[a].x - clipr->xmax); + if(cmp[a].y < clipr->ymin) + dy= MIN2(dy, cmp[a].y - clipr->ymin); + else if(cmp[a].y > clipr->ymax) + dy= MAX2(dy, cmp[a].y - clipr->ymax); + } + } + for(a=0; a<cuma->totpoint; a++) { + if(cmp[a].flag & CUMA_SELECT) { + cmp[a].x -= dx; + cmp[a].y -= dy; + } } } + qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints); /* remove doubles, threshold set on 1% of default range */ |