From ffc92fd1f447588833bd230c8d17f766a52dae93 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 19 Jan 2022 14:40:19 +0100 Subject: [PATCH] flame: subset name from settings https://github.com/pypeclub/OpenPype/pull/2519#discussion_r785985961 --- .../plugins/publish/precollect_workfile.py | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/flame/plugins/publish/precollect_workfile.py b/openpype/hosts/flame/plugins/publish/precollect_workfile.py index aff85e22e6..8d49993576 100644 --- a/openpype/hosts/flame/plugins/publish/precollect_workfile.py +++ b/openpype/hosts/flame/plugins/publish/precollect_workfile.py @@ -1,5 +1,6 @@ import pyblish.api import avalon.api as avalon +import openpype.lib as oplib import openpype.hosts.flame.api as opfapi from openpype.hosts.flame.otio import flame_export @@ -11,19 +12,32 @@ class PrecollecTimelineOCIO(pyblish.api.ContextPlugin): order = pyblish.api.CollectorOrder - 0.5 def process(self, context): - asset = avalon.Session["AVALON_ASSET"] - subset = "otioTimeline" + # plugin defined + family = "workfile" + variant = "otioTimeline" + + # main + asset_doc = context.data["assetEntity"] + task_name = avalon.Session["AVALON_TASK"] project = opfapi.get_current_project() sequence = opfapi.get_current_sequence(opfapi.CTX.selection) + # create subset name + subset_name = oplib.get_subset_name_with_asset_doc( + family, + variant, + task_name, + asset_doc, + ) + # adding otio timeline to context with opfapi.maintained_segment_selection(sequence): otio_timeline = flame_export.create_otio_timeline(sequence) instance_data = { - "name": "{}_{}".format(asset, subset), - "asset": asset, - "subset": "{}{}".format(asset, subset.capitalize()), + "name": subset_name, + "asset": asset_doc["name"], + "subset": subset_name, "family": "workfile" }