Page MenuHome

Python: Setting shortcuts to an operator get overridden by a tool, and there is no way to get around it
Confirmed, NormalPublic


My addon for the vse overwrites the 'grab' tool with a special operator that wraps the current grab tool and adds my own that runs at the same time to add more features. in the past, ive replaced all shortcuts to the current tool to point to mine, and it works fine. In 2.83 since the toolbar was added, this is no longer possible.

Running the following code:

import bpy

bl_info = {
    "name": "VSE Quick Functions Test",
    "description": "",
    "author": "Snu",
    "version": (2, 82, 2),
    "blender": (2, 82, 0),
    "category": "Sequencer"

class VSEQFSelectGrab(bpy.types.Operator):
    bl_idname = "vseqf.select_grab"
    bl_label = "Grab/Move Sequence"

    def invoke(self, context, event):
        print('operator is invoked')
        return {'FINISHED'}

def register():
    keymap ='Sequencer', space_type='SEQUENCE_EDITOR', region_type='WINDOW')
    keymapitems = keymap.keymap_items'vseqf.select_grab', 'LEFTMOUSE', 'PRESS')'vseqf.select_grab', 'RIGHTMOUSE', 'PRESS')

if __name__ == "__main__":

will cause the new operator to run on click-drag if a strip is not selected, but once its selected and a click-drag is done again, the operator will not run.

a video to illustrate the issue:

The main issue is that the select tool seems to be overwriting the keymap I set (but only partially...?), but there is NO WAY to change the tool's keymap...
I have tried in my addon's register function doing:

keymap = bpy.context.window_manager.keyconfigs.default.keymaps['Sequencer Tool: Select'].keymap_items

and adding my own operator there... which works after blender has started, but that tool keymap doesnt yet exist when my addon is registered....

Note that adding my own tool works, and the operator always runs... but there seems to be no way to remove/disable a builtin tool! And I cant even find a way to set my own tool as the default/current selected tool, or put it at the top of the list.

I am completely at a loss of what to do here and have been fighting this since the release of 2.83, and I can't update my addon until I find some kind of solution...

Event Timeline

Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Mon, Jun 29, 4:16 PM