GPencil Tools: Canvas rotation fixes
[blender-addons.git] / space_view3d_brush_menus / __init__.py
blobc040bd9de3fc0d457295cb53a02b74420a85a347
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
18 # Modified by Meta-Androcto
20 """ Copyright 2011 GPL licence applies"""
22 bl_info = {
23 "name": "Dynamic Brush Menus",
24 "description": "Fast access to brushes & tools in Sculpt and Paint Modes",
25 "author": "Ryan Inch (Imaginer)",
26 "version": (1, 1, 8),
27 "blender": (2, 80, 0),
28 "location": "Spacebar in Sculpt/Paint Modes",
29 "warning": '',
30 "doc_url": "{BLENDER_MANUAL_URL}/addons/interface/brush_menus.html",
31 "category": "Interface",
35 if "bpy" in locals():
36 import importlib
37 importlib.reload(utils_core)
38 importlib.reload(brush_menu)
39 importlib.reload(brushes)
40 importlib.reload(curve_menu)
41 importlib.reload(dyntopo_menu)
42 importlib.reload(stroke_menu)
43 importlib.reload(symmetry_menu)
44 importlib.reload(texture_menu)
45 else:
46 from . import utils_core
47 from . import brush_menu
48 from . import brushes
49 from . import curve_menu
50 from . import dyntopo_menu
51 from . import stroke_menu
52 from . import symmetry_menu
53 from . import texture_menu
56 import bpy
57 from bpy.types import AddonPreferences
58 from bpy.props import (
59 EnumProperty,
60 IntProperty,
64 addon_files = (
65 brush_menu,
66 brushes,
67 curve_menu,
68 dyntopo_menu,
69 stroke_menu,
70 symmetry_menu,
71 texture_menu,
76 class VIEW3D_MT_Brushes_Pref(AddonPreferences):
77 bl_idname = __name__
79 column_set: IntProperty(
80 name="Number of Columns",
81 description="Number of columns used for the brushes menu",
82 default=2,
83 min=1,
84 max=10
87 def draw(self, context):
88 layout = self.layout
90 col = layout.column(align=True)
91 col.prop(self, "column_set", slider=True)
94 # New hotkeys and registration
96 addon_keymaps = []
99 def register():
100 # register all files
101 for addon_file in addon_files:
102 addon_file.register()
104 # set the add-on name variable to access the preferences
105 utils_core.get_addon_name = __name__
107 # register preferences
108 bpy.utils.register_class(VIEW3D_MT_Brushes_Pref)
110 # register hotkeys
111 wm = bpy.context.window_manager
112 modes = ('Sculpt', 'Vertex Paint', 'Weight Paint', 'Image Paint', 'Particle')
114 for mode in modes:
115 km = wm.keyconfigs.addon.keymaps.new(name=mode)
116 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
117 kmi.properties.name = "VIEW3D_MT_sv3_brush_options"
118 addon_keymaps.append((km, kmi))
121 def unregister():
122 # unregister all files
123 for addon_file in addon_files:
124 addon_file.unregister()
126 # unregister preferences
127 bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
129 for km, kmi in addon_keymaps:
130 km.keymap_items.remove(kmi)
131 addon_keymaps.clear()
134 if __name__ == "__main__":
135 register()