[Bf-extensions-cvs] [d116731] master: Storypencil: Add new shotcut to switch

Antonio Vazquez noreply at git.blender.org
Tue Nov 29 16:58:13 CET 2022


Commit: d116731b99378a1e37ed6bce1c06f6cf6bac91b2
Author: Antonio Vazquez
Date:   Fri Nov 25 16:40:28 2022 +0100
Branches: master
https://developer.blender.org/rBACd116731b99378a1e37ed6bce1c06f6cf6bac91b2

Storypencil: Add new shotcut to switch

After receiving some feedback, we have added this shortcut:

In VSE window: `Tab` to switch to Edit mode

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

M	storypencil/__init__.py
M	storypencil/synchro.py

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

diff --git a/storypencil/__init__.py b/storypencil/__init__.py
index b8f4536..1abd026 100644
--- a/storypencil/__init__.py
+++ b/storypencil/__init__.py
@@ -7,7 +7,7 @@ bl_info = {
     "name": "Storypencil - Storyboard Tools",
     "description": "Storyboard tools",
     "author": "Antonio Vazquez, Matias Mendiola, Daniel Martinez Lara, Rodrigo Blaas",
-    "version": (1, 1, 0),
+    "version": (1, 1, 1),
     "blender": (3, 3, 0),
     "location": "",
     "warning": "",
@@ -61,6 +61,7 @@ classes = (
     synchro.STORYPENCIL_OT_SetSyncMainOperator,
     synchro.STORYPENCIL_OT_AddSecondaryWindowOperator,
     synchro.STORYPENCIL_OT_Switch,
+    synchro.STORYPENCIL_OT_TabSwitch,
     render.STORYPENCIL_OT_RenderAction,
     ui.STORYPENCIL_PT_Settings,
     ui.STORYPENCIL_PT_SettingsNew,
@@ -86,10 +87,29 @@ def save_mode(self, context):
                 bpy.ops.wm.window_close(c)
 
 
+addon_keymaps = []
+def register_keymaps():
+    addon = bpy.context.window_manager.keyconfigs.addon
+    km = addon.keymaps.new(name="Sequencer", space_type="SEQUENCE_EDITOR")
+    kmi = km.keymap_items.new(
+        idname="storypencil.tabswitch",
+        type="TAB",
+        value="PRESS",
+        shift=False, ctrl=False, alt = False, oskey=False,
+        )
+
+    addon_keymaps.append((km, kmi))
+
+def unregister_keymaps():
+    for km, kmi in addon_keymaps:
+        km.keymap_items.remove(kmi)
+    addon_keymaps.clear()
+
 def register():
     from bpy.utils import register_class
     for cls in classes:
         register_class(cls)
+    register_keymaps()
 
     Scene.storypencil_scene_duration = IntProperty(
         name="Scene Duration",
@@ -178,6 +198,8 @@ def register():
 
 
 def unregister():
+    unregister_keymaps()
+
     from bpy.utils import unregister_class
     for cls in reversed(classes):
         unregister_class(cls)
diff --git a/storypencil/synchro.py b/storypencil/synchro.py
index ecdf4cd..a089411 100644
--- a/storypencil/synchro.py
+++ b/storypencil/synchro.py
@@ -781,3 +781,18 @@ class STORYPENCIL_OT_Switch(Operator):
                                     area.spaces.active.region_3d.view_perspective = 'CAMERA'
 
         return {"FINISHED"}
+
+
+class STORYPENCIL_OT_TabSwitch(Operator):
+    bl_idname = "storypencil.tabswitch"
+    bl_label = "Switch using tab key"
+    bl_description = "Wrapper used to handle the Tab key to switch"
+    bl_options = {'INTERNAL'}
+
+    def execute(self, context):
+        if context.scene.storypencil_use_new_window:
+            bpy.ops.storypencil.sync_set_main('INVOKE_DEFAULT', True)
+        else:
+            bpy.ops.storypencil.switch('INVOKE_DEFAULT', True)
+
+        return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list