-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.py
More file actions
341 lines (304 loc) · 12.1 KB
/
Copy pathmain.py
File metadata and controls
341 lines (304 loc) · 12.1 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
"""Main settings for USD on AYON server."""
from ayon_server.settings import BaseSettingsModel, SettingsField
from ayon_server.addons import AddonLibrary, ServerAddonDefinition
from .publish_plugins import PublishPluginsModel, DEFAULT_PUBLISH_VALUES
def platform_enum():
"""Return enumerator for supported platforms."""
return [
{"label": "Windows", "value": "windows"},
{"label": "Linux", "value": "linux"},
{"label": "MacOS", "value": "darwin"},
]
def logger_logging_keys_enum():
"""Return enumerator for AyonCpp Logging Keys."""
return [
{"label": "Off", "value": ""},
{"label": "Api Debug", "value": "AyonApi/"},
{"label": "Env Debug", "value": "AyonApiDebugEnvVars/"},
{"label": "All", "value": "AyonApi/AyonApiDebugEnvVars/"},
]
# TODO: find a way to pull this from AyonCppApi (later AyonLogger)
def log_lvl_enum():
"""Return enumerator for supported log levels."""
return [
{"label": "Info", "value": "INFO"},
{"label": "Error", "value": "ERROR"},
{"label": "Warn", "value": "WARN"},
{"label": "Critical", "value": "CRITICAL"},
{"label": "Off", "value": "OFF"},
]
# TODO: find a way to pull this from AyonCppApi (later AyonLogger)
def file_logger_enum():
"""Return enumerator to enable or disable the file logger."""
return [
{"label": "Off", "value": "OFF"},
{"label": "On", "value": "ON"},
]
async def apps_enum(project_name, addon, settings_variant):
addon_library = AddonLibrary.getinstance()
app_addons = addon_library.data.get("applications")
if not app_addons:
return []
app_addons: ServerAddonDefinition
addon = app_addons.latest
if not hasattr(addon, "get_applications_settings_enum"):
return []
return await addon.get_applications_settings_enum(
project_name=project_name,
settings_variant=settings_variant,
)
class AppPlatformPathModel(BaseSettingsModel):
_layout = "collapsed"
name: str = SettingsField(
title="App Name", description="Application name, e.g. maya/2025",
enum_resolver=apps_enum,
)
app_alias_list: list[str] = SettingsField(
title="Application Alias",
description="Define a list of App Names that use the same "
"resolver as the parent application",
default_factory=list,
enum_resolver=apps_enum
)
# TODO: we need to take into account here different linux flavors
platform: str = SettingsField(
title="Platform",
enum_resolver=platform_enum,
description="windows / linux / darwin",
)
lake_fs_path: str = SettingsField(
title="Repository Object Path",
description=(
"The LakeFs internal path to the resolver zip, e.g: "
"`AyonUsdResolverBin/Hou/ayon-usd-resolver_hou19.5_linux_py37.zip`"
"\n"
"This information can be found on LakeFs server Object "
"Information."
),
)
class AppPlatformURIModel(BaseSettingsModel):
"""Application platform URI model."""
_layout = "expanded"
app_name: str = SettingsField(
title="App Name",
description="Application name, e.g. maya/2025",
enum_resolver=apps_enum
)
# TODO: we need to take into account here different linux flavors
platform: str = SettingsField(
title="Platform",
enum_resolver=platform_enum,
description="windows / linux / darwin",
)
uri: str = SettingsField(
title="Repository Object URI",
description=(
"Path to USD Asset Resolver plugin zip file on the LakeFs server, "
"e.g: `lakefs://ayon-usd/V001/AyonUsdResolverBin/Hou/ayon-usd-resolver_hou19.5_linux_py37.zip`" # noqa
),
)
class BinaryDistributionSettings(BaseSettingsModel):
"""Binary distribution of USD and AYON USD Resolver"""
_layout = "collapsed"
enabled: bool = SettingsField(False)
server_uri: str = SettingsField(
"https://lake.ayon.cloud",
title="Server URL",
description="The URL for the USD binary distribution LakeFs "
"server. It's recommended to keep the default "
"value to use the USD builds we provide.",
)
server_repo: str = SettingsField(
"lakefs://ayon-usd/v1.0.1/",
title="Repository URI",
description="The repository tag or branch URI within the LakeFs server.",
)
access_key_id: str = SettingsField(
"{AYON_Distribution_Key_Id}",
title="Access Key ID",
description="The LakeFs server access key ID.",
)
secret_access_key: str = SettingsField(
"{AYON_Distribution_Access_Key}",
title="Secret Access Key",
description="The LakeFs server secret access key.",
)
asset_resolvers: list[AppPlatformPathModel] = SettingsField(
title="Resolver Application Paths",
description="Allows an admin to define a specific Resolver Zip for a specific Application",
default=[
AppPlatformPathModel(
name="maya/2024",
platform="linux",
lake_fs_path="AyonUsdResolverBin/MayaLinux/Maya2024_2_Py310_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="maya/2024",
platform="windows",
lake_fs_path="AyonUsdResolverBin/MayaWin/Maya2024_2_Py310_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="maya/2025",
platform="linux",
lake_fs_path="AyonUsdResolverBin/MayaLinux/Maya2025_Py311_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="maya/2025",
platform="windows",
lake_fs_path="AyonUsdResolverBin/MayaWin/Maya2025_Py311_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="maya/2026",
platform="linux",
lake_fs_path="AyonUsdResolverBin/MayaLinux/Maya2026_Py311_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="maya/2026",
platform="windows",
lake_fs_path="AyonUsdResolverBin/MayaWin/Maya2026_Py311_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/19-5Py37",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini195_Py37_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/19-5",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini195_Py39_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/19-5Py37",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini195_Py37_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/19-5",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini195_Py39_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/20-0",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini20_Py310_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/20-0Py39",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini20_Py39_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/20-0",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini20_Py310_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/20-0Py39",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini20_Py39_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/20-5",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini205_Py311_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/20-5Py310",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini205_Py310_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/21-0",
platform="linux",
lake_fs_path="AyonUsdResolverBin/HouLinux/Houdini21_Py311_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="houdini/20-5",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini205_Py311_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/20-5Py310",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini205_Py310_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="houdini/21-0",
platform="windows",
lake_fs_path="AyonUsdResolverBin/HouWin/Houdini21_Py311_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="unreal/5-4",
platform="windows",
lake_fs_path="AyonUsdResolverBin/UnrealWin/Unreal5_4_Py39_Win_Windows_AMD64.zip",
),
AppPlatformPathModel(
name="ayon_usd/23-5",
platform="linux",
lake_fs_path="AyonUsdResolverBin/AyonUsdLinux/AyonUsd23_5_Py39_Linux_Linux_x86_64.zip",
),
AppPlatformPathModel(
name="ayon_usd/23-5",
platform="windows",
lake_fs_path="AyonUsdResolverBin/AyonUsdWin/AyonUsd23_5_Py39_Win_Windows_AMD64.zip",
),
],
)
lake_fs_overrides: list[AppPlatformURIModel] = SettingsField(
title="Resolver Application Overrides",
description=(
"Allows to define a specific Resolver Zip for a specific Application"
),
default_factory=list,
)
class AyonResolverSettings(BaseSettingsModel):
"""AYON USD resolver Settings"""
_layout = "collapsed"
ayon_log_lvl: str = SettingsField(
"WARN",
title="Resolver Log Level",
enum_resolver=log_lvl_enum,
description="Set verbosity of the AyonUsdResolver logger",
)
ayon_file_logger_enabled: str = SettingsField(
"OFF",
title="Resolver File Logger Enabled ",
enum_resolver=file_logger_enum,
description="Enable or disable AyonUsdResolver file logger",
)
file_logger_file_path: str = SettingsField(
"",
title="Resolver File logger file path",
description=(
"Allows you to set a custom location where the file logger will "
"export to. This can be a relative or absolute path. This is only "
"used if `ayon_file_logger_enabled` is enabled."
),
)
ayon_logger_logging_keys: str = SettingsField(
"",
title="AyonCppApi Logging Keys",
enum_resolver=logger_logging_keys_enum,
description="List of extra logging options for the AyonCppApi",
)
class UsdLibConfigSettings(BaseSettingsModel):
"""Settings for USD"""
_layout = "collapsed"
usd_tf_debug: str = SettingsField(
"",
title="Tf Debug Variable for Debugging USD",
description="",
)
class USDSettings(BaseSettingsModel):
distribution: BinaryDistributionSettings = SettingsField(
default_factory=BinaryDistributionSettings, title="Binary Distribution"
)
ayon_usd_resolver: AyonResolverSettings = SettingsField(
default_factory=AyonResolverSettings, title="AYON USD Resolver Config"
)
usd: UsdLibConfigSettings = SettingsField(
default_factory=UsdLibConfigSettings, title="USD Library Config")
publish: PublishPluginsModel = SettingsField(
title="Publish plugins",
default=DEFAULT_PUBLISH_VALUES
)