From a04aab3371c991ff77ac6b408aa46d32e3fb859d Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 23 Dec 2020 15:13:32 +0100 Subject: [PATCH] resolve: wip publishing and creation --- pype/hosts/resolve/plugin.py | 3 +- pype/lib/__init__.py | 6 ++-- pype/lib/editorial.py | 28 ++++++++++++++++++ .../global/publish/extract_otio_review.py | 29 ++----------------- .../resolve/create/create_shot_clip.py | 6 ++-- .../defaults/project_settings/resolve.json | 13 ++++++++- .../schema_project_resolve.json | 12 ++++++++ 7 files changed, 62 insertions(+), 35 deletions(-) diff --git a/pype/hosts/resolve/plugin.py b/pype/hosts/resolve/plugin.py index 111fd8f4e2..2616491652 100644 --- a/pype/hosts/resolve/plugin.py +++ b/pype/hosts/resolve/plugin.py @@ -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 }) diff --git a/pype/lib/__init__.py b/pype/lib/__init__.py index 35ae0a901a..ae022e3073 100644 --- a/pype/lib/__init__.py +++ b/pype/lib/__init__.py @@ -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" ] diff --git a/pype/lib/editorial.py b/pype/lib/editorial.py index 42c345b47d..7f29bf00bb 100644 --- a/pype/lib/editorial.py +++ b/pype/lib/editorial.py @@ -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 diff --git a/pype/plugins/global/publish/extract_otio_review.py b/pype/plugins/global/publish/extract_otio_review.py index e960358749..c45e2a5d9f 100644 --- a/pype/plugins/global/publish/extract_otio_review.py +++ b/pype/plugins/global/publish/extract_otio_review.py @@ -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 diff --git a/pype/plugins/resolve/create/create_shot_clip.py b/pype/plugins/resolve/create/create_shot_clip.py index 35cb30636e..19e613ee7a 100644 --- a/pype/plugins/resolve/create/create_shot_clip.py +++ b/pype/plugins/resolve/create/create_shot_clip.py @@ -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_() diff --git a/pype/settings/defaults/project_settings/resolve.json b/pype/settings/defaults/project_settings/resolve.json index cb7064ee76..b210759417 100644 --- a/pype/settings/defaults/project_settings/resolve.json +++ b/pype/settings/defaults/project_settings/resolve.json @@ -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 } } } \ No newline at end of file diff --git a/pype/tools/settings/settings/gui_schemas/projects_schema/schema_project_resolve.json b/pype/tools/settings/settings/gui_schemas/projects_schema/schema_project_resolve.json index 18f6817407..fb9b9b7a0a 100644 --- a/pype/tools/settings/settings/gui_schemas/projects_schema/schema_project_resolve.json +++ b/pype/tools/settings/settings/gui_schemas/projects_schema/schema_project_resolve.json @@ -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",