diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-08-22 12:52:57 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-08-22 12:52:57 +0400 |
commit | 59016f9f5da298568f0d7c1a9af98b03aa6477ad (patch) | |
tree | c949cd0e45ee11a8c57c4528546233edf8dfaf0b /source | |
parent | 941ee4139ea1583b6c4e83d5ed7ad693f8709db9 (diff) |
Bugfix #7083:
The menu entries for changing Interpolation and Extrapolation modes in the Action Editor weren't working properly (at all).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BIF_editaction.h | 52 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 20 | ||||
-rw-r--r-- | source/blender/src/editipo_mods.c | 5 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 20 |
4 files changed, 57 insertions, 40 deletions
diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h index 4d171a8ad86..5e1f8bc8ad7 100644 --- a/source/blender/include/BIF_editaction.h +++ b/source/blender/include/BIF_editaction.h @@ -25,7 +25,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): 2007, Joshua Leung, Action Editor Recode * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -41,14 +41,16 @@ #define ACTWIDTH (G.saction->actwidth) /* Some types for easier type-testing */ -#define ACTTYPE_NONE 0 -#define ACTTYPE_ACHAN 1 -#define ACTTYPE_CONCHAN 2 -#define ACTTYPE_ICU 3 -#define ACTTYPE_FILLIPO 4 -#define ACTTYPE_FILLCON 5 -#define ACTTYPE_IPO 6 -#define ACTTYPE_SHAPEKEY 7 +enum { + ACTTYPE_NONE= 0, + ACTTYPE_ACHAN, + ACTTYPE_CONCHAN, + ACTTYPE_ICU, + ACTTYPE_FILLIPO, + ACTTYPE_FILLCON, + ACTTYPE_IPO, + ACTTYPE_SHAPEKEY +}; /* Macros for easier/more consistant state testing */ #define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0) @@ -68,17 +70,27 @@ #define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) /* constants for setting ipo-interpolation type */ -#define SET_IPO_POPUP 0 -#define SET_IPO_CONSTANT 1 -#define SET_IPO_LINEAR 2 -#define SET_IPO_BEZIER 3 +enum { + SET_IPO_MENU = -1, + SET_IPO_POPUP = 0, + + SET_IPO_CONSTANT, + SET_IPO_LINEAR, + SET_IPO_BEZIER, +}; + /* constants for setting ipo-extrapolation type */ -#define SET_EXTEND_POPUP 10 -#define SET_EXTEND_CONSTANT 11 -#define SET_EXTEND_EXTRAPOLATION 12 -#define SET_EXTEND_CYCLIC 13 -#define SET_EXTEND_CYCLICEXTRAPOLATION 14 +enum { + + SET_EXTEND_MENU = 9, + SET_EXTEND_POPUP = 10, + + SET_EXTEND_CONSTANT, + SET_EXTEND_EXTRAPOLATION, + SET_EXTEND_CYCLIC, + SET_EXTEND_CYCLICEXTRAPOLATION +}; struct bAction; struct bActionChannel; @@ -112,7 +124,7 @@ void bottom_sel_action(void); /* IPO/Handle Types */ void sethandles_action_keys(int code); -void action_set_ipo_flags(int mode); +void action_set_ipo_flags(short mode, short event); /* Select */ void borderselect_action(void); @@ -122,7 +134,7 @@ void deselect_actionchannels(struct bAction *act, short test); int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode); void select_actionchannel_by_name (struct bAction *act, char *name, int select); -/* */ +/* ShapeKey stuff */ struct Key *get_action_mesh_key(void); int get_nearest_key_num(struct Key *key, short *mval, float *x); void *get_nearest_act_channel(short mval[], short *ret_type); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 33e465640be..9ecb958b567 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -1507,13 +1507,13 @@ void clean_action (void) /* this function combines several features related to setting * various ipo extrapolation/interpolation */ -void action_set_ipo_flags (int mode) +void action_set_ipo_flags (short mode, short event) { ListBase act_data = {NULL, NULL}; bActListElem *ale; void *data; short datatype; - int filter, event; + int filter; /* determine what type of data we are operating on */ data = get_action_context(&datatype); @@ -1530,7 +1530,7 @@ void action_set_ipo_flags (int mode) "Extrapolation %x12|" "Cyclic %x13|" "Cyclic extrapolation %x14"); - if(event < 1) return; + if (event < 1) return; } break; case SET_IPO_POPUP: @@ -1541,16 +1541,20 @@ void action_set_ipo_flags (int mode) "Constant %x1|" "Linear %x2|" "Bezier %x3"); - if(event < 1) return; + if (event < 1) return; } break; + case SET_IPO_MENU: /* called from menus */ + case SET_EXTEND_MENU: + break; + default: /* weird, unhandled case */ return; } /* filter data */ - filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS); + filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS); actdata_filter(&act_data, filter, data, datatype); /* loop through setting flags */ @@ -1560,6 +1564,7 @@ void action_set_ipo_flags (int mode) /* depending on the mode */ switch (mode) { case SET_EXTEND_POPUP: /* extrapolation */ + case SET_EXTEND_MENU: { switch (event) { case SET_EXTEND_CONSTANT: @@ -1578,6 +1583,7 @@ void action_set_ipo_flags (int mode) } break; case SET_IPO_POPUP: /* interpolation */ + case SET_IPO_MENU: { setipotype_ipo(ipo, event); } @@ -2824,7 +2830,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) short val= evt->val; short mousebut = L_MOUSE; - if(curarea->win==0) return; + if (curarea->win==0) return; saction= curarea->spacedata.first; if (!saction) @@ -3020,7 +3026,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case TKEY: if (G.qual & LR_SHIFTKEY) - action_set_ipo_flags(SET_IPO_POPUP); + action_set_ipo_flags(SET_IPO_POPUP, 0); else if (G.qual & LR_CTRLKEY) { val= pupmenu("Time value%t|Frames %x1|Seconds%x2"); diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c index 2fc4f458e01..1f12f3863fe 100644 --- a/source/blender/src/editipo_mods.c +++ b/source/blender/src/editipo_mods.c @@ -872,9 +872,8 @@ void setipotype_ipo(Ipo *ipo, int code) void setexprap_ipoloop(Ipo *ipo, int code) { IpoCurve *icu; - - /* Loop through each curve in the Ipo - */ + + /* Loop through each curve in the Ipo */ for (icu=ipo->curve.first; icu; icu=icu->next) icu->extrap= code; } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 4072dd042b4..1c34bdbaeaf 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -682,13 +682,13 @@ static void do_action_keymenu_intpolmenu(void *arg, int event) switch(event) { case ACTMENU_KEY_INTERP_CONST: - action_set_ipo_flags(SET_IPO_CONSTANT); + action_set_ipo_flags(SET_IPO_MENU, SET_IPO_CONSTANT); break; case ACTMENU_KEY_INTERP_LINEAR: - action_set_ipo_flags(SET_IPO_LINEAR); + action_set_ipo_flags(SET_IPO_MENU, SET_IPO_LINEAR); break; case ACTMENU_KEY_INTERP_BEZIER: - action_set_ipo_flags(SET_IPO_BEZIER); + action_set_ipo_flags(SET_IPO_MENU, SET_IPO_BEZIER); break; } @@ -705,15 +705,15 @@ static uiBlock *action_keymenu_intpolmenu(void *arg_unused) uiBlockSetButmFunc(block, do_action_keymenu_intpolmenu, NULL); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Constant", 0, yco-=20, + "Constant|Shift T, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_KEY_INTERP_CONST, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Linear", 0, yco-=20, + "Linear|Shift T, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_KEY_INTERP_LINEAR, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Bezier", 0, yco-=20, + "Bezier|Shift T, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_KEY_INTERP_BEZIER, ""); @@ -728,16 +728,16 @@ static void do_action_keymenu_extendmenu(void *arg, int event) switch(event) { case ACTMENU_KEY_EXTEND_CONST: - action_set_ipo_flags(SET_EXTEND_CONSTANT); + action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CONSTANT); break; case ACTMENU_KEY_EXTEND_EXTRAPOLATION: - action_set_ipo_flags(SET_EXTEND_EXTRAPOLATION); + action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_EXTRAPOLATION); break; case ACTMENU_KEY_EXTEND_CYCLIC: - action_set_ipo_flags(SET_EXTEND_CYCLIC); + action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLIC); break; case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION: - action_set_ipo_flags(SET_EXTEND_CYCLICEXTRAPOLATION); + action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLICEXTRAPOLATION); break; } |