resolve: wip publishing and creation

This commit is contained in:
Jakub Jezek 2020-12-23 15:13:32 +01:00
parent 600f60188c
commit a04aab3371
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3
7 changed files with 62 additions and 35 deletions

View file

@ -595,8 +595,9 @@ class PublishClip:
hierarchy_formating_data
)
tag_hierarchy_data.update({"masterLayer": True})
if master_layer and self.vertical_sync:
tag_hierarchy_data.update({"masterLayer": True})
# tag_hierarchy_data.update({"masterLayer": True})
self.vertical_clip_match.update({
(self.clip_in, self.clip_out): tag_hierarchy_data
})

View file

@ -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"
]

View file

@ -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

View file

@ -158,8 +158,9 @@ class ExtractOTIOReview(pype.api.Extractor):
# in case it is file sequence but not new OTIO schema
# `ImageSequenceReference`
path = media_ref.target_url
dir_path, collection = self._make_sequence_collection(
collection_data = pype.lib.make_sequence_collection(
path, available_range, metadata)
dir_path, collection = collection_data
# render segment
self._render_seqment(
@ -422,29 +423,3 @@ class ExtractOTIOReview(pype.api.Extractor):
out_frame_start = self.used_frames[-1]
return output_path, out_frame_start
@staticmethod
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 = pype.lib.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

View file

@ -1,4 +1,4 @@
from pprint import pformat
# from pprint import pformat
from pype.hosts import resolve
from pype.hosts.resolve import lib
@ -200,20 +200,18 @@ class CreateShotClip(resolve.Creator):
presets = None
def process(self):
print("_____ presets: {}".format(pformat(self.presets)))
# get key pares from presets and match it on ui inputs
for k, v in self.gui_inputs.items():
if v["type"] in ("dict", "section"):
# nested dictionary (only one level allowed
# for sections and dict)
for _k, _v in v["value"].items():
if self.presets.get(_k):
if self.presets.get(_k) is not None:
self.gui_inputs[k][
"value"][_k]["value"] = self.presets[_k]
if self.presets.get(k):
self.gui_inputs[k]["value"] = self.presets[k]
print(pformat(self.gui_inputs))
# open widget for plugins inputs
widget = self.widget(self.gui_name, self.gui_info, self.gui_inputs)
widget.exec_()

View file

@ -1,9 +1,20 @@
{
"create": {
"CreateShotClip": {
"hierarchy": "{folder}/{sequence}",
"clipRename": true,
"clipName": "{track}{sequence}{shot}",
"countFrom": 10,
"countSteps": 10,
"folder": "takes",
"steps": 20
"episode": "ep01",
"sequence": "sq01",
"track": "{_track_}",
"shot": "sh###",
"vSyncOn": false,
"workfileFrameStart": 1001,
"handleStart": 10,
"handleEnd": 10
}
}
}

View file

@ -82,6 +82,18 @@
}
]
},
{
"type": "collapsible-wrap",
"label": "Vertical Synchronization Of Attributes",
"collapsable": false,
"children": [
{
"type": "boolean",
"key": "vSyncOn",
"label": "Enable Vertical Sync"
}
]
},
{
"type": "collapsible-wrap",
"label": "Shot Attributes",