diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-03-22 14:06:51 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-03-22 14:06:51 +0300 |
commit | 95e781c6015a9a061d496e705efe878a83020c27 (patch) | |
tree | f30ca02ed91c2bb3ab9c28d3f5add6ea23319731 /source/blender/src/editaction.c | |
parent | a7ee2674db4536f279a344b06070cfb214d2426b (diff) |
== Action Editor - Preview Range (Ctrl-Alt-P) ==
Quick feature for setting Preview Range in Action Editor: the hotkey Ctrl-Alt-P sets the Preview Range so that it matches the extents of the active action.
Diffstat (limited to 'source/blender/src/editaction.c')
-rw-r--r-- | source/blender/src/editaction.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 1a1bb9f4fb1..cf74c04678d 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -797,6 +797,36 @@ void *get_action_context (short *datatype) } } +/* Quick-tool for preview-range functionality in Action Editor for setting Preview-Range + * bounds to extents of Action, when Ctrl-Alt-P is used. Only available for actions. + */ +void action_previewrange_set (bAction *act) +{ + float start, end; + + /* sanity check */ + if (act == NULL) + return; + + /* calculate range + make sure it is adjusted for nla-scaling */ + calc_action_range(act, &start, &end, 0); + if (NLA_ACTION_SCALED) { + start= get_action_frame_inv(OBACT, start); + end= get_action_frame_inv(OBACT, end); + } + + /* set preview range */ + G.scene->r.psfra= start; + G.scene->r.pefra= end; + + BIF_undo_push("Set anim-preview range"); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWBUTSALL, 0); +} + /* **************************************************** */ /* ACTION CHANNEL GROUPS */ @@ -4454,7 +4484,9 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case PKEY: - if (G.qual & LR_CTRLKEY) /* set preview range */ + if (G.qual == (LR_CTRLKEY|LR_ALTKEY)) /* set preview range to range of action */ + action_previewrange_set(G.saction->action); + else if (G.qual & LR_CTRLKEY) /* set preview range */ anim_previewrange_set(); else if (G.qual & LR_ALTKEY) /* clear preview range */ anim_previewrange_clear(); |