mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
import reference during publish
This commit is contained in:
parent
df62f315cc
commit
ddb6ae8a5a
2 changed files with 8 additions and 12 deletions
|
|
@ -105,17 +105,13 @@ print("*** Done")
|
|||
# can't use TemporaryNamedFile as that can't be opened in another
|
||||
# process until handles are closed by context manager.
|
||||
with tempfile.TemporaryDirectory() as tmp_dir_name:
|
||||
tmp_file_name = os.path.join(tmp_dir_name, "import_ref.py")
|
||||
tmp = open(tmp_file_name, "w+t")
|
||||
subprocess_args = [
|
||||
mayapy_exe,
|
||||
tmp_file_name
|
||||
]
|
||||
self.log.info("Using temp file: {}".format(tmp.name))
|
||||
try:
|
||||
tmp_script_path = os.path.join(tmp_dir_name, "import_ref.py")
|
||||
self.log.info("Using script file: {}".format(tmp_script_path))
|
||||
with open(tmp_script_path, "wt") as tmp:
|
||||
tmp.write(script)
|
||||
tmp.close()
|
||||
run_subprocess(subprocess_args)
|
||||
|
||||
try:
|
||||
run_subprocess([mayapy_exe, tmp_script_path])
|
||||
except Exception:
|
||||
self.log.error("Import reference failed", exc_info=True)
|
||||
raise
|
||||
|
|
|
|||
|
|
@ -525,9 +525,9 @@ class AbstractSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
# determine published path from Anatomy.
|
||||
template_data = workfile_instance.data.get("anatomyData")
|
||||
if self.import_reference:
|
||||
rep = workfile_instance.data.get("representations")[1]
|
||||
rep = workfile_instance.data["representations"][1]
|
||||
else:
|
||||
rep = workfile_instance.data.get("representations")[0]
|
||||
rep = workfile_instance.data["representations"][0]
|
||||
template_data["representation"] = rep.get("name")
|
||||
template_data["ext"] = rep.get("ext")
|
||||
template_data["comment"] = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue