Cleanup: remove "Tweak" event type
[blender-addons.git] / space_view3d_brush_menus / __init__.py
blobe8b8c355d40519af0c6bd73c96d89056140bcf5a
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 """ Copyright 2011 GPL licence applies"""
5 bl_info = {
6 "name": "Dynamic Brush Menus",
7 "description": "Fast access to brushes & tools in Sculpt and Paint Modes",
8 "author": "Ryan Inch (Imaginer)",
9 "version": (1, 1, 8),
10 "blender": (2, 80, 0),
11 "location": "Spacebar in Sculpt/Paint Modes",
12 "warning": '',
13 "doc_url": "{BLENDER_MANUAL_URL}/addons/interface/brush_menus.html",
14 "category": "Interface",
18 if "bpy" in locals():
19 import importlib
20 importlib.reload(utils_core)
21 importlib.reload(brush_menu)
22 importlib.reload(brushes)
23 importlib.reload(curve_menu)
24 importlib.reload(dyntopo_menu)
25 importlib.reload(stroke_menu)
26 importlib.reload(symmetry_menu)
27 importlib.reload(texture_menu)
28 else:
29 from . import utils_core
30 from . import brush_menu
31 from . import brushes
32 from . import curve_menu
33 from . import dyntopo_menu
34 from . import stroke_menu
35 from . import symmetry_menu
36 from . import texture_menu
39 import bpy
40 from bpy.types import AddonPreferences
41 from bpy.props import (
42 EnumProperty,
43 IntProperty,
47 addon_files = (
48 brush_menu,
49 brushes,
50 curve_menu,
51 dyntopo_menu,
52 stroke_menu,
53 symmetry_menu,
54 texture_menu,
59 class VIEW3D_MT_Brushes_Pref(AddonPreferences):
60 bl_idname = __name__
62 column_set: IntProperty(
63 name="Number of Columns",
64 description="Number of columns used for the brushes menu",
65 default=2,
66 min=1,
67 max=10
70 def draw(self, context):
71 layout = self.layout
73 col = layout.column(align=True)
74 col.prop(self, "column_set", slider=True)
77 # New hotkeys and registration
79 addon_keymaps = []
82 def register():
83 # register all files
84 for addon_file in addon_files:
85 addon_file.register()
87 # set the add-on name variable to access the preferences
88 utils_core.get_addon_name = __name__
90 # register preferences
91 bpy.utils.register_class(VIEW3D_MT_Brushes_Pref)
93 # register hotkeys
94 wm = bpy.context.window_manager
95 modes = ('Sculpt', 'Vertex Paint', 'Weight Paint', 'Image Paint', 'Particle')
97 for mode in modes:
98 km = wm.keyconfigs.addon.keymaps.new(name=mode)
99 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
100 kmi.properties.name = "VIEW3D_MT_sv3_brush_options"
101 addon_keymaps.append((km, kmi))
104 def unregister():
105 # unregister all files
106 for addon_file in addon_files:
107 addon_file.unregister()
109 # unregister preferences
110 bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
112 for km, kmi in addon_keymaps:
113 km.keymap_items.remove(kmi)
114 addon_keymaps.clear()
117 if __name__ == "__main__":
118 register()