Overwrite Shortcuts temporarily

Hey there… Is there a way to overwrite Shortcuts temporarily.
I am in modal mode and want to use the keys from 1-9
This way I can get the keys: event.type == ‘ONE’

But unfortunately my layers switch too. Is it possible to disable/overwrite shortcuts in modal mode?

Would be great if someone can help me!
Thanks in advance!

Andreas

Hi ndee,

ran this code in the console. Took out the layers keymaps ok.


>>> x = C.window_manager.keyconfigs['Blender'].keymaps['3D View'].keymap_items
>>> x
bpy.data.window_managers['WinMan'].keymap_items

>>> list = [keymap for keymap in x if keymap.name == 'Layers']
>>> list
[bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem, bpy.data.window_managers['WinMan']...KeyMapItem]

>>> for km in list: km.active = False

Set active = True to reactivate them.

PS use more sensible names than x and especially list.

Thanks alot batFINGER!!
Works perfect! :slight_smile: