Import_3ds: Improved distance cue chunk import
[blender-addons.git] / space_view3d_brush_menus / __init__.py
blobbe863ff7ec88681d47c77a8fa2a7471164fbd98c
1 # SPDX-FileCopyrightText: 2011 Ryan Inch
3 # SPDX-License-Identifier: GPL-2.0-or-later
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, 10),
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 kc = wm.keyconfigs.addon
97 if kc is not None:
98 modes = ('Sculpt', 'Vertex Paint', 'Weight Paint', 'Image Paint', 'Particle')
99 for mode in modes:
100 km = wm.keyconfigs.addon.keymaps.new(name=mode)
101 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
102 kmi.properties.name = "VIEW3D_MT_sv3_brush_options"
103 addon_keymaps.append((km, kmi))
106 def unregister():
107 # unregister all files
108 for addon_file in addon_files:
109 addon_file.unregister()
111 # unregister preferences
112 bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
114 for km, kmi in addon_keymaps:
115 km.keymap_items.remove(kmi)
116 addon_keymaps.clear()
119 if __name__ == "__main__":
120 register()