Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/multiple_instances_per_node
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy authored Jan 30, 2025
2 parents 1b5eeae + 6174b03 commit bcd7f27
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions client/ayon_silhouette/plugins/load/load_source.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import fx
import clique

from ayon_silhouette.api import plugin, lib

from ayon_core.pipeline import Anatomy
from ayon_core.lib.transcoding import (
VIDEO_EXTENSIONS, IMAGE_EXTENSIONS
)
Expand Down Expand Up @@ -52,6 +55,29 @@ def load(self, context, name=None, namespace=None, options=None):
# loader=str(self.__class__.__name__),
# )

def filepath_from_context(self, context):
# If the media is a sequence of files we need to load it with the
# frames in the path as in file.[start-end].ext
if context["representation"]["context"].get("frame"):
anatomy = Anatomy(
project_name=context["project"]["name"],
project_entity=context["project"]
)
representation = context["representation"]
files = [data["path"] for data in representation["files"]]
files = [anatomy.fill_root(file) for file in files]

collections, _remainder = clique.assemble(
files, patterns=[clique.PATTERNS["frames"]]
)
collection = collections[0]
frames = list(collection.indexes)
start = str(frames[0]).zfill(collection.padding)
end = str(frames[-1]).zfill(collection.padding)
return collection.format(f"{{head}}[{start}-{end}]{{tail}}")

return super().filepath_from_context(context)

def _get_label(self, context):
return context["product"]["name"]

Expand Down

0 comments on commit bcd7f27

Please sign in to comment.