-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaddon_prefs.py
44 lines (30 loc) · 1.03 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
import bpy
import os
addon_name = os.path.basename(os.path.dirname(__file__))
class AUDACITYTOOLS_PF_Addon_Prefs(bpy.types.AddonPreferences):
bl_idname = addon_name
audacity_executable : bpy.props.StringProperty(
name = "Audacity executable",
subtype = "FILE_PATH",
)
audacity_waiting_time : bpy.props.FloatProperty(
name = "Audacity waiting time",
description = "Waiting time in seconds for Audacity opening",
default = 1,
precision = 1,
min = 0.5,
max = 10.0,
)
def draw(self, context):
layout = self.layout
layout.prop(self, "audacity_executable")
layout.prop(self, "audacity_waiting_time")
# get addon preferences
def get_addon_preferences():
addon = bpy.context.preferences.addons.get(addon_name)
return getattr(addon, "preferences", None)
### REGISTER ---
def register():
bpy.utils.register_class(AUDACITYTOOLS_PF_Addon_Prefs)
def unregister():
bpy.utils.unregister_class(AUDACITYTOOLS_PF_Addon_Prefs)