forked from samytichadou/Auto_Reload_Blender_addon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddon_prefs.py
69 lines (56 loc) · 1.96 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
import bpy
import os
addon_name = os.path.basename(os.path.dirname(__file__))
class Reload_AddonPrefs(bpy.types.AddonPreferences):
bl_idname = addon_name
check_frequency : bpy.props.FloatProperty(name='Checking Frequency (s)',
precision=2,
min=0.01,
max=3600.00,
default=1,
description='Frequency for checking for modified Images in seconds')
icon_toggle: bpy.props.BoolProperty(
name = "Icon Display",
description = "Display indicator icon for timer mode",
default = True,
)
icon_offset_x: bpy.props.IntProperty(
name = "Icon Horizontal offset",
description = "Space between the icon and view edge",
default = 10,
)
icon_offset_y: bpy.props.IntProperty(
name = "Icon Vertical offset",
description = "Space between the icon and view edge",
default = 10,
)
icon_size: bpy.props.IntProperty(
name = "Icon Size",
description = "Icon size",
default = 32,
)
icon_color : bpy.props.FloatVectorProperty(
name = "Icon Color",
size = 3,
min = 0.0,
max = 1.0,
default = [1, 1, 1],
subtype = 'COLOR'
)
def draw(self, context):
layout = self.layout
layout.prop(self, "check_frequency")
box = layout.box()
box.prop(self, "icon_toggle")
if self.icon_toggle:
col = box.column(align=True)
row = col.row(align=True)
row.prop(self, "icon_size", text="Size")
row.prop(self, "icon_color", text="")
row = col.row(align=True)
row.prop(self, "icon_offset_x", text="X Position")
row.prop(self, "icon_offset_y", text="Y Position")
# get addon preferences
def get_addon_preferences():
addon = bpy.context.preferences.addons.get(addon_name)
return getattr(addon, "preferences", None)