mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #108 from ynput/enhancement/royal-render-project-settings-conversion
RoyalRender: Remove project settings conversion
This commit is contained in:
commit
38e61dcba5
4 changed files with 37 additions and 41 deletions
|
|
@ -108,7 +108,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
|
||||
context = instance.context
|
||||
|
||||
self._rr_root = instance.data.get("rrPathName")
|
||||
self._rr_root = instance.data.get("rr_root")
|
||||
if not self._rr_root:
|
||||
raise KnownPublishError(
|
||||
("Missing RoyalRender root. "
|
||||
|
|
|
|||
|
|
@ -1,41 +1,52 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Requires:
|
||||
instance.context.data["project_settings"]
|
||||
Provides:
|
||||
instance.data["rr_root"] (str) - root folder of RoyalRender server
|
||||
"""
|
||||
import os.path
|
||||
|
||||
import pyblish.api
|
||||
from ayon_core.modules.royalrender.rr_job import get_rr_platform
|
||||
|
||||
|
||||
class CollectRRPathFromInstance(pyblish.api.InstancePlugin):
|
||||
"""Collect RR Path from instance."""
|
||||
"""Collect RR Path from instance.
|
||||
|
||||
All RoyalRender server roots are set in `Studio Settings`, each project
|
||||
uses only key pointing to that part to limit typos inside of Project
|
||||
settings.
|
||||
Eventually could be possible to add dropdown with these keys to the
|
||||
Creators to allow artists to select which RR server they would like to use.
|
||||
"""
|
||||
|
||||
order = pyblish.api.CollectorOrder
|
||||
label = "Collect Royal Render path name from the Instance"
|
||||
families = ["render", "prerender", "renderlayer"]
|
||||
|
||||
def process(self, instance):
|
||||
instance.data["rrPathName"] = self._collect_rr_path_name(instance)
|
||||
instance.data["rr_root"] = self._collect_root(instance)
|
||||
self.log.info(
|
||||
"Using '{}' for submission.".format(instance.data["rrPathName"]))
|
||||
"Using '{}' for submission.".format(instance.data["rr_root"]))
|
||||
|
||||
@staticmethod
|
||||
def _collect_rr_path_name(instance):
|
||||
def _collect_root(self, instance):
|
||||
# type: (pyblish.api.Instance) -> str
|
||||
"""Get Royal Render pat name from render instance."""
|
||||
|
||||
# TODO there are no "rrPaths" on instance, if Publisher should expose
|
||||
# this (eg. artist could select specific server) it must be added
|
||||
# to publisher
|
||||
instance_rr_paths = instance.data.get("rrPaths")
|
||||
if instance_rr_paths is None:
|
||||
return "default"
|
||||
|
||||
"""Get Royal Render pat name from render instance.
|
||||
If artist should be able to select specific RR server it must be added
|
||||
to creator. It is not there yet.
|
||||
"""
|
||||
rr_settings = instance.context.data["project_settings"]["royalrender"]
|
||||
rr_paths = rr_settings["rr_paths"]
|
||||
selected_paths = rr_settings["selected_rr_paths"]
|
||||
selected_keys = rr_settings["selected_rr_paths"]
|
||||
|
||||
rr_servers = {
|
||||
path_key
|
||||
for path_key in selected_paths
|
||||
if path_key in rr_paths
|
||||
platform = get_rr_platform()
|
||||
key_to_path = {
|
||||
item["name"]: item["value"][platform]
|
||||
for item in rr_paths
|
||||
}
|
||||
for instance_rr_path in instance_rr_paths:
|
||||
if instance_rr_path in rr_servers:
|
||||
return instance_rr_path
|
||||
return "default"
|
||||
|
||||
for selected_key in selected_keys:
|
||||
rr_root = key_to_path[selected_key]
|
||||
if os.path.exists(rr_root):
|
||||
return rr_root
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin):
|
|||
isinstance(job, RRJob)
|
||||
for job in instance.data.get("rrJobs")):
|
||||
jobs += instance.data.get("rrJobs")
|
||||
if instance.data.get("rrPathName"):
|
||||
instance_rr_path = instance.data["rrPathName"]
|
||||
if instance.data.get("rr_root"):
|
||||
instance_rr_path = instance.data["rr_root"]
|
||||
|
||||
if jobs:
|
||||
self._rr_root = instance_rr_path
|
||||
|
|
|
|||
|
|
@ -133,24 +133,9 @@ def convert_system_settings(ayon_settings, default_settings, addon_versions):
|
|||
|
||||
|
||||
# --------- Project settings ---------
|
||||
def _convert_royalrender_project_settings(ayon_settings, output):
|
||||
if "royalrender" not in ayon_settings:
|
||||
return
|
||||
ayon_royalrender = ayon_settings["royalrender"]
|
||||
rr_paths = ayon_royalrender.get("selected_rr_paths", [])
|
||||
|
||||
output["royalrender"] = {
|
||||
"publish": ayon_royalrender["publish"],
|
||||
"rr_paths": rr_paths,
|
||||
}
|
||||
|
||||
|
||||
def convert_project_settings(ayon_settings, default_settings):
|
||||
default_settings = copy.deepcopy(default_settings)
|
||||
output = {}
|
||||
|
||||
_convert_royalrender_project_settings(ayon_settings, output)
|
||||
|
||||
for key, value in ayon_settings.items():
|
||||
if key not in output:
|
||||
output[key] = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue