working on settings patching

This commit is contained in:
Jakub Jezek 2024-06-10 10:48:29 +02:00
parent 35e180149b
commit 3b73a8881d
No known key found for this signature in database
GPG key ID: 06DBD609ADF27FD9
3 changed files with 53 additions and 2 deletions

View file

@ -1,8 +1,12 @@
from typing import Type
from typing import Type, Any
from ayon_server.addons import BaseServerAddon
from .settings import NukeSettings, DEFAULT_VALUES
from .settings import (
NukeSettings,
DEFAULT_VALUES,
convert_settings_overrides
)
class NukeAddon(BaseServerAddon):
@ -11,3 +15,13 @@ class NukeAddon(BaseServerAddon):
async def get_default_settings(self):
settings_model_cls = self.get_settings_model()
return settings_model_cls(**DEFAULT_VALUES)
async def convert_settings_overrides(
self,
source_version: str,
overrides: dict[str, Any],
) -> dict[str, Any]:
convert_settings_overrides(source_version, overrides)
# Use super conversion
return await super().convert_settings_overrides(
source_version, overrides)

View file

@ -2,9 +2,12 @@ from .main import (
NukeSettings,
DEFAULT_VALUES,
)
from .conversion import convert_settings_overrides
__all__ = (
"NukeSettings",
"DEFAULT_VALUES",
"convert_settings_overrides",
)

View file

@ -0,0 +1,34 @@
from typing import Any
from .publish_plugins import DEFAULT_PUBLISH_VALUES
def _convert_imageio_configs_0_2_2(overrides):
"""Image IO settings had changed.
0.2.2. is the latest version using the old way.
"""
pass
def _convert_extract_intermediate_files_0_2_2(publish_overrides):
"""Extract intermediate files settings had changed.
0.2.2. is the latest version using the old way.
"""
pass
def _convert_publish_plugins(overrides):
if "publish" not in overrides:
return
_convert_extract_intermediate_files_0_2_2(overrides["publish"])
def convert_settings_overrides(
source_version: str,
overrides: dict[str, Any],
) -> dict[str, Any]:
_convert_imageio_configs_0_2_2(overrides)
_convert_publish_plugins(overrides)
return overrides