-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpreferences.py
73 lines (60 loc) · 2.78 KB
/
preferences.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
# ##### 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 #####
import bpy
from bpy.types import AddonPreferences, PropertyGroup, UIList
from bpy.props import ( StringProperty,
BoolProperty,
FloatProperty,
IntProperty,
EnumProperty,
)
class SHELVES_Preferences(AddonPreferences):
bl_idname = __package__
default_shelf: StringProperty(
name="default_shelf",
description="default_shelf",
default="Default")
def draw(self, context):
scene = context.scene
layout = self.layout
row = layout.row(align=True)
preset_label = bpy.types.SHELVES_MT_Presets.bl_label
row.menu('SHELVES_MT_Presets', text=self.default_shelf)
row.operator('shelves.save_preset', text='', icon='ADD')
row.operator('shelves.save_preset', text='', icon='REMOVE').remove_active = True
row = layout.row(align=True)
#row.operator('self.default_shelf', text="set as default", icon='ADD')
row.prop(self, 'default_shelf')
self.default_shelf = preset_label
#row.label(text=self.default_shelf)
row = layout.row(align=True)
col = row.column(align=True)
col.template_list("SHELVES_UL_ButtonsList",
"Custom Shelf List ",
scene,
"shelf_list",
scene,
"shelf_list_index",
type='DEFAULT',
columns=1,
)
col = row.column(align=True)
col.operator('shelf_list.new_button', text='', icon='ADD')
col.operator('shelf_list.delete_button', text='', icon='REMOVE')
col.operator('shelf_list.move_button', text='', icon='TRIA_UP').direction = 'UP'
col.operator('shelf_list.move_button', text='', icon='TRIA_DOWN').direction = 'DOWN'