1 # SPDX-FileCopyrightText: 2010-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 from typing
import List
, Tuple
9 addon_keymaps
: List
[Tuple
[bpy
.types
.KeyMap
, bpy
.types
.KeyMapItem
]] = []
12 def register() -> None:
13 wm
= bpy
.context
.window_manager
14 if wm
.keyconfigs
.addon
is None:
15 # This happens when Blender is running in the background.
18 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
="File Browser Main", space_type
="FILE_BROWSER")
20 # DblClick to apply pose.
21 kmi
= km
.keymap_items
.new("poselib.apply_pose_asset", "LEFTMOUSE", "DOUBLE_CLICK")
22 addon_keymaps
.append((km
, kmi
))
25 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
="Asset Shelf")
26 # Click to apply pose.
27 kmi
= km
.keymap_items
.new("poselib.apply_pose_asset", "LEFTMOUSE", "CLICK")
28 addon_keymaps
.append((km
, kmi
))
30 kmi
= km
.keymap_items
.new("poselib.blend_pose_asset", "LEFTMOUSE", "CLICK_DRAG")
31 addon_keymaps
.append((km
, kmi
))
34 def unregister() -> None:
35 # Clear shortcuts from the keymap.
36 for km
, kmi
in addon_keymaps
:
37 km
.keymap_items
.remove(kmi
)