Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-02-09 07:39:25 +0300
committerJoshua Leung <aligorith@gmail.com>2009-02-09 07:39:25 +0300
commiteb848445fb44808aed86bc4238ab02c497c1eb2f (patch)
tree807946422493b46a3690262ddf46440ac00c533a /source/blender/editors/space_time
parent52e1121669cdf4a0b23bbc41eb8d1d342c19ba87 (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')
-rw-r--r--source/blender/editors/space_time/space_time.c2
-rw-r--r--source/blender/editors/space_time/time_header.c4
-rw-r--r--source/blender/editors/space_time/time_ops.c85
3 files changed, 86 insertions, 5 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 94ab1064eec..5b36939a471 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -314,7 +314,7 @@ void ED_spacetype_time(void)
art->init= time_main_area_init;
art->draw= time_main_area_draw;
art->listener= time_main_area_listener;
- //art->keymap= time_keymap;
+ art->keymap= time_keymap;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index 7672325c114..e4acf052534 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -222,9 +222,9 @@ static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(stime->flag & TIME_DRAWFRAMES)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
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);
}