Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5191 from ynput/maye_new_publisher_with_RR
Browse files Browse the repository at this point in the history
  • Loading branch information
antirotor authored Jul 17, 2023
2 parents b26b5fd + b90d1c9 commit c27150a
Show file tree
Hide file tree
Showing 34 changed files with 2,364 additions and 1,007 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ body:
- 3.14.6-nightly.1
- 3.14.5
- 3.14.5-nightly.3
- 3.14.5-nightly.2
- 3.14.5-nightly.1
- 3.14.4
- 3.14.4-nightly.4

validations:
required: true
- type: dropdown
Expand Down
7 changes: 7 additions & 0 deletions openpype/hosts/maya/plugins/publish/collect_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ def process(self, instance):
"colorspaceView": colorspace_data["view"],
}

rr_settings = (
context.data["system_settings"]["modules"]["royalrender"]
)
if rr_settings["enabled"]:
data["rrPathName"] = instance.data.get("rrPathName")
self.log.info(data["rrPathName"])

if self.sync_workfile_version:
data["version"] = context.data["version"]
for instance in context:
Expand Down
90 changes: 5 additions & 85 deletions openpype/modules/deadline/abstract_submit_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
KnownPublishError,
OpenPypePyblishPluginMixin
)
from openpype.pipeline.publish.lib import (
replace_with_published_scene_path
)

JSONDecodeError = getattr(json.decoder, "JSONDecodeError", ValueError)

Expand Down Expand Up @@ -525,72 +528,8 @@ def from_published_scene(self, replace_in_path=True):
published.
"""
instance = self._instance
workfile_instance = self._get_workfile_instance(instance.context)
if workfile_instance is None:
return

# determine published path from Anatomy.
template_data = workfile_instance.data.get("anatomyData")
rep = workfile_instance.data["representations"][0]
template_data["representation"] = rep.get("name")
template_data["ext"] = rep.get("ext")
template_data["comment"] = None

anatomy = instance.context.data['anatomy']
template_obj = anatomy.templates_obj["publish"]["path"]
template_filled = template_obj.format_strict(template_data)
file_path = os.path.normpath(template_filled)

self.log.info("Using published scene for render {}".format(file_path))

if not os.path.exists(file_path):
self.log.error("published scene does not exist!")
raise

if not replace_in_path:
return file_path

# now we need to switch scene in expected files
# because <scene> token will now point to published
# scene file and that might differ from current one
def _clean_name(path):
return os.path.splitext(os.path.basename(path))[0]

new_scene = _clean_name(file_path)
orig_scene = _clean_name(instance.context.data["currentFile"])
expected_files = instance.data.get("expectedFiles")

if isinstance(expected_files[0], dict):
# we have aovs and we need to iterate over them
new_exp = {}
for aov, files in expected_files[0].items():
replaced_files = []
for f in files:
replaced_files.append(
str(f).replace(orig_scene, new_scene)
)
new_exp[aov] = replaced_files
# [] might be too much here, TODO
instance.data["expectedFiles"] = [new_exp]
else:
new_exp = []
for f in expected_files:
new_exp.append(
str(f).replace(orig_scene, new_scene)
)
instance.data["expectedFiles"] = new_exp

metadata_folder = instance.data.get("publishRenderMetadataFolder")
if metadata_folder:
metadata_folder = metadata_folder.replace(orig_scene,
new_scene)
instance.data["publishRenderMetadataFolder"] = metadata_folder
self.log.info("Scene name was switched {} -> {}".format(
orig_scene, new_scene
))

return file_path
return replace_with_published_scene_path(
self._instance, replace_in_path=replace_in_path)

def assemble_payload(
self, job_info=None, plugin_info=None, aux_files=None):
Expand Down Expand Up @@ -651,22 +590,3 @@ def submit(self, payload):
self._instance.data["deadlineSubmissionJob"] = result

return result["_id"]

@staticmethod
def _get_workfile_instance(context):
"""Find workfile instance in context"""
for instance in context:

is_workfile = (
"workfile" in instance.data.get("families", []) or
instance.data["family"] == "workfile"
)
if not is_workfile:
continue

# test if there is instance of workfile waiting
# to be published.
assert instance.data.get("publish", True) is True, (
"Workfile (scene) must be published along")

return instance
16 changes: 3 additions & 13 deletions openpype/modules/deadline/plugins/publish/submit_maya_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
from openpype.tests.lib import is_in_tests
from openpype.lib import is_running_from_build
from openpype.pipeline.farm.tools import iter_expected_files


def _validate_deadline_bool_value(instance, attribute, value):
Expand Down Expand Up @@ -238,7 +239,7 @@ def get_job_info(self):
# Add list of expected files to job
# ---------------------------------
exp = instance.data.get("expectedFiles")
for filepath in self._iter_expected_files(exp):
for filepath in iter_expected_files(exp):
job_info.OutputDirectory += os.path.dirname(filepath)
job_info.OutputFilename += os.path.basename(filepath)

Expand Down Expand Up @@ -296,7 +297,7 @@ def process_submission(self):
# TODO: Avoid the need for this logic here, needed for submit publish
# Store output dir for unified publisher (filesequence)
expected_files = instance.data["expectedFiles"]
first_file = next(self._iter_expected_files(expected_files))
first_file = next(iter_expected_files(expected_files))
output_dir = os.path.dirname(first_file)
instance.data["outputDir"] = output_dir
instance.data["toBeRenderedOn"] = "deadline"
Expand Down Expand Up @@ -815,16 +816,6 @@ def _job_info_label(self, label):
end=int(self._instance.data["frameEndHandle"]),
)

@staticmethod
def _iter_expected_files(exp):
if isinstance(exp[0], dict):
for _aov, files in exp[0].items():
for file in files:
yield file
else:
for file in exp:
yield file

@classmethod
def get_attribute_defs(cls):
defs = super(MayaSubmitDeadline, cls).get_attribute_defs()
Expand Down Expand Up @@ -863,7 +854,6 @@ def get_attribute_defs(cls):

return defs


def _format_tiles(
filename,
index,
Expand Down
Loading

0 comments on commit c27150a

Please sign in to comment.