diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_colortools.h | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 12 |
3 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 3e1d4fe927b..dca8ccb6dbf 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -45,13 +45,6 @@ struct rctf; # define DO_INLINE static inline #endif -typedef enum CurveMappingPreset { - CURVE_PRESET_LINE, - CURVE_PRESET_SHARP, - CURVE_PRESET_SMOOTH, - CURVE_PRESET_MAX -} CurveMappingPreset; - void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w); void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w); @@ -62,7 +55,7 @@ void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, f void curvemap_remove(struct CurveMap *cuma, int flag); void curvemap_insert(struct CurveMap *cuma, float x, float y); -void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, CurveMappingPreset preset); +void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset); void curvemap_sethandle(struct CurveMap *cuma, int type); void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index bc30b2669e8..f2cb7d31592 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -237,7 +237,8 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) cm = b->curve->cm; cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; - curvemap_reset(cm, &b->curve->clipr, preset); + b->curve->preset = preset; + curvemap_reset(cm, &b->curve->clipr, b->curve->preset); curvemapping_changed(b->curve, 0); } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 71b497660e9..28b70b539c1 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -239,7 +239,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y) cuma->curve= cmp; } -void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset) +void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) { if(cuma->curve) MEM_freeN(cuma->curve); @@ -249,6 +249,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset) case CURVE_PRESET_SHARP: cuma->totpoint= 3; break; case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break; case CURVE_PRESET_MAX: cuma->totpoint= 2; break; + case CURVE_PRESET_MID9: cuma->totpoint= 9; } cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points"); @@ -286,6 +287,15 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset) cuma->curve[1].x= 1; cuma->curve[1].y= 1; break; + case CURVE_PRESET_MID9: + { + int i; + for (i=0; i < cuma->totpoint; i++) + { + cuma->curve[i].x= i / ((float)cuma->totpoint-1); + cuma->curve[i].y= 0.5; + } + } } if(cuma->table) { |