This repository has been archived by the owner on May 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
84 lines (70 loc) · 3.02 KB
/
__init__.py
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
"""
Texture Paint Helper
Copyright (C) 2017 Oliver Larsen
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 3 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, see <http://www.gnu.org/licenses/>.
"""
bl_info = {
'name': 'TexturePaintHelper',
'author': 'Oliver Larsen aka. CandyFace',
'version': (0, 2, 0),
'blender': (2, 78, 0),
'location': 'Texture_Paint > Press W > Pie menu',
'description': 'A texture pie right at your finger tips!',
'warning': '',
"wiki_url" : "",
"tracker_url" : "",
'support': 'COMMUNITY',
'category': 'Paint'}
if "bpy" in locals():
import imp
unregister()
imp.reload(TexturePaintHelper)
imp.reload(ImportBrushes)
else:
import bpy
from . import TexturePaintHelper
from . import ImportBrushes
default_keybind = 'W'
addon_keymaps = []
def register():
bpy.utils.register_module(__name__)
bpy.app.handlers.load_post.append(ImportBrushes.eraseBrush)
wm = bpy.context.window_manager
def kmi_props_setattr(kmi_props, attr, value):
try:
setattr(kmi_props, attr, value)
except AttributeError:
print("Warning: property '%s' not found in keymap item '%s'" %
(attr, kmi_props.__class__.__name__))
except Exception as e:
print("Warning: %r" % e)
km = wm.keyconfigs.addon.keymaps.new(name='Image Paint', space_type='EMPTY')
kmi = km.keymap_items.new("wm.call_menu_pie", default_keybind, 'PRESS', ctrl=False, shift=False)
kmi.properties.name = "paint.image_paint"
kmi = km.keymap_items.new("paint.pencil_brush", 'P', 'PRESS', ctrl=False, shift=False)
kmi = km.keymap_items.new("paint.erase_brush", 'E', 'PRESS', ctrl=False, shift=False)
kmi = km.keymap_items.new("wm.radial_control", 'F', 'PRESS', ctrl=False, shift=False)
kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.image_paint.brush.radius')
kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.image_paint.brush.mask_texture_slot.angle')
kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.image_paint.brush.cursor_color_add')
kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.image_paint.brush.color')
kmi_props_setattr(kmi.properties, 'zoom_path', 'space_data.zoom')
addon_keymaps.append(km)
def unregister():
wm = bpy.context.window_manager
for km in addon_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
# clear the list
addon_keymaps.clear()
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()