Skip to content

Commit

Permalink
Merge pull request #122 from ynput/enhancement/OP-8202_Remove-system_…
Browse files Browse the repository at this point in the history
…settings

Chore: Remove system settings concept
  • Loading branch information
iLLiCiTiT authored Feb 28, 2024
2 parents 2a0f68a + fdb18f1 commit 69d9254
Show file tree
Hide file tree
Showing 32 changed files with 83 additions and 163 deletions.
2 changes: 1 addition & 1 deletion client/ayon_core/hooks/pre_ocio_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def execute(self):
asset_name=self.data["folder_path"],
task_name=self.data["task_name"],
host_name=self.host_name,
system_settings=self.data["system_settings"]
settings=self.data["project_settings"]
)

config_data = get_imageio_config(
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/flame/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ class ClipLoader(LoaderPlugin):
_mapping = None
_host_settings = None

def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):

plugin_type_settings = (
project_settings
Expand Down
5 changes: 2 additions & 3 deletions client/ayon_core/hosts/fusion/plugins/load/load_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ class FusionLoadUSD(load.LoaderPlugin):
tool_type = "uLoader"

@classmethod
def apply_settings(cls, project_settings, system_settings):
super(FusionLoadUSD, cls).apply_settings(project_settings,
system_settings)
def apply_settings(cls, project_settings):
super(FusionLoadUSD, cls).apply_settings(project_settings)
if cls.enabled:
# Enable only in Fusion 18.5+
fusion = get_fusion_module()
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/hiero/plugins/load/load_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LoadClip(phiero.SequenceLoader):
clip_name_template = "{asset}_{subset}_{representation}"

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
plugin_type_settings = (
project_settings
.get("hiero", {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ValidateUnrealStaticMeshName(pyblish.api.InstancePlugin,
static_mesh_prefix = ""

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):

settings = (
project_settings["houdini"]["create"]["CreateStaticMesh"]
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/maya/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,8 @@ class Loader(LoaderPlugin):
load_settings = {} # defined in settings

@classmethod
def apply_settings(cls, project_settings, system_settings):
super(Loader, cls).apply_settings(project_settings, system_settings)
def apply_settings(cls, project_settings):
super(Loader, cls).apply_settings(project_settings)
cls.load_settings = project_settings['maya']['load']

def get_custom_namespace_and_group(self, context, options, loader_key):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def process(self, instance):
"colorspaceView": colorspace_data["view"],
}

rr_settings = context.data["system_settings"]["royalrender"]
rr_settings = context.data["project_settings"]["royalrender"]
if rr_settings["enabled"]:
data["rrPathName"] = instance.data.get("rrPathName")
self.log.debug(data["rrPathName"])
Expand Down
8 changes: 3 additions & 5 deletions client/ayon_core/hosts/maya/plugins/publish/extract_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ def __init__(self, log=None):
log = logging.getLogger(self.__class__.__name__)
self.log = log

def apply_settings(self, system_settings, project_settings):
def apply_settings(self, project_settings):
"""Apply OpenPype system/project settings to the TextureProcessor
Args:
system_settings (dict): OpenPype system settings
project_settings (dict): OpenPype project settings
Returns:
Expand Down Expand Up @@ -250,7 +249,7 @@ def __init__(self, log=None):
super(MakeTX, self).__init__(log=log)
self.extra_args = []

def apply_settings(self, system_settings, project_settings):
def apply_settings(self, project_settings):
# Allow extra maketx arguments from project settings
args_settings = (
project_settings["maya"]["publish"]
Expand Down Expand Up @@ -488,8 +487,7 @@ def process(self, instance):
}.items():
if instance.data.get(key, False):
processor = Processor(log=self.log)
processor.apply_settings(context.data["system_settings"],
context.data["project_settings"])
processor.apply_settings(context.data["project_settings"])
processors.append(processor)

if processors:
Expand Down
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/substancepainter/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ayon_core.host import HostBase, IWorkfileHost, ILoadHost, IPublishHost
from ayon_core.settings import (
get_current_project_settings,
get_system_settings
get_project_settings,
)

from ayon_core.pipeline.template_data import get_template_data_with_names
Expand Down Expand Up @@ -252,9 +252,9 @@ def _install_shelves(self, project_settings):
project_name = self.get_current_project_name()
asset_name = self.get_current_asset_name()
task_name = self.get_current_asset_name()
system_settings = get_system_settings()
project_settings = get_project_settings(project_name)
formatting_data = get_template_data_with_names(
project_name, asset_name, task_name, system_settings
project_name, asset_name, task_name, project_settings
)
anatomy = Anatomy(project_name)
formatting_data["root"] = anatomy.roots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_pre_create_attr_defs(self):
)
]

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
host = self.create_context.host
host_name = host.name
project_name = host.get_current_project_name()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class ExistingLayoutLoader(plugin.Loader):
delete_unmatched_assets = True

@classmethod
def apply_settings(cls, project_settings, *args, **kwargs):
def apply_settings(cls, project_settings):
super(ExistingLayoutLoader, cls).apply_settings(
project_settings, *args, **kwargs
project_settings
)
cls.delete_unmatched_assets = (
project_settings["unreal"]["delete_unmatched_assets"]
Expand Down
20 changes: 8 additions & 12 deletions client/ayon_core/lib/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

from ayon_core import AYON_CORE_ROOT
from ayon_core.client import get_asset_name_identifier
from ayon_core.settings import (
get_system_settings,
get_project_settings,
)
from ayon_core.settings import get_project_settings, get_studio_settings
from .log import Logger
from .profiles_filtering import filter_profiles
from .local_settings import get_ayon_username
Expand Down Expand Up @@ -405,7 +402,7 @@ def refresh(self):
if self._studio_settings is not None:
settings = copy.deepcopy(self._studio_settings)
else:
settings = get_system_settings(
settings = get_studio_settings(
clear_metadata=False, exclude_locals=False
)

Expand Down Expand Up @@ -1398,8 +1395,9 @@ def __init__(self, data):
if data.get("env") is None:
data["env"] = os.environ.copy()

if "system_settings" not in data:
data["system_settings"] = get_system_settings()
project_name = data["project_doct"]["name"]
if "project_settings" not in data:
data["project_settings"] = get_project_settings(project_name)

super(EnvironmentPrepData, self).__init__(data)

Expand Down Expand Up @@ -1524,8 +1522,8 @@ def prepare_app_environments(
# Use environments from local settings
filtered_local_envs = {}
# NOTE Overrides for environment variables are not implemented in AYON.
# system_settings = data["system_settings"]
# whitelist_envs = system_settings["general"].get("local_env_white_list")
# project_settings = data["project_settings"]
# whitelist_envs = project_settings["general"].get("local_env_white_list")
# if whitelist_envs:
# local_settings = get_local_settings()
# local_envs = local_settings.get("environments") or {}
Expand Down Expand Up @@ -1689,9 +1687,7 @@ def prepare_context_environments(data, env_group=None, addons_manager=None):
# Load project specific environments
project_name = project_doc["name"]
project_settings = get_project_settings(project_name)
system_settings = get_system_settings()
data["project_settings"] = project_settings
data["system_settings"] = system_settings

app = data["app"]
context_env = {
Expand Down Expand Up @@ -1731,7 +1727,7 @@ def prepare_context_environments(data, env_group=None, addons_manager=None):
)

workdir_data = get_template_data(
project_doc, asset_doc, task_name, app.host_name, system_settings
project_doc, asset_doc, task_name, app.host_name, project_settings
)
data["workdir_data"] = workdir_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _collect_deadline_url(self, render_instance):
from maya import cmds
deadline_settings = (
render_instance.context.data
["system_settings"]
["project_settings"]
["deadline"]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CollectDeadlinePools(pyblish.api.InstancePlugin,
secondary_pool = None

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
# deadline.publish.CollectDeadlinePools
settings = project_settings["deadline"]["publish"]["CollectDeadlinePools"] # noqa
cls.primary_pool = settings.get("primary_pool", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
group = None

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
settings = project_settings["deadline"]["publish"]["MaxSubmitDeadline"] # noqa

# Take some defaults from settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
strict_error_checking = True

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
settings = project_settings["deadline"]["publish"]["MayaSubmitDeadline"] # noqa

# Take some defaults from settings
Expand Down
6 changes: 3 additions & 3 deletions client/ayon_core/modules/job_queue/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import platform

from ayon_core.addon import AYONAddon, click_wrap
from ayon_core.settings import get_system_settings
from ayon_core.settings import get_studio_settings


class JobQueueAddon(AYONAddon):
Expand Down Expand Up @@ -122,7 +122,7 @@ def get_jobs_root(self):

@classmethod
def get_jobs_root_from_settings(cls):
studio_settings = get_system_settings()
studio_settings = get_studio_settings()
jobs_root_mapping = studio_settings.get(cls.name, {}).get("jobs_root")
converted_mapping = cls._roots_mapping_conversion(jobs_root_mapping)

Expand Down Expand Up @@ -152,7 +152,7 @@ def cli(self, click_group):

@classmethod
def get_server_url_from_settings(cls):
studio_settings = get_system_settings()
studio_settings = get_studio_settings()
return cls.url_conversion(
studio_settings
.get(cls.name, {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Requires:
context -> system_settings
context -> project_settings
context -> ayonAddonsManager
"""

Expand All @@ -18,8 +18,8 @@ def process(self, context):
self.log.debug("TimersManager is disabled")
return

studio_settings = context.data["system_settings"]
if not studio_settings["timers_manager"]["disregard_publishing"]:
project_settings = context.data["project_settings"]
if not project_settings["timers_manager"]["disregard_publishing"]:
self.log.debug("Publish is not affecting running timers.")
return

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Requires:
context -> system_settings
context -> project_settings
context -> ayonAddonsManager
"""

Expand All @@ -19,8 +19,8 @@ def process(self, context):
self.log.debug("TimersManager is disabled")
return

studio_settings = context.data["system_settings"]
if not studio_settings["timers_manager"]["disregard_publishing"]:
project_settings = context.data["project_settings"]
if not project_settings["timers_manager"]["disregard_publishing"]:
self.log.debug("Publish is not affecting running timers.")
return

Expand Down
15 changes: 8 additions & 7 deletions client/ayon_core/pipeline/context_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,14 @@ def is_representation_from_latest(representation):
return version_is_latest(project_name, representation["parent"])


def get_template_data_from_session(session=None, system_settings=None):
def get_template_data_from_session(session=None, settings=None):
"""Template data for template fill from session keys.
Args:
session (Union[Dict[str, str], None]): The Session to use. If not
provided use the currently active global Session.
system_settings (Union[Dict[str, Any], Any]): Prepared system settings.
Optional are auto received if not passed.
settings (Optional[Dict[str, Any]]): Prepared studio or project
settings.
Returns:
Dict[str, Any]: All available data from session.
Expand All @@ -486,15 +486,16 @@ def get_template_data_from_session(session=None, system_settings=None):
host_name = get_current_host_name()

return get_template_data_with_names(
project_name, asset_name, task_name, host_name, system_settings
project_name, asset_name, task_name, host_name, settings
)


def get_current_context_template_data(system_settings=None):
def get_current_context_template_data(settings=None):
"""Prepare template data for current context.
Args:
system_settings (Optional[Dict[str, Any]]): Prepared system settings.
settings (Optional[Dict[str, Any]]): Prepared studio or
project settings.
Returns:
Dict[str, Any] Template data for current context.
Expand All @@ -507,7 +508,7 @@ def get_current_context_template_data(system_settings=None):
host_name = get_current_host_name()

return get_template_data_with_names(
project_name, asset_name, task_name, host_name, system_settings
project_name, asset_name, task_name, host_name, settings
)


Expand Down
7 changes: 1 addition & 6 deletions client/ayon_core/pipeline/create/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
get_asset_by_name,
get_asset_name_identifier,
)
from ayon_core.settings import (
get_system_settings,
get_project_settings
)
from ayon_core.settings import get_project_settings
from ayon_core.lib.attribute_definitions import (
UnknownDef,
serialize_attr_defs,
Expand Down Expand Up @@ -1779,7 +1776,6 @@ def _reset_publish_plugins(self, discover_publish_plugins):

def _reset_creator_plugins(self):
# Prepare settings
system_settings = get_system_settings()
project_settings = get_project_settings(self.project_name)

# Discover and prepare creators
Expand Down Expand Up @@ -1817,7 +1813,6 @@ def _reset_creator_plugins(self):

creator = creator_class(
project_settings,
system_settings,
self,
self.headless
)
Expand Down
Loading

0 comments on commit 69d9254

Please sign in to comment.