mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
extract burnin pass fill data to burnin script with help of temporary json file
This commit is contained in:
parent
53ac2e5098
commit
965f633e33
2 changed files with 26 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ import os
|
|||
import re
|
||||
import json
|
||||
import copy
|
||||
import tempfile
|
||||
|
||||
import pype.api
|
||||
import pyblish
|
||||
|
|
@ -222,12 +223,30 @@ class ExtractBurnin(pype.api.Extractor):
|
|||
# Dump data to string
|
||||
dumped_script_data = json.dumps(script_data)
|
||||
|
||||
# Store dumped json to temporary file
|
||||
temporary_json_file = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".json", delete=False
|
||||
)
|
||||
temporary_json_file.write(dumped_script_data)
|
||||
temporary_json_file.close()
|
||||
temporary_json_filepath = temporary_json_file.name.replace(
|
||||
"\\", "/"
|
||||
)
|
||||
|
||||
# Prepare subprocess arguments
|
||||
args = [executable, scriptpath, dumped_script_data]
|
||||
self.log.debug("Executing: {}".format(args))
|
||||
args = [
|
||||
"\"{}\"".format(executable),
|
||||
"\"{}\"".format(scriptpath),
|
||||
"\"{}\"".format(temporary_json_filepath)
|
||||
]
|
||||
subprcs_cmd = " ".join(args)
|
||||
self.log.debug("Executing: {}".format(subprcs_cmd))
|
||||
|
||||
# Run burnin script
|
||||
pype.api.subprocess(args, shell=True, logger=self.log)
|
||||
pype.api.subprocess(subprcs_cmd, shell=True, logger=self.log)
|
||||
|
||||
# Remove the temporary json
|
||||
os.remove(temporary_json_filepath)
|
||||
|
||||
for filepath in temp_data["full_input_paths"]:
|
||||
filepath = filepath.replace("\\", "/")
|
||||
|
|
|
|||
|
|
@ -578,7 +578,10 @@ def burnins_from_data(
|
|||
|
||||
if __name__ == "__main__":
|
||||
print("* Burnin script started")
|
||||
in_data = json.loads(sys.argv[-1])
|
||||
in_data_json_path = sys.argv[-1]
|
||||
with open(in_data_json_path, "r") as file_stream:
|
||||
in_data = json.load(file_stream)
|
||||
|
||||
burnins_from_data(
|
||||
in_data["input"],
|
||||
in_data["output"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue