-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
36 lines (25 loc) · 1.02 KB
/
utils.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
import bpy, os, shutil
from bpy.app.handlers import persistent
def load_presets():
my_bundled_presets = os.path.join(os.path.dirname(os.path.realpath(__file__)), "presets")
my_presets = os.path.join(bpy.utils.user_resource('SCRIPTS'), "presets/project_presets")
if not os.path.isdir(my_presets):
os.makedirs(my_presets)
[shutil.copy2(os.path.join(my_bundled_presets, f), my_presets) for f in os.listdir(my_bundled_presets)]
def error_dialog(message = "", title = "Error", icon = 'ERROR'):
def draw(self, context):
self.layout.label(text=message)
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
def set_default_preset():
bpm = bpy.context.scene.bpm
if not bpm.subdirs:
bpm.subdirs.clear()
subdir = bpm.subdirs.add()
subdir.name = 'assets'
subdir = bpm.subdirs.add()
subdir.name = 'cache'
subdir = bpm.subdirs.add()
subdir.name = 'output'
@persistent
def on_register(scene):
set_default_preset()