-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathaddon_prefs.py
70 lines (58 loc) · 1.91 KB
/
addon_prefs.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
import bpy
import os
class FONTSELECTOR_PF_addon_prefs(bpy.types.AddonPreferences) :
bl_idname = __package__
preferences_folder: bpy.props.StringProperty(
name = "Preferences folder",
default = bpy.utils.extension_path_user(str(__package__)),
description="Where Font Selector store configuration files",
subtype="DIR_PATH",
)
debug : bpy.props.BoolProperty(
name = "Debug",
)
viewport_popover : bpy.props.BoolProperty(
name = "3D Viewport Popover",
# default = True,
)
properties_panel : bpy.props.BoolProperty(
name = "Font Properties Panel",
default = True,
)
sequencer_popover : bpy.props.BoolProperty(
name = "Sequencer Popover",
# default = True,
)
sequencer_panel : bpy.props.BoolProperty(
name = "Sequencer Properties Panel",
default = True,
)
popup_operator : bpy.props.BoolProperty(
name = "Pop Up Operator",
)
def draw(self, context) :
layout = self.layout
row = layout.row()
row.prop(self, "preferences_folder", text="Preferences")
sub = row.row()
sub.alignment = "RIGHT"
sub.prop(self, "debug")
box = layout.box()
box.label(text="UI")
col = box.column(align=True)
col.prop(self, "viewport_popover")
col.prop(self, "properties_panel")
col.separator()
col.prop(self, "sequencer_popover")
col.prop(self, "sequencer_panel")
col.separator()
col.prop(self, "popup_operator")
# get addon preferences
def get_addon_preferences():
addon = bpy.context.preferences.addons.get(__package__)
return getattr(addon, "preferences", None)
### REGISTER ---
def register():
bpy.utils.register_class(FONTSELECTOR_PF_addon_prefs)
def unregister():
bpy.utils.unregister_class(FONTSELECTOR_PF_addon_prefs)