diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-04-14 15:53:41 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-04-14 15:53:41 +0400 |
commit | 3ef247eed953ea28aca2bc92879ff1c32f04b7f4 (patch) | |
tree | 6b645679dd5046a483ec766105bb4c8144c3784b /source/blender/editors | |
parent | 2d17d8623910b7cbcb353d410a47b9c758d8bc41 (diff) |
FCurve Modifiers - "Limits" Modifier:
This new modifier clamps the values of the F-Curve to lie within specified bounds, much like Limit Location/Rotation/Scale constraints do. You can limit by time range(s) and/or value range(s).
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 41 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index a59ec1fd4c8..680273ae508 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -754,6 +754,43 @@ static void draw_modifier__envelope(uiBlock *block, FCurve *fcu, FModifier *fcm, /* --------------- */ +/* draw settings for limits modifier */ +static void draw_modifier__limits(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco, short *height, short width, short active, int rb_col) +{ + FMod_Limits *data= (FMod_Limits *)fcm->data; + const int togButWidth = 50; + const int textButWidth = ((width/2)-togButWidth); + + /* set the height */ + (*height) = 90; + + /* basic settings (backdrop + some padding) */ + //DRAW_BACKDROP((*height)); // XXX buggy... + + /* Draw Pairs of LimitToggle+LimitValue */ + uiBlockBeginAlign(block); + uiDefButBitI(block, TOGBUT, FCM_LIMIT_XMIN, B_FMODIFIER_REDRAW, "xMin", 10, *yco-30, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x value"); + uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 10+togButWidth, *yco-30, (textButWidth-5), 18, &data->rect.xmin, -FLT_MAX, FLT_MAX, 0.1,0.5,"Lowest x value to allow"); + uiBlockEndAlign(block); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOGBUT, FCM_LIMIT_XMAX, B_FMODIFIER_REDRAW, "XMax", 10+(width-(textButWidth-5)-togButWidth), *yco-30, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum x value"); + uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 10+(width-textButWidth-5), *yco-30, (textButWidth-5), 18, &data->rect.xmax, -FLT_MAX, FLT_MAX, 0.1,0.5,"Highest x value to allow"); + uiBlockEndAlign(block); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOGBUT, FCM_LIMIT_YMIN, B_FMODIFIER_REDRAW, "yMin", 10, *yco-52, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y value"); + uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 10+togButWidth, *yco-52, (textButWidth-5), 18, &data->rect.ymin, -FLT_MAX, FLT_MAX, 0.1,0.5,"Lowest y value to allow"); + uiBlockEndAlign(block); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOGBUT, FCM_LIMIT_YMAX, B_FMODIFIER_REDRAW, "YMax", 10+(width-(textButWidth-5)-togButWidth), *yco-52, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum y value"); + uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 10+(width-textButWidth-5), *yco-52, (textButWidth-5), 18, &data->rect.ymax, -FLT_MAX, FLT_MAX, 0.1,0.5,"Highest y value to allow"); + uiBlockEndAlign(block); +} + +/* --------------- */ + static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); @@ -810,6 +847,10 @@ static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fc case FMODIFIER_TYPE_ENVELOPE: /* Envelope */ draw_modifier__envelope(block, fcu, fcm, yco, &height, width, active, rb_col); break; + + case FMODIFIER_TYPE_LIMITS: /* Limits */ + draw_modifier__limits(block, fcu, fcm, yco, &height, width, active, rb_col); + break; default: /* unknown type */ height= 96; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 3aea32d64e7..52301ac1b0f 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1647,6 +1647,7 @@ EnumPropertyItem prop_fmodifier_types[] = { {FMODIFIER_TYPE_NOISE, "NOISE", "Noise", ""}, {FMODIFIER_TYPE_FILTER, "FILTER", "Filter", ""}, {FMODIFIER_TYPE_PYTHON, "PYTHON", "Python", ""}, + {FMODIFIER_TYPE_LIMITS, "LIMITS", "Limits", ""}, {0, NULL, NULL, NULL} }; |