mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
* Refactor necessary for Ayon changes in Setting model * Removed unnecessary configuration MongoDB is not a thing in Ayon. * Changed DL model to use dynamic enum Enum values are set in Studio Settings, in Project settings will be selected from. Used this way to be close to OP variant and support both until OP is deprecated. * Hound * Refactor with use of AYON_SERVER_ENABLED This will make it simpler to remove obsolete code in the future. --------- Co-authored-by: Libor Batek <112623825+LiborBatek@users.noreply.github.com>
67 lines
1.7 KiB
Python
67 lines
1.7 KiB
Python
from pydantic import Field, validator
|
|
|
|
from ayon_server.settings import BaseSettingsModel, ensure_unique_names
|
|
|
|
from .publish_plugins import (
|
|
PublishPluginsModel,
|
|
DEFAULT_DEADLINE_PLUGINS_SETTINGS
|
|
)
|
|
|
|
|
|
class ServerListSubmodel(BaseSettingsModel):
|
|
_layout = "compact"
|
|
name: str = Field(title="Name")
|
|
value: str = Field(title="Value")
|
|
|
|
|
|
async def defined_deadline_ws_name_enum_resolver(
|
|
addon: "BaseServerAddon",
|
|
settings_variant: str = "production",
|
|
project_name: str | None = None,
|
|
) -> list[str]:
|
|
"""Provides list of names of configured Deadline webservice urls."""
|
|
if addon is None:
|
|
return []
|
|
|
|
settings = await addon.get_studio_settings(variant=settings_variant)
|
|
|
|
ws_urls = []
|
|
for deadline_url_item in settings.deadline_urls:
|
|
ws_urls.append(deadline_url_item.name)
|
|
|
|
return ws_urls
|
|
|
|
|
|
class DeadlineSettings(BaseSettingsModel):
|
|
deadline_urls: list[ServerListSubmodel] = Field(
|
|
default_factory=list,
|
|
title="System Deadline Webservice URLs",
|
|
scope=["studio"],
|
|
)
|
|
deadline_server: str = Field(
|
|
title="Project deadline server",
|
|
section="---",
|
|
scope=["project"],
|
|
enum_resolver=defined_deadline_ws_name_enum_resolver
|
|
)
|
|
publish: PublishPluginsModel = Field(
|
|
default_factory=PublishPluginsModel,
|
|
title="Publish Plugins",
|
|
)
|
|
|
|
@validator("deadline_urls")
|
|
def validate_unique_names(cls, value):
|
|
ensure_unique_names(value)
|
|
return value
|
|
|
|
|
|
DEFAULT_VALUES = {
|
|
"deadline_urls": [
|
|
{
|
|
"name": "default",
|
|
"value": "http://127.0.0.1:8082"
|
|
}
|
|
],
|
|
"deadline_server": "default",
|
|
"publish": DEFAULT_DEADLINE_PLUGINS_SETTINGS
|
|
}
|