diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_colortools.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 34 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_250.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 27 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_color_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 2 |
10 files changed, 42 insertions, 53 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 90358ba9609..249cb32a082 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -59,7 +59,7 @@ void curvemapping_set_black_white(struct CurveMapping *cumap, con #define CURVEMAP_SLOPE_NEGATIVE 0 #define CURVEMAP_SLOPE_POSITIVE 1 void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope); -void curvemap_remove(struct CurveMap *cuma, int flag); +void curvemap_remove(struct CurveMap *cuma, const short flag); void curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp); struct CurveMapPoint *curvemap_insert(struct CurveMap *cuma, float x, float y); void curvemap_sethandle(struct CurveMap *cuma, int type); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 468861242d0..fc4df9594f3 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -421,7 +421,7 @@ void BKE_brush_curve_preset(Brush *b, /*CurveMappingPreset*/ int preset) b->curve->preset = preset; curvemap_reset(cm, &b->curve->clipr, b->curve->preset, CURVEMAP_SLOPE_NEGATIVE); - curvemapping_changed(b->curve, 0); + curvemapping_changed(b->curve, FALSE); } int BKE_brush_texture_set_nr(Brush *brush, int nr) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 606fd83b1a5..4bc22d77ec9 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -202,7 +202,7 @@ void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) } /* removes with flag set */ -void curvemap_remove(CurveMap *cuma, int flag) +void curvemap_remove(CurveMap *cuma, const short flag) { CurveMapPoint *cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points"); int a, b, removed = 0; @@ -711,12 +711,12 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) dy = cmp[a].y - cmp[a + 1].y; if (sqrtf(dx * dx + dy * dy) < thresh) { if (a == 0) { - cmp[a + 1].flag |= 2; + cmp[a + 1].flag |= CUMA_VECTOR; if (cmp[a + 1].flag & CUMA_SELECT) cmp[a].flag |= CUMA_SELECT; } else { - cmp[a].flag |= 2; + cmp[a].flag |= CUMA_VECTOR; if (cmp[a].flag & CUMA_SELECT) cmp[a + 1].flag |= CUMA_SELECT; } @@ -736,7 +736,7 @@ void curvemapping_changed_all(CurveMapping *cumap) for (a = 0; a < CM_TOT; a++) { if (cumap->cm[a].curve) { cumap->cur = a; - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); } } @@ -807,31 +807,17 @@ void curvemapping_evaluateRGBF(CurveMapping *cumap, float vecout[3], const float void curvemapping_evaluate_premulRGBF_ex(CurveMapping *cumap, float vecout[3], const float vecin[3], const float black[3], const float bwmul[3]) { - float fac; - - fac = (vecin[0] - black[0]) * bwmul[0]; - vecout[0] = curvemap_evaluateF(cumap->cm, fac); - - fac = (vecin[1] - black[1]) * bwmul[1]; - vecout[1] = curvemap_evaluateF(cumap->cm + 1, fac); - - fac = (vecin[2] - black[2]) * bwmul[2]; - vecout[2] = curvemap_evaluateF(cumap->cm + 2, fac); + vecout[0] = curvemap_evaluateF(&cumap->cm[0], (vecin[0] - black[0]) * bwmul[0]); + vecout[1] = curvemap_evaluateF(&cumap->cm[1], (vecin[1] - black[1]) * bwmul[1]); + vecout[2] = curvemap_evaluateF(&cumap->cm[2], (vecin[2] - black[2]) * bwmul[2]); } /* RGB with black/white points and premult. tables are checked */ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3]) { - float fac; - - fac = (vecin[0] - cumap->black[0]) * cumap->bwmul[0]; - vecout[0] = curvemap_evaluateF(cumap->cm, fac); - - fac = (vecin[1] - cumap->black[1]) * cumap->bwmul[1]; - vecout[1] = curvemap_evaluateF(cumap->cm + 1, fac); - - fac = (vecin[2] - cumap->black[2]) * cumap->bwmul[2]; - vecout[2] = curvemap_evaluateF(cumap->cm + 2, fac); + vecout[0] = curvemap_evaluateF(&cumap->cm[0], (vecin[0] - cumap->black[0]) * cumap->bwmul[0]); + vecout[1] = curvemap_evaluateF(&cumap->cm[1], (vecin[1] - cumap->black[1]) * cumap->bwmul[1]); + vecout[2] = curvemap_evaluateF(&cumap->cm[2], (vecin[2] - cumap->black[2]) * cumap->bwmul[2]); } /* same as above, byte version */ diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 5bad69c2e8d..2f54fe6cebd 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1292,7 +1292,7 @@ PointDensity *BKE_add_pointdensity(void) pd->falloff_curve->preset = CURVE_PRESET_LINE; pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; curvemap_reset(pd->falloff_curve->cm, &pd->falloff_curve->clipr, pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE); - curvemapping_changed(pd->falloff_curve, 0); + curvemapping_changed(pd->falloff_curve, FALSE); return pd; } diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index d551caea425..ed5ffbf463e 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -2435,7 +2435,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) tex->pd->falloff_curve->preset = CURVE_PRESET_LINE; tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE); - curvemapping_changed(tex->pd->falloff_curve, 0); + curvemapping_changed(tex->pd->falloff_curve, FALSE); } } } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index e66c0409192..c9a6ba0abe7 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1481,7 +1481,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect glBegin(GL_LINE_STRIP); if (cuma->table == NULL) - curvemapping_changed(cumap, 0); /* 0 = no remove doubles */ + curvemapping_changed(cumap, FALSE); cmp = cuma->table; /* first point */ @@ -1514,7 +1514,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect glPointSize(3.0f); bglBegin(GL_POINTS); for (a = 0; a < cuma->totpoint; a++) { - if (cmp[a].flag & SELECT) + if (cmp[a].flag & CUMA_SELECT) UI_ThemeColor(TH_TEXT_HI); else UI_ThemeColor(TH_TEXT); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index d78a677ea58..ce0ec310ac3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3647,7 +3647,7 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, fy *= mval_factor; for (a = 0; a < cuma->totpoint; a++) { - if (cmp[a].flag & SELECT) { + if (cmp[a].flag & CUMA_SELECT) { float origx = cmp[a].x, origy = cmp[a].y; cmp[a].x += fx; cmp[a].y += fy; @@ -3660,7 +3660,7 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, } } - curvemapping_changed(cumap, 0); /* no remove doubles */ + curvemapping_changed(cumap, FALSE); if (moved_point) { data->draglastx = mx; @@ -3727,7 +3727,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt fy = ((float)my - but->rect.ymin) / zoomy + offsy; curvemap_insert(cuma, fx, fy); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); changed = 1; } @@ -3756,12 +3756,12 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt /* loop through the curve segment table and find what's near the mouse. * 0.05 is kinda arbitrary, but seems to be what works nicely. */ for (i = 0; i <= CM_TABLE; i++) { - if ( (fabsf(fx - cmp[i].x) < 0.05f) && - (fabsf(fy - cmp[i].y) < 0.05f)) + if ((fabsf(fx - cmp[i].x) < 0.05f) && + (fabsf(fy - cmp[i].y) < 0.05f)) { curvemap_insert(cuma, fx, fy); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); changed = 1; @@ -3783,11 +3783,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt /* deselect all if this one is deselect. except if we hold shift */ if (event->shift == FALSE) { for (a = 0; a < cuma->totpoint; a++) - cmp[a].flag &= ~SELECT; - cmp[sel].flag |= SELECT; + cmp[a].flag &= ~CUMA_SELECT; + cmp[sel].flag |= CUMA_SELECT; } else - cmp[sel].flag ^= SELECT; + cmp[sel].flag ^= CUMA_SELECT; } else { /* move the view */ @@ -3822,12 +3822,13 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt /* deselect all, select one */ if (event->shift == FALSE) { for (a = 0; a < cuma->totpoint; a++) - cmp[a].flag &= ~SELECT; - cmp[data->dragsel].flag |= SELECT; + cmp[a].flag &= ~CUMA_SELECT; + cmp[data->dragsel].flag |= CUMA_SELECT; } } - else - curvemapping_changed(cumap, 1); /* remove doubles */ + else { + curvemapping_changed(cumap, TRUE); /* remove doubles */ + } } button_activate_state(C, but, BUTTON_STATE_EXIT); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 24dccb2eecf..54202caa16c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1622,7 +1622,7 @@ static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *U { CurveMapping *cumap = cumap_v; - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); } static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v) @@ -1630,7 +1630,7 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v) CurveMapping *cumap = cumap_v; curvemap_remove(cumap->cm + cumap->cur, SELECT); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); rna_update_cb(C, cb_v, NULL); } @@ -1672,26 +1672,26 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event) switch (event) { case 0: /* reset */ curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); break; case 1: cumap->curr = cumap->clipr; break; case 2: /* set vector */ curvemap_sethandle(cuma, 1); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); break; case 3: /* set auto */ curvemap_sethandle(cuma, 0); - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); break; case 4: /* extend horiz */ cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE; - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); break; case 5: /* extend extrapolate */ cuma->flag |= CUMA_EXTEND_EXTRAPOLATE; - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); break; } ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index 1f8fdd20dda..4ead26c04f3 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -47,8 +47,10 @@ typedef struct CurveMapPoint { } CurveMapPoint; /* curvepoint->flag */ -#define CUMA_SELECT 1 -#define CUMA_VECTOR 2 +enum { + CUMA_SELECT = 1, + CUMA_VECTOR = 2 +}; typedef struct CurveMap { short totpoint, flag; diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 15fdce09d83..5dafe77f9c1 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -79,7 +79,7 @@ static void rna_CurveMapping_clip_set(PointerRNA *ptr, int value) if (value) cumap->flag |= CUMA_DO_CLIP; else cumap->flag &= ~CUMA_DO_CLIP; - curvemapping_changed(cumap, 0); + curvemapping_changed(cumap, FALSE); } static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values) |