mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Refactor - removed unnecessary variable
Fixed expectedFiles, they need to extended (at least in Nuke, first renders, then baking etc.)
This commit is contained in:
parent
b9e362d1e8
commit
614d600564
3 changed files with 22 additions and 27 deletions
|
|
@ -79,7 +79,6 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._instance = None
|
||||
self._rr_root = None
|
||||
self.scene_path = None
|
||||
self.job = None
|
||||
|
|
@ -99,7 +98,6 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
"suspend_publish"]
|
||||
|
||||
context = instance.context
|
||||
self._instance = instance
|
||||
|
||||
self._rr_root = self._resolve_rr_path(context, instance.data.get(
|
||||
"rrPathName")) # noqa
|
||||
|
|
@ -128,11 +126,11 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
"Using published scene for render {}".format(self.scene_path)
|
||||
)
|
||||
|
||||
if not self._instance.data.get("expectedFiles"):
|
||||
self._instance.data["expectedFiles"] = []
|
||||
if not instance.data.get("expectedFiles"):
|
||||
instance.data["expectedFiles"] = []
|
||||
|
||||
if not self._instance.data.get("rrJobs"):
|
||||
self._instance.data["rrJobs"] = []
|
||||
if not instance.data.get("rrJobs"):
|
||||
instance.data["rrJobs"] = []
|
||||
|
||||
def get_job(self, instance, script_path, render_path, node_name):
|
||||
"""Get RR job based on current instance.
|
||||
|
|
@ -150,7 +148,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
end_frame = int(instance.data["frameEndHandle"])
|
||||
|
||||
batch_name = os.path.basename(script_path)
|
||||
jobname = "%s - %s" % (batch_name, self._instance.name)
|
||||
jobname = "%s - %s" % (batch_name, instance.name)
|
||||
if is_in_tests():
|
||||
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")
|
||||
|
||||
|
|
@ -252,9 +250,6 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
list: List of expected files.
|
||||
|
||||
"""
|
||||
if instance.data.get("expectedFiles"):
|
||||
return instance.data["expectedFiles"]
|
||||
|
||||
dir_name = os.path.dirname(path)
|
||||
file = os.path.basename(path)
|
||||
|
||||
|
|
@ -269,7 +264,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
expected_files.append(path)
|
||||
return expected_files
|
||||
|
||||
if self._instance.data.get("slate"):
|
||||
if instance.data.get("slate"):
|
||||
start_frame -= 1
|
||||
|
||||
expected_files.extend(
|
||||
|
|
@ -293,13 +288,13 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
str
|
||||
|
||||
"""
|
||||
self.log.debug("_ path: `{}`".format(path))
|
||||
self.log.debug("pad_file_name path: `{}`".format(path))
|
||||
if "%" in path:
|
||||
search_results = re.search(r"(%0)(\d)(d.)", path).groups()
|
||||
self.log.debug("_ search_results: `{}`".format(search_results))
|
||||
return int(search_results[1])
|
||||
if "#" in path:
|
||||
self.log.debug("_ path: `{}`".format(path))
|
||||
self.log.debug("already padded: `{}`".format(path))
|
||||
return path
|
||||
|
||||
if first_frame:
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ class CreateMayaRoyalRenderJob(lib.BaseCreateRoyalRenderJob):
|
|||
"""Plugin entry point."""
|
||||
super(CreateMayaRoyalRenderJob, self).process(instance)
|
||||
|
||||
expected_files = self._instance.data["expectedFiles"]
|
||||
expected_files = instance.data["expectedFiles"]
|
||||
first_file_path = next(iter_expected_files(expected_files))
|
||||
output_dir = os.path.dirname(first_file_path)
|
||||
self._instance.data["outputDir"] = output_dir
|
||||
instance.data["outputDir"] = output_dir
|
||||
|
||||
layer = self._instance.data["setMembers"] # type: str
|
||||
layer = instance.data["setMembers"] # type: str
|
||||
layer_name = layer.removeprefix("rs_")
|
||||
|
||||
job = self.get_job(instance, self.scene_path, first_file_path,
|
||||
|
|
|
|||
|
|
@ -15,22 +15,22 @@ class CreateNukeRoyalRenderJob(lib.BaseCreateRoyalRenderJob):
|
|||
super(CreateNukeRoyalRenderJob, self).process(instance)
|
||||
|
||||
# redefinition of families
|
||||
if "render" in self._instance.data["family"]:
|
||||
self._instance.data["family"] = "write"
|
||||
self._instance.data["families"].insert(0, "render2d")
|
||||
elif "prerender" in self._instance.data["family"]:
|
||||
self._instance.data["family"] = "write"
|
||||
self._instance.data["families"].insert(0, "prerender")
|
||||
if "render" in instance.data["family"]:
|
||||
instance.data["family"] = "write"
|
||||
instance.data["families"].insert(0, "render2d")
|
||||
elif "prerender" in instance.data["family"]:
|
||||
instance.data["family"] = "write"
|
||||
instance.data["families"].insert(0, "prerender")
|
||||
|
||||
jobs = self.create_jobs(self._instance)
|
||||
jobs = self.create_jobs(instance)
|
||||
for job in jobs:
|
||||
job = self.update_job_with_host_specific(instance, job)
|
||||
|
||||
instance.data["rrJobs"].append(job)
|
||||
instance.data["rrJobs"].append(job)
|
||||
|
||||
def update_job_with_host_specific(self, instance, job):
|
||||
nuke_version = re.search(
|
||||
r"\d+\.\d+", self._instance.context.data.get("hostVersion"))
|
||||
r"\d+\.\d+", instance.context.data.get("hostVersion"))
|
||||
|
||||
job.Software = "Nuke"
|
||||
job.Version = nuke_version.group()
|
||||
|
|
@ -42,7 +42,7 @@ class CreateNukeRoyalRenderJob(lib.BaseCreateRoyalRenderJob):
|
|||
# get output path
|
||||
render_path = instance.data['path']
|
||||
script_path = self.scene_path
|
||||
node = self._instance.data["transientData"]["node"]
|
||||
node = instance.data["transientData"]["node"]
|
||||
|
||||
# main job
|
||||
jobs = [
|
||||
|
|
@ -54,7 +54,7 @@ class CreateNukeRoyalRenderJob(lib.BaseCreateRoyalRenderJob):
|
|||
)
|
||||
]
|
||||
|
||||
for baking_script in self._instance.data.get("bakingNukeScripts", []):
|
||||
for baking_script in instance.data.get("bakingNukeScripts", []):
|
||||
render_path = baking_script["bakeRenderPath"]
|
||||
script_path = baking_script["bakeScriptPath"]
|
||||
exe_node_name = baking_script["bakeWriteNodeName"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue