-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathpublic_path_utils.py
72 lines (44 loc) · 1.54 KB
/
public_path_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
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
from pathlib import Path
import os
from enum import Enum
import re
class ConfigFile(Enum):
DIRECTORY = '_config.yaml'
EXPORT_DEFAULT = 'export_default.yaml'
IMPORT_DEFAULT = 'import_default.yaml'
IMPORT_SPIO = 'import_spio.yaml'
class AssetDir(Enum):
DIRECTORY = 'asset'
SCRIPTS = 'scripts'
TEMPLATES = 'templates'
class TemplateDir(Enum):
WORLD = 'World.blend'
PARALLAX_MAPPING = 'ParallaxMapping_2022_5_9.blend'
class ScriptDir(Enum):
pass
class ExternalDir(Enum):
C4D = 'Super IO for Cinema 4d v0.2'
HOUDINI = 'Super IO for Houdini v0.3'
class ModulesDir(Enum):
"""Path to modules directory, python files in this directory will be loaded as modules"""
DIRECTORY = 'modules'
class DefaultIcons(Enum):
IMPORT = 'import.png'
EXPORT = 'export.png'
IMPORT_BIP = 'import_.bip'
EXPORT_BIP = 'export.bip'
def get_modules_dir():
d = Path(__file__).parent.joinpath(ModulesDir.DIRECTORY.value)
return d
def get_asset_dir(subpath: AssetDir | None = None) -> Path:
d = Path(__file__).parent.joinpath(AssetDir.DIRECTORY.value)
assert subpath in AssetDir or subpath is None, f'Asset {subpath} not found.'
if subpath is not None:
d = d.joinpath(subpath.value)
return d
def get_template_dir(subpath: TemplateDir | None = None) -> Path:
d = get_asset_dir().joinpath(AssetDir.TEMPLATES.value)
assert subpath in TemplateDir or subpath is None, f'Template {subpath} not found.'
if subpath is not None:
d = d.joinpath(subpath.value)
return d