mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
renamed env key to FILESEQUENCE, added assertion of family in data, added convertion from json string to string, removed metadata from instance.data
This commit is contained in:
parent
83bf264f4a
commit
e475037f72
2 changed files with 22 additions and 12 deletions
|
|
@ -64,10 +64,10 @@ def collect(root,
|
|||
return collections
|
||||
|
||||
|
||||
class CollectImageSequences(pyblish.api.ContextPlugin):
|
||||
"""Gather image sequences from working directory
|
||||
class CollectFileSequences(pyblish.api.ContextPlugin):
|
||||
"""Gather file sequences from working directory
|
||||
|
||||
When "IMAGESEQUENCES" environment variable is set these paths (folders or
|
||||
When "FILESEQUENCE" environment variable is set these paths (folders or
|
||||
.json files) are parsed for image sequences. Otherwise the current
|
||||
working directory is searched for file sequences.
|
||||
|
||||
|
|
@ -87,12 +87,12 @@ class CollectImageSequences(pyblish.api.ContextPlugin):
|
|||
|
||||
order = pyblish.api.CollectorOrder
|
||||
targets = ["imagesequence"]
|
||||
label = "Image Sequences"
|
||||
label = "File Sequences"
|
||||
|
||||
def process(self, context):
|
||||
|
||||
if os.environ.get("IMAGESEQUENCES"):
|
||||
paths = os.environ["IMAGESEQUENCES"].split(os.pathsep)
|
||||
if os.environ.get("FILESEQUENCE"):
|
||||
paths = os.environ["FILESEQUENCE"].split(os.pathsep)
|
||||
else:
|
||||
cwd = context.get("workspaceDir", os.getcwd())
|
||||
paths = [cwd]
|
||||
|
|
@ -128,8 +128,14 @@ class CollectImageSequences(pyblish.api.ContextPlugin):
|
|||
|
||||
self.log.info("Collecting: {}".format(root))
|
||||
|
||||
regex = data.get("regex")
|
||||
if regex:
|
||||
# ensure regex string is proper, json adds double slashes
|
||||
regex = regex.replace("\\_", "_")
|
||||
self.log.info("Decoded regex to: {}".format(regex))
|
||||
|
||||
collections = collect(root=root,
|
||||
regex=data.get("regex"),
|
||||
regex=regex,
|
||||
exclude_regex=data.get("exclude_regex"),
|
||||
startFrame=data.get("startFrame"),
|
||||
endFrame=data.get("endFrame"))
|
||||
|
|
@ -144,6 +150,11 @@ class CollectImageSequences(pyblish.api.ContextPlugin):
|
|||
"found sequence")
|
||||
raise RuntimeError("Invalid sequence")
|
||||
|
||||
# Get family from the data
|
||||
families = data.get("families", ["colorbleed.imagesequence"])
|
||||
assert isinstance(families, (list, tuple)), "Must be iterable"
|
||||
assert families, "Must have at least a single family"
|
||||
|
||||
for collection in collections:
|
||||
instance = context.create_instance(str(collection))
|
||||
self.log.info("Collection: %s" % list(collection))
|
||||
|
|
@ -161,15 +172,14 @@ class CollectImageSequences(pyblish.api.ContextPlugin):
|
|||
|
||||
instance.data.update({
|
||||
"name": str(collection),
|
||||
"family": "colorbleed.imagesequence",
|
||||
"families": ["colorbleed.imagesequence"],
|
||||
"family": families[0], # backwards compatibility / pyblish
|
||||
"families": list(families),
|
||||
"subset": subset,
|
||||
"asset": data.get("asset", api.Session["AVALON_ASSET"]),
|
||||
"stagingDir": root,
|
||||
"files": [list(collection)],
|
||||
"startFrame": start,
|
||||
"endFrame": end,
|
||||
"metadata": data.get("metadata")
|
||||
"endFrame": end
|
||||
})
|
||||
instance.append(collection)
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ def publish(paths, gui=False):
|
|||
assert any(paths), "No paths found in the list"
|
||||
# Set the paths to publish for the collector if any provided
|
||||
if paths:
|
||||
os.environ["IMAGESEQUENCES"] = os.pathsep.join(paths)
|
||||
os.environ["FILESEQUENCE"] = os.pathsep.join(paths)
|
||||
|
||||
# Install Avalon with shell as current host
|
||||
from avalon import api, shell
|
||||
Loading…
Add table
Add a link
Reference in a new issue