mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
resolve: wip publishing and creation
This commit is contained in:
parent
600f60188c
commit
a04aab3371
7 changed files with 62 additions and 35 deletions
|
|
@ -83,7 +83,8 @@ from .editorial import (
|
|||
convert_to_padded_path,
|
||||
trim_media_range,
|
||||
range_from_frames,
|
||||
frames_to_secons
|
||||
frames_to_secons,
|
||||
make_sequence_collection
|
||||
)
|
||||
|
||||
terminal = Terminal
|
||||
|
|
@ -154,5 +155,6 @@ __all__ = [
|
|||
"otio_range_to_frame_range",
|
||||
"trim_media_range",
|
||||
"range_from_frames",
|
||||
"frames_to_secons"
|
||||
"frames_to_secons",
|
||||
"make_sequence_collection"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import os
|
||||
import re
|
||||
import clique
|
||||
from opentimelineio import opentime
|
||||
from opentimelineio.opentime import (
|
||||
to_frames, RationalTime, TimeRange)
|
||||
|
|
@ -130,3 +132,29 @@ def frames_to_secons(frames, framerate):
|
|||
"""
|
||||
rt = opentime.from_frames(frames, framerate)
|
||||
return opentime.to_seconds(rt)
|
||||
|
||||
|
||||
def make_sequence_collection(path, otio_range, metadata):
|
||||
"""
|
||||
Make collection from path otio range and otio metadata.
|
||||
|
||||
Args:
|
||||
path (str): path to image sequence with `%d`
|
||||
otio_range (otio.opentime.TimeRange): range to be used
|
||||
metadata (dict): data where padding value can be found
|
||||
|
||||
Returns:
|
||||
list: dir_path (str): path to sequence, collection object
|
||||
|
||||
"""
|
||||
if "%" not in path:
|
||||
return None
|
||||
file_name = os.path.basename(path)
|
||||
dir_path = os.path.dirname(path)
|
||||
head = file_name.split("%")[0]
|
||||
tail = os.path.splitext(file_name)[-1]
|
||||
first, last = otio_range_to_frame_range(otio_range)
|
||||
collection = clique.Collection(
|
||||
head=head, tail=tail, padding=metadata["padding"])
|
||||
collection.indexes.update([i for i in range(first, (last + 1))])
|
||||
return dir_path, collection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue