diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-06-08 11:31:03 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-06-08 11:31:03 +0400 |
commit | 4a9aa0e064574dfc87a6f8c1084327b07256e0ce (patch) | |
tree | 0c1588e6bcac77df9e21a3ba7ae9403912eb5532 | |
parent | 93a3b2b78a443c99cee9153cfff69127ed2fb336 (diff) |
== Action/NLA ==
* Snap and Mirror tools for the Action Editor, now respect NLA scaling again. I accidentally omitted the relevant code when recoding.
* Snap tool in the NLA Editor, now works for the keyframes displayed for each object too. There's one case I've to check up on later, as there might be interesting conflicts.
-rw-r--r-- | source/blender/src/editaction.c | 25 | ||||
-rw-r--r-- | source/blender/src/editnla.c | 29 |
2 files changed, 48 insertions, 6 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 2fc0390b7f3..95a61707141 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -481,7 +481,7 @@ int get_nearest_key_num (Key *key, short *mval, float *x) * x coordinate. */ int num; - float ybase, y; + float y; areamouseco_to_ipoco(G.v2d, mval, x, &y); num = (int) ((CHANNELHEIGHT/2 - y) / (CHANNELHEIGHT+CHANNELSKIP)); @@ -1174,7 +1174,13 @@ void snap_action_keys(short mode) /* snap to frame */ for (ale= act_data.first; ale; ale= ale->next) { - snap_ipo_keys(ale->key_data, mode); + if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) { + actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1); + snap_ipo_keys(ale->key_data, mode); + actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1); + } + else + snap_ipo_keys(ale->key_data, mode); } BLI_freelistN(&act_data); @@ -1226,7 +1232,13 @@ void mirror_action_keys(short mode) /* mirror */ for (ale= act_data.first; ale; ale= ale->next) { - mirror_ipo_keys(ale->key_data, mode); + if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) { + actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1); + mirror_ipo_keys(ale->key_data, mode); + actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1); + } + else + mirror_ipo_keys(ale->key_data, mode); } BLI_freelistN(&act_data); @@ -2319,18 +2331,19 @@ static void mouse_action (int selectmode) { void *data; short datatype; - bAction *act; - bActionChannel *achan; + bAction *act= NULL; + bActionChannel *achan= NULL; bConstraintChannel *conchan= NULL; IpoCurve *icu= NULL; TimeMarker *marker; void *act_channel; short sel, act_type; - float selx; + float selx; /* determine what type of data we are operating on */ data = get_action_context(&datatype); if (data == NULL) return; + if (datatype == ACTCONT_ACTION) act= (bAction *)data; act_channel= get_nearest_action_key(&selx, &sel, &act_type, &achan); marker=find_nearest_marker(1); diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 16952df953c..4b6870581c1 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -78,6 +78,7 @@ #include "BSE_editnla_types.h" #include "BSE_headerbuttons.h" #include "BSE_drawipo.h" +#include "BSE_editaction_types.h" #include "BSE_trans_types.h" #include "BSE_edit.h" #include "BSE_filesel.h" @@ -420,9 +421,37 @@ void snap_action_strips(int snap_mode) } } } + + /* object has ipo */ + if (base->object->ipo) { + snap_ipo_keys(base->object->ipo, snap_mode); + } + + /* object has action */ + if (base->object->action) { + ListBase act_data = {NULL, NULL}; + bActListElem *ale; + int filter; + + /* filter action data */ + filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS); + actdata_filter(&act_data, filter, base->object->action, ACTCONT_ACTION); + + /* snap to frame */ + for (ale= act_data.first; ale; ale= ale->next) { + actstrip_map_ipo_keys(base->object, ale->key_data, 0, 1); + snap_ipo_keys(ale->key_data, snap_mode); + actstrip_map_ipo_keys(base->object, ale->key_data, 1, 1); + } + BLI_freelistN(&act_data); + + remake_action_ipos(base->object->action); + } } BIF_undo_push("Snap NLA strips"); allqueue (REDRAWVIEW3D, 0); + allqueue (REMAKEIPO, 0); + allqueue (REDRAWIPO, 0); allqueue (REDRAWACTION, 0); allqueue (REDRAWNLA, 0); } |