[Bf-blender-cvs] [49c36d34307] master: Tracking: Move Lock Selection to an own operator

Sergey Sharybin noreply at git.blender.org
Fri Sep 13 12:08:31 CEST 2019


Commit: 49c36d34307ae510426455f834973b53f7d1db35
Author: Sergey Sharybin
Date:   Fri Sep 13 11:38:16 2019 +0200
Branches: master
https://developer.blender.org/rB49c36d34307ae510426455f834973b53f7d1db35

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.

===================================================================

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	source/blender/editors/space_clip/clip_intern.h
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_clip/space_clip.c

===================================================================

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index b9c8e73dab2..a4ae34b445c 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2661,8 +2661,7 @@ def km_clip_editor(params):
         ("clip.keyframe_delete", {"type": 'I', "value": 'PRESS', "alt": True}, None),
         ("clip.join_tracks", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
         op_menu("CLIP_MT_tracking_context_menu", params.context_menu_event),
-        ("wm.context_toggle", {"type": 'L', "value": 'PRESS'},
-         {"properties": [("data_path", 'space_data.lock_selection')]}),
+        ("clip.lock_selection_toggle", {"type": 'L', "value": 'PRESS'}, None),
         ("wm.context_toggle", {"type": 'D', "value": 'PRESS', "alt": True},
          {"properties": [("data_path", 'space_data.show_disabled')]}),
         ("wm.context_toggle", {"type": 'S', "value": 'PRESS', "alt": True},
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 8599de9f16f..1fae4c91a48 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -108,6 +108,8 @@ void CLIP_OT_set_scene_frames(wmOperatorType *ot);
 
 void CLIP_OT_cursor_set(struct wmOperatorType *ot);
 
+void CLIP_OT_lock_selection_toggle(struct wmOperatorType *ot);
+
 /* clip_toolbar.c */
 struct ARegion *ED_clip_has_properties_region(struct ScrArea *sa);
 
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)
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index c1cb975447f..2964a95648a 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -452,6 +452,7 @@ static void clip_operatortypes(void)
   WM_operatortype_append(CLIP_OT_prefetch);
   WM_operatortype_append(CLIP_OT_set_scene_frames);
   WM_operatortype_append(CLIP_OT_cursor_set);
+  WM_operatortype_append(CLIP_OT_lock_selection_toggle);
 
   /* ** tracking_ops.c ** */



More information about the Bf-blender-cvs mailing list