diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 13:19:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 13:20:53 +0300 |
commit | ba798e0412cdcb5e6a10464ced105c8d6708c4b7 (patch) | |
tree | 6c2b781f07ead1f06342616187128b689fb7bf0f /source/blender/editors/space_clip/clip_ops.c | |
parent | 3370af2dc1ced49099a4a7e6e15f3ffd009d91ca (diff) |
Image/Clip Space: Add view center to cursor operators
D5932 by @a.monti with edits
Diffstat (limited to 'source/blender/editors/space_clip/clip_ops.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 446e3408d8c..192449a219d 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -993,6 +993,36 @@ void CLIP_OT_view_all(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Center View To Cursor Operator + * \{ */ + +static int view_center_cursor_exec(bContext *C, wmOperator *UNUSED(op)) +{ + SpaceClip *sc = CTX_wm_space_clip(C); + ARegion *ar = CTX_wm_region(C); + + clip_view_center_to_point(sc, sc->cursor[0], sc->cursor[1]); + + ED_region_tag_redraw(ar); + + return OPERATOR_FINISHED; +} + +void CLIP_OT_view_center_cursor(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Center View to Cursor"; + ot->description = "Center the view so that the cursor is in the middle of the view"; + ot->idname = "CLIP_OT_view_center_cursor"; + + /* api callbacks */ + ot->exec = view_center_cursor_exec; + ot->poll = ED_space_clip_maskedit_poll; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name View Selected Operator * \{ */ |