mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
This is preparation for new version of pydantic which will require to customize the field for AYON purposes and raw pydantic Field could not be used.
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from pydantic import validator
|
|
from ayon_server.settings import BaseSettingsModel, SettingsField
|
|
from ayon_server.settings.validators import ensure_unique_names
|
|
|
|
|
|
class ImageIOConfigModel(BaseSettingsModel):
|
|
override_global_config: bool = SettingsField(
|
|
False,
|
|
title="Override global OCIO config"
|
|
)
|
|
filepath: list[str] = SettingsField(
|
|
default_factory=list,
|
|
title="Config path"
|
|
)
|
|
|
|
|
|
class ImageIOFileRuleModel(BaseSettingsModel):
|
|
name: str = SettingsField("", title="Rule name")
|
|
pattern: str = SettingsField("", title="Regex pattern")
|
|
colorspace: str = SettingsField("", title="Colorspace name")
|
|
ext: str = SettingsField("", title="File extension")
|
|
|
|
|
|
class ImageIOFileRulesModel(BaseSettingsModel):
|
|
activate_host_rules: bool = SettingsField(False)
|
|
rules: list[ImageIOFileRuleModel] = SettingsField(
|
|
default_factory=list,
|
|
title="Rules"
|
|
)
|
|
|
|
@validator("rules")
|
|
def validate_unique_outputs(cls, value):
|
|
ensure_unique_names(value)
|
|
return value
|
|
|
|
|
|
class CelActionImageIOModel(BaseSettingsModel):
|
|
activate_host_color_management: bool = SettingsField(
|
|
True, title="Enable Color Management"
|
|
)
|
|
ocio_config: ImageIOConfigModel = SettingsField(
|
|
default_factory=ImageIOConfigModel,
|
|
title="OCIO config"
|
|
)
|
|
file_rules: ImageIOFileRulesModel = SettingsField(
|
|
default_factory=ImageIOFileRulesModel,
|
|
title="File Rules"
|
|
)
|