diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-02-09 07:39:25 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-02-09 07:39:25 +0300 |
commit | eb848445fb44808aed86bc4238ab02c497c1eb2f (patch) | |
tree | 807946422493b46a3690262ddf46440ac00c533a /source/blender/editors/space_time/time_ops.c | |
parent | 52e1121669cdf4a0b23bbc41eb8d1d342c19ba87 (diff) |
2.5 - Assorted View2D-Related Cleanups
* Removed Sequencer's own 'border zoom' tool. There is a generic one in View2D that should be used instead.
* Changed the hotkey for View2D's version of borderzoom to Shift-B
* Fixed a few hotkey mentions entries in old menus
* Added set start/end frame operators for TimeLine. (SKEY and EKEY)
* Fixed various issues in Graph Editor
- channels area is now drawn wide enough to show the 'protect' toggles without needing to scroll
- new Graph Editors have 'auto-snap' enabled by default
Diffstat (limited to 'source/blender/editors/space_time/time_ops.c')
-rw-r--r-- | source/blender/editors/space_time/time_ops.c | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index 51808fbf623..b47afaf0cde 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -44,6 +44,8 @@ #include "UI_interface.h" #include "UI_view2d.h" +#include "ED_screen.h" + #include "RNA_access.h" #include "RNA_define.h" @@ -51,17 +53,96 @@ #include "WM_types.h" -/* *************************************************/ +/* ****************** Start/End Frame Operators *******************************/ + +static int time_set_sfra_exec (bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + int frame= CFRA; + + if (scene == NULL) + return OPERATOR_CANCELLED; + + /* if 'end frame' (Preview Range or Actual) is less than 'frame', + * clamp 'frame' to 'end frame' + */ + if (PEFRA < frame) frame= PEFRA; + + /* if Preview Range is defined, set the 'start' frame for that */ + if (scene->r.psfra) + scene->r.psfra= frame; + else + scene->r.sfra= frame; + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + + return OPERATOR_FINISHED; +} + +void TIME_OT_start_frame_set (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Set Start Frame"; + ot->idname= "TIME_OT_start_frame_set"; + + /* api callbacks */ + ot->exec= time_set_sfra_exec; + ot->poll= ED_operator_timeline_active; + + // XXX properties??? +} + + +static int time_set_efra_exec (bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + int frame= CFRA; + + if (scene == NULL) + return OPERATOR_CANCELLED; + + /* if 'start frame' (Preview Range or Actual) is greater than 'frame', + * clamp 'frame' to 'end frame' + */ + if (PSFRA > frame) frame= PSFRA; + + /* if Preview Range is defined, set the 'end' frame for that */ + if (scene->r.pefra) + scene->r.pefra= frame; + else + scene->r.efra= frame; + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + + return OPERATOR_FINISHED; +} + +void TIME_OT_end_frame_set (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Set End Frame"; + ot->idname= "TIME_OT_end_frame_set"; + + /* api callbacks */ + ot->exec= time_set_efra_exec; + ot->poll= ED_operator_timeline_active; + + // XXX properties??? +} /* ************************** registration **********************************/ void time_operatortypes(void) { - + WM_operatortype_append(TIME_OT_start_frame_set); + WM_operatortype_append(TIME_OT_end_frame_set); } void time_keymap(wmWindowManager *wm) { + ListBase *keymap= WM_keymap_listbase(wm, "TimeLine", SPACE_TIME, 0); + WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0); } |