diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-05-08 15:10:09 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-05-08 15:10:09 +0300 |
commit | c79fc710b3f97e5bcf8db59fc358d430617e08c9 (patch) | |
tree | e541e7600529c471a366a26e047ed6bc375d9561 /source | |
parent | 6950faa24eff7bf756ebed7e3d86e37966cabfc4 (diff) |
Keymap: Special keymap for clip editor scrubbing area
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4825
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/animation/anim_scrubbing.c | 7 | ||||
-rw-r--r-- | source/blender/editors/include/ED_scrubbing.h | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 4 |
4 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/animation/anim_scrubbing.c b/source/blender/editors/animation/anim_scrubbing.c index a22d1b494fc..507d48cad31 100644 --- a/source/blender/editors/animation/anim_scrubbing.c +++ b/source/blender/editors/animation/anim_scrubbing.c @@ -155,6 +155,13 @@ void ED_scrubbing_draw(const ARegion *ar, GPU_matrix_pop_projection(); } +bool ED_event_in_scrubbing_region(const ARegion *ar, const wmEvent *event) +{ + rcti rect = ar->winrct; + rect.ymin = rect.ymax - UI_SCRUBBING_MARGIN_Y; + return BLI_rcti_isect_pt(&rect, event->x, event->y); +} + void ED_channel_search_draw(const bContext *C, ARegion *ar, bDopeSheet *dopesheet) { GPU_matrix_push_projection(); diff --git a/source/blender/editors/include/ED_scrubbing.h b/source/blender/editors/include/ED_scrubbing.h index cc225723f64..26d9f3d923f 100644 --- a/source/blender/editors/include/ED_scrubbing.h +++ b/source/blender/editors/include/ED_scrubbing.h @@ -27,12 +27,15 @@ struct bContext; struct View2DGrid; struct bDopeSheet; +struct wmEvent; void ED_scrubbing_draw(const struct ARegion *ar, const struct Scene *scene, bool display_seconds, bool discrete_frames); +bool ED_event_in_scrubbing_region(const struct ARegion *ar, const struct wmEvent *event); + void ED_channel_search_draw(const struct bContext *C, struct ARegion *ar, struct bDopeSheet *dopesheet); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 6fe2b5eb37d..fe70957890f 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -50,6 +50,7 @@ #include "ED_screen.h" #include "ED_screen_types.h" #include "ED_space_api.h" +#include "ED_scrubbing.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" @@ -1566,13 +1567,6 @@ static bool event_in_markers_region(const ARegion *ar, const wmEvent *event) return BLI_rcti_isect_pt(&rect, event->x, event->y); } -static bool event_in_scrubbing_region(const ARegion *ar, const wmEvent *event) -{ - rcti rect = ar->winrct; - rect.ymin = rect.ymax - UI_SCRUBBING_MARGIN_Y; - return BLI_rcti_isect_pt(&rect, event->x, event->y); -} - /** * \param ar: Region, may be NULL when adding handlers for \a sa. */ @@ -1620,7 +1614,7 @@ static void ed_default_handlers( /* time-scrubbing */ keymap = WM_keymap_ensure(wm->defaultconf, "Scrubbing", 0, 0); - WM_event_add_keymap_handler_poll(handlers, keymap, event_in_scrubbing_region); + WM_event_add_keymap_handler_poll(handlers, keymap, ED_event_in_scrubbing_region); /* frame changing and timeline operators (for time spaces) */ keymap = WM_keymap_ensure(wm->defaultconf, "Animation", 0, 0); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 3397c5295f5..6ebecbf3fd5 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1002,9 +1002,13 @@ static void clip_preview_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ + keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Scrubbing", SPACE_CLIP, RGN_TYPE_PREVIEW); + WM_event_add_keymap_handler_poll(&ar->handlers, keymap, ED_event_in_scrubbing_region); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0); WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); |