Add Easy_Weight to Addons #47

Merged
Nick Alberelli merged 48 commits from feature/easy_weights into main 2023-05-17 22:13:57 +02:00
8 changed files with 4 additions and 1 deletions
Showing only changes of commit bd8b7dceba - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -50,8 +50,11 @@ class ChangeWPBrush(bpy.types.Operator):
def register_brush_switch_hotkeys(dummy): def register_brush_switch_hotkeys(dummy):
# Without this, the hotkeys' properties get reset whenever the addon is disabled, which results in having to set the Add, Subtract, Blur brushes on the hotkeys manually every time. # Without this, the hotkeys' properties get reset whenever the addon is disabled, which results in having to set the Add, Subtract, Blur brushes on the hotkeys manually every time.
# However, with this, the hotkey cannot be changed, since this will forcibly re-create the original anyways. # However, with this, the hotkey cannot be changed, since this will forcibly re-create the original anyways.
wp_hotkeys = bpy.data.window_managers[0].keyconfigs.active.keymaps['Weight Paint'].keymap_items
active_keyconfig = bpy.data.window_managers[0].keyconfigs.active
if not active_keyconfig: return # Avoid error when running without UI.
wp_hotkeys = active_keyconfig.keymaps['Weight Paint'].keymap_items
add_hotkey = wp_hotkeys.new('brush.set_specific',value='PRESS',type='ONE',ctrl=False,alt=False,shift=False,oskey=False) add_hotkey = wp_hotkeys.new('brush.set_specific',value='PRESS',type='ONE',ctrl=False,alt=False,shift=False,oskey=False)
add_hotkey.properties.brush = 'Add' add_hotkey.properties.brush = 'Add'
add_hotkey.type = add_hotkey.type add_hotkey.type = add_hotkey.type