diff options
Diffstat (limited to 'source/blender/editors/space_graph/graph_ops.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index f4cce29bda8..9b5fa3b744a 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -139,12 +139,16 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent /* Modal Operator init */ static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + wmWindow *win = CTX_wm_window(C); /* Change to frame that mouse is over before adding modal handler, * as user could click on a single frame (jump to frame) as well as * click-dragging over a range (modal scrubbing). */ graphview_cursor_setprops(C, op, event); - + + if (win->screen) + win->screen->scrubbing = true; + /* apply these changes first */ graphview_cursor_apply(C, op); @@ -156,9 +160,13 @@ static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e /* Modal event handling of cursor changing */ static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *event) { + wmWindow *win = CTX_wm_window(C); + /* execute the events */ switch (event->type) { case ESCKEY: + if (win->screen) + win->screen->scrubbing = false; return OPERATOR_FINISHED; case MOUSEMOVE: @@ -173,8 +181,12 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *ev /* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init * the modal op) doesn't work for some reason */ - if (event->val == KM_RELEASE) + if (event->val == KM_RELEASE) { + if (win->screen) + win->screen->scrubbing = false; + return OPERATOR_FINISHED; + } break; } @@ -429,6 +441,8 @@ void graphedit_operatortypes(void) WM_operatortype_append(GRAPH_OT_fmodifier_add); WM_operatortype_append(GRAPH_OT_fmodifier_copy); WM_operatortype_append(GRAPH_OT_fmodifier_paste); + + WM_operatortype_append(GRAPH_OT_widget_backdrop_transform); } void ED_operatormacros_graph(void) @@ -667,5 +681,7 @@ void graphedit_keymap(wmKeyConfig *keyconf) /* keyframes */ keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0); graphedit_keymap_keyframes(keyconf, keymap); + + WM_keymap_add_item(keymap, "GRAPH_OT_widget_backdrop_transform", WKEY, KM_PRESS, 0, 0); } |