mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
write json file and store path per instance
This commit is contained in:
parent
e475037f72
commit
c550d41f60
1 changed files with 33 additions and 0 deletions
|
|
@ -1,3 +1,7 @@
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
|
|
@ -26,3 +30,32 @@ class ExtractImageSequence(pyblish.api.Extractor):
|
|||
result = current_comp.Render()
|
||||
if not result:
|
||||
raise RuntimeError("Comp render failed")
|
||||
|
||||
# Write metadata json file per Saver instance
|
||||
instances = [i for i in context[:] if i[0].ID == "Saver"]
|
||||
for instance in instances:
|
||||
subset = instance.data["subset"]
|
||||
ext = instance.data["ext"]
|
||||
|
||||
# Regex to match resulting renders
|
||||
regex = "^{subset}.*[0-9]+.{ext}+$".format(subset=re.escape(subset)
|
||||
, ext=re.escape(ext))
|
||||
|
||||
# The instance has most of the information already stored
|
||||
metadata = {
|
||||
"regex": regex,
|
||||
"startFrame": context.data["startFrame"],
|
||||
"endFrame": context.data["endFrame"],
|
||||
"families": ["colorbleed.imagesequence"],
|
||||
}
|
||||
|
||||
# Write metadata and store the path in the instance
|
||||
output_directory = instance.data["outputDir"]
|
||||
path = os.path.join(output_directory,
|
||||
"{}_metadata.json".format(subset))
|
||||
|
||||
with open(path, "w") as f:
|
||||
json.dump(metadata, f)
|
||||
|
||||
# Store json path in instance
|
||||
instance.data["jsonpath"] = path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue