diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-05-31 15:47:04 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-05-31 15:47:04 +0400 |
commit | 2d8dd194ccd2aec3b27f145c488354fbc81b41fa (patch) | |
tree | 9451c400a52a4390d52f4a9176fd59df8e2d7a5c /source | |
parent | 57a91d7659a60933e76a761c1eb7000f9496773a (diff) |
== Action Editor ==
Small Action Editor feature to hopefully make keyframing quicker. Just press the IKEY in the Action Editor. Feedback on the (annoyance factor of the) popups welcome.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BIF_editaction.h | 1 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 91 | ||||
-rw-r--r-- | source/blender/src/editipo.c | 3 |
3 files changed, 89 insertions, 6 deletions
diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h index 2d92b120b9a..6e180418cd8 100644 --- a/source/blender/include/BIF_editaction.h +++ b/source/blender/include/BIF_editaction.h @@ -92,6 +92,7 @@ void snap_keys_to_frame(int snap_mode); void mirror_action_keys(short mirror_mode); void clean_shapekeys(struct Key *key); void clean_actionchannels(struct bAction *act); +void insertkey_action(void); /* Marker Operations */ void column_select_shapekeys(struct Key *key, int mode); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 4c698674bbf..e9b0e43b410 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2568,6 +2568,9 @@ void snap_keys_to_frame(int snap_mode) else if (key) { set_snap_meshchannels(key, snap_mode); } + else { + return; + } BIF_undo_push(str); allspace(REMAKEIPO, 0); @@ -2670,6 +2673,9 @@ void mirror_action_keys(short mirror_mode) else if (key) { mirror_meshchannels(key, mirror_mode); } + else { + return; + } BIF_undo_push(str); allspace(REMAKEIPO, 0); @@ -2678,6 +2684,75 @@ void mirror_action_keys(short mirror_mode) allqueue(REDRAWNLA, 0); } +/* This function allows the user to insert keyframes on the current + * frame from the Action Editor, using the current values of the channels + * to be keyframed. + */ +void insertkey_action(void) +{ + bAction *act; + Key *key; + IpoCurve *icu; + short mode; + float cfra, val; + + /* get data */ + act = G.saction->action; + key = get_action_mesh_key(); + cfra = frame_to_float(CFRA); + + if (act) { + bActionChannel *achan; + bConstraintChannel *conchan; + + /* ask user what to keyframe */ + mode = pupmenu("Insert Key%t|All Channels%x1|Only Selected Channels%x2"); + if (mode == 0) return; + + for (achan= act->chanbase.first; achan; achan=achan->next) { + if (EDITABLE_ACHAN(achan)) { + if (achan->ipo && (SEL_ACHAN(achan) || (mode == 1))) { + for (icu= achan->ipo->curve.first; icu; icu=icu->next) { + val = icu->curval; + insert_vert_ipo(icu, cfra, val); + } + } + + if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) { + for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) { + if (EDITABLE_CONCHAN(conchan)) { + if (conchan->ipo && (SEL_ACHAN(conchan) || (mode == 1))) { + for (icu= conchan->ipo->curve.first; icu; icu=icu->next) { + val = icu->curval; + insert_vert_ipo(icu, cfra, val); + } + } + } + } + } + } + } + } + else if (key) { + /* ask user if they want to insert a keyframe */ + mode = okee("Insert Keyframe?"); + if (mode == 0) return; + + if (key->ipo) { + for (icu= key->ipo->curve.first; icu; icu=icu->next) { + val = icu->curval; + insert_vert_ipo(icu, cfra, val); + } + } + } + + BIF_undo_push("Insert Key"); + allspace(REMAKEIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWNLA, 0); +} + static void select_all_keys_frames(bAction *act, short *mval, short *mvalo, int selectmode) { @@ -2886,7 +2961,7 @@ static void borderselect_function(void (*select_func)(bAction *act, select_func(act, mval, mvalo, SELECT_SUBTRACT); } - BIF_undo_push("Border select Action"); + BIF_undo_push("Border Select Action"); } static void clever_keyblock_names(Key *key, short* mval){ @@ -3255,7 +3330,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } } break; - + case KKEY: if (G.qual & LR_CTRLKEY) { markers_selectkeys_between(); @@ -3278,8 +3353,10 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case MKEY: if (G.qual & LR_SHIFTKEY) { /* mirror keyframes */ - val = pupmenu("Mirror Keys Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4"); - mirror_action_keys(val); + if (act || key) { + val = pupmenu("Mirror Keys Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4"); + mirror_action_keys(val); + } } else { /* marker operations */ @@ -3329,8 +3406,10 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case SKEY: if (mval[0]>=ACTWIDTH) { if(G.qual & LR_SHIFTKEY) { - val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3"); - snap_keys_to_frame(val); + if (act || key) { + val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3"); + snap_keys_to_frame(val); + } } else { if (act) diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 95e998d3496..ad5ffacf103 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -2426,6 +2426,9 @@ void common_insertkey(void) if(curarea->spacetype==SPACE_IPO) { insertkey_editipo(); } + else if(curarea->spacetype==SPACE_ACTION) { + insertkey_action(); + } else if(curarea->spacetype==SPACE_BUTS) { if(G.buts->mainb==CONTEXT_SHADING) { int tab= G.buts->tab[CONTEXT_SHADING]; |