From 49c36d34307ae510426455f834973b53f7d1db35 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 13 Sep 2019 11:38:16 +0200 Subject: Tracking: Move Lock Selection to an own operator There are no functional changes as far as users are concerned, just allows to mark operator as safe to be run from a locked interface. --- source/blender/editors/space_clip/clip_ops.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/blender/editors/space_clip/clip_ops.c') diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 31845036eab..bc1026180a3 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1748,6 +1748,31 @@ void CLIP_OT_cursor_set(wmOperatorType *ot) 10.0f); } +/********************** Toggle lock to selection operator *********************/ + +static int lock_selection_togglee_exec(bContext *C, wmOperator *UNUSED(op)) +{ + SpaceClip *space_clip = CTX_wm_space_clip(C); + space_clip->flag ^= SC_LOCK_SELECTION; + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL); + return OPERATOR_FINISHED; +} + +void CLIP_OT_lock_selection_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Toggle Lock Selection"; + ot->description = "Toggle Lock Selection option of the current clip editor"; + ot->idname = "CLIP_OT_lock_selection_toggle"; + + /* api callbacks */ + ot->poll = ED_space_clip_poll; + ot->exec = lock_selection_togglee_exec; + + /* flags */ + ot->flag = OPTYPE_LOCK_BYPASS; +} + /********************** macros *********************/ void ED_operatormacros_clip(void) -- cgit v1.2.3