Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-04-29 00:51:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-29 00:51:44 +0400
commit6b170dcfd70a32684f3c6b15e54d15f0c5ff6316 (patch)
tree64a6718bbfcc1920a13822a4e07104dddac3217c /source
parentc3ddd1169c43467462f8809e2b05e447933ecf00 (diff)
fix for reset brushes curve setting a flipped curve
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_templates.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4c79b57a16d..458ca9edc5c 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1893,32 +1893,45 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
return block;
}
+/* only for curvemap_tools_dofunc */
+enum {
+ UICURVE_FUNC_RESET_NEG,
+ UICURVE_FUNC_RESET_POS,
+ UICURVE_FUNC_RESET_VIEW,
+ UICURVE_FUNC_HANDLE_VECTOR,
+ UICURVE_FUNC_HANDLE_AUTO,
+ UICURVE_FUNC_EXTEND_HOZ,
+ UICURVE_FUNC_EXTEND_EXP,
+};
+
static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
{
CurveMapping *cumap = cumap_v;
CurveMap *cuma = cumap->cm + cumap->cur;
switch (event) {
- case 0: /* reset */
- curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
+ case UICURVE_FUNC_RESET_NEG:
+ case UICURVE_FUNC_RESET_POS: /* reset */
+ curvemap_reset(cuma, &cumap->clipr, cumap->preset,
+ (event == -1) ? CURVEMAP_SLOPE_NEGATIVE : CURVEMAP_SLOPE_POSITIVE);
curvemapping_changed(cumap, FALSE);
break;
- case 1:
+ case UICURVE_FUNC_RESET_VIEW:
cumap->curr = cumap->clipr;
break;
- case 2: /* set vector */
+ case UICURVE_FUNC_HANDLE_VECTOR: /* set vector */
curvemap_sethandle(cuma, 1);
curvemapping_changed(cumap, FALSE);
break;
- case 3: /* set auto */
+ case UICURVE_FUNC_HANDLE_AUTO: /* set auto */
curvemap_sethandle(cuma, 0);
curvemapping_changed(cumap, FALSE);
break;
- case 4: /* extend horiz */
+ case UICURVE_FUNC_EXTEND_HOZ: /* extend horiz */
cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
curvemapping_changed(cumap, FALSE);
break;
- case 5: /* extend extrapolate */
+ case UICURVE_FUNC_EXTEND_EXP: /* extend extrapolate */
cuma->flag |= CUMA_EXTEND_EXTRAPOLATE;
curvemapping_changed(cumap, FALSE);
break;
@@ -1935,17 +1948,17 @@ static uiBlock *curvemap_tools_func(bContext *C, ARegion *ar, void *cumap_v)
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_HOZ, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_EXP, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_POS, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1963,13 +1976,13 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y,
- menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_NEG, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);