43 lines
1.3 KiB
Python
Executable File
43 lines
1.3 KiB
Python
Executable File
## Pure keymaping additions
|
|
|
|
import bpy
|
|
addon_keymaps = []
|
|
|
|
def register_keymaps():
|
|
addon = bpy.context.window_manager.keyconfigs.addon
|
|
# km = addon.keymaps.new(name = "3D View", space_type = "VIEW_3D")# in 3D context
|
|
# km = addon.keymaps.new(name = "Window", space_type = "EMPTY")# from everywhere
|
|
|
|
km = addon.keymaps.new(name = "Grease Pencil Stroke Sculpt Mode", space_type = "EMPTY", region_type='WINDOW')
|
|
|
|
kmi = km.keymap_items.new('wm.context_toggle', type='ONE', value='PRESS')
|
|
kmi.properties.data_path='scene.tool_settings.use_gpencil_select_mask_point'
|
|
addon_keymaps.append((km, kmi))
|
|
|
|
kmi = km.keymap_items.new('wm.context_toggle', type='TWO', value='PRESS')
|
|
kmi.properties.data_path='scene.tool_settings.use_gpencil_select_mask_stroke'
|
|
addon_keymaps.append((km, kmi))
|
|
|
|
kmi = km.keymap_items.new('wm.context_toggle', type='THREE', value='PRESS')
|
|
kmi.properties.data_path='scene.tool_settings.use_gpencil_select_mask_segment'
|
|
addon_keymaps.append((km, kmi))
|
|
|
|
def unregister_keymaps():
|
|
for km, kmi in addon_keymaps:
|
|
km.keymap_items.remove(kmi)
|
|
|
|
addon_keymaps.clear()
|
|
|
|
|
|
|
|
def register():
|
|
if not bpy.app.background:
|
|
register_keymaps()
|
|
|
|
def unregister():
|
|
if not bpy.app.background:
|
|
unregister_keymaps()
|
|
|
|
if __name__ == "__main__":
|
|
register()
|