Welcome to mirror list, hosted at ThFree Co, Russian Federation.

__init__.py « space_view3d_brush_menus - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5381d14ca5f790730efff70da001042dc0a652f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Modified by Meta-Androcto

""" Copyright 2011 GPL licence applies"""

bl_info = {
    "name": "Dynamic Brush Menus",
    "description": "Fast access to brushes & tools in Sculpt and Paint Modes",
    "author": "Ryan Inch (Imaginer)",
    "version": (1, 1, 7),
    "blender": (2, 80, 0),
    "location": "Spacebar in Sculpt/Paint Modes",
    "warning": '',
    "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
                "Scripts/3D_interaction/Advanced_UI_Menus",
    "category": "3D View"}


if "bpy" in locals():
    import importlib
    importlib.reload(utils_core)
    importlib.reload(brush_menu)
    importlib.reload(brushes)
    importlib.reload(curve_menu)
    importlib.reload(dyntopo_menu)
    importlib.reload(stroke_menu)
    importlib.reload(symmetry_menu)
    importlib.reload(texture_menu)
else:
    from . import utils_core
    from . import brush_menu
    from . import brushes
    from . import curve_menu
    from . import dyntopo_menu
    from . import stroke_menu
    from . import symmetry_menu
    from . import texture_menu


import bpy
from bpy.types import AddonPreferences
from bpy.props import (
        EnumProperty,
        IntProperty,
        )


addon_files = (
    brush_menu,
    brushes,
    curve_menu,
    dyntopo_menu,
    stroke_menu,
    symmetry_menu,
    texture_menu,
    )
    


class VIEW3D_MT_Brushes_Pref(AddonPreferences):
    bl_idname = __name__
    
    column_set: IntProperty(
        name="Number of Columns",
        description="Number of columns used for the brushes menu",
        default=2,
        min=1,
        max=10
        )

    def draw(self, context):
        layout = self.layout

        col = layout.column(align=True)
        col.prop(self, "column_set", slider=True)


# New hotkeys and registration

addon_keymaps = []


def register():
    # register all files
    for addon_file in addon_files:
        addon_file.register()
    
    # set the add-on name variable to access the preferences
    utils_core.get_addon_name = __name__
    
    # register preferences
    bpy.utils.register_class(VIEW3D_MT_Brushes_Pref)

    # register hotkeys
    wm = bpy.context.window_manager
    modes = ('Sculpt', 'Vertex Paint', 'Weight Paint', 'Image Paint', 'Particle')

    for mode in modes:
        km = wm.keyconfigs.addon.keymaps.new(name=mode)
        kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
        kmi.properties.name = "VIEW3D_MT_sv3_brush_options"
        addon_keymaps.append((km, kmi))


def unregister():
    # unregister all files
    for addon_file in addon_files:
        addon_file.unregister()
    
    # unregister preferences
    bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()