work: restore shift+spacebar for media play/pause
maybe put in maya config? idk what funiman's preference is
This commit is contained in:
@@ -53,7 +53,11 @@ class BUTTON_OT_change_key(bpy.types.Operator):
|
||||
|
||||
|
||||
def add_keymap():
|
||||
km = bpy.context.window_manager.keyconfigs.active.keymaps.new(name="Window")
|
||||
wm = bpy.context.window_manager
|
||||
kc = wm.keyconfigs.addon
|
||||
if kc is None:
|
||||
return
|
||||
km = kc.keymaps.new(name="Window")
|
||||
prefs = bpy.context.preferences.addons[base_package].preferences
|
||||
|
||||
kmi = km.keymap_items.new(idname='wm.call_panel', type=prefs.renaming_panel_type, value='PRESS',
|
||||
@@ -76,23 +80,34 @@ def add_key_to_keymap(idname, kmi, km, active=True):
|
||||
def remove_key(context, idname, properties_name):
|
||||
"""Removes addon hotkeys from the keymap"""
|
||||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.active.keymaps['Window']
|
||||
kc = wm.keyconfigs.addon
|
||||
if kc is None:
|
||||
return
|
||||
km = kc.keymaps.get('Window')
|
||||
if km is None:
|
||||
return
|
||||
|
||||
for kmi in km.keymap_items:
|
||||
if kmi.idname == idname and kmi.properties.name == properties_name:
|
||||
km.keymap_items.remove(kmi)
|
||||
items_to_remove = [kmi for kmi in km.keymap_items
|
||||
if kmi.idname == idname and kmi.properties.name == properties_name]
|
||||
for kmi in items_to_remove:
|
||||
km.keymap_items.remove(kmi)
|
||||
|
||||
|
||||
def remove_keymap():
|
||||
"""Removes keys from the keymap. Currently, this is only called when unregistering the addon. """
|
||||
# only works for menus and pie menus
|
||||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.active.keymaps['Window']
|
||||
kc = wm.keyconfigs.addon
|
||||
if kc is None:
|
||||
return
|
||||
km = kc.keymaps.get('Window')
|
||||
if km is None:
|
||||
return
|
||||
|
||||
for kmi in km.keymap_items:
|
||||
if hasattr(kmi.properties, 'name') and kmi.properties.name in ['VIEW3D_PT_tools_renaming_panel',
|
||||
'VIEW3D_PT_tools_type_suffix']:
|
||||
km.keymap_items.remove(kmi)
|
||||
items_to_remove = [kmi for kmi in km.keymap_items
|
||||
if hasattr(kmi.properties, 'name') and kmi.properties.name in
|
||||
{'VIEW3D_PT_tools_renaming_panel', 'VIEW3D_PT_tools_type_suffix'}]
|
||||
for kmi in items_to_remove:
|
||||
km.keymap_items.remove(kmi)
|
||||
|
||||
|
||||
class REMOVE_OT_hotkey(bpy.types.Operator):
|
||||
|
||||
@@ -28,7 +28,12 @@ def add_key(km, idname, properties_name, button_assignment_type, button_assignme
|
||||
def update_key(context, operation, operator_name, property_prefix):
|
||||
# This functions gets called when the hotkey assignment is updated in the preferences
|
||||
wm = context.window_manager
|
||||
km = wm.keyconfigs.active.keymaps["Window"]
|
||||
kc = wm.keyconfigs.addon
|
||||
if kc is None:
|
||||
return
|
||||
km = kc.keymaps.get("Window")
|
||||
if km is None:
|
||||
return
|
||||
|
||||
prefs = context.preferences.addons[base_package].preferences
|
||||
|
||||
@@ -129,7 +134,7 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
|
||||
numerate_digits: bpy.props.IntProperty(
|
||||
name="Digits",
|
||||
description="Defines digits used for numerating. Number 1 with digits 3 would result in 001",
|
||||
description="Number of digits used for the @n variable in the New Name field (e.g. @n with 3 digits: 001). To configure the auto-suffix digit count, use # characters in the Numerate field instead",
|
||||
default=3,
|
||||
)
|
||||
numerate_step: bpy.props.IntProperty(
|
||||
|
||||
Reference in New Issue
Block a user