diff --git a/openpype/hosts/fusion/api/lib.py b/openpype/hosts/fusion/api/lib.py index 8f7b29f0c4..40cc4d2963 100644 --- a/openpype/hosts/fusion/api/lib.py +++ b/openpype/hosts/fusion/api/lib.py @@ -51,12 +51,6 @@ def update_frame_range(start, end, comp=None, set_render_range=True, "COMPN_GlobalStart": start - handle_start, "COMPN_GlobalEnd": end + handle_end } - frame_data = { - "frameStart": start, - "frameEnd": end, - "handleStart": handle_start, - "handleEnd": handle_end - } # set frame range if set_render_range: @@ -67,7 +61,6 @@ def update_frame_range(start, end, comp=None, set_render_range=True, with comp_lock_and_undo_chunk(comp): comp.SetAttrs(attrs) - comp.SetData("openpype_instance", frame_data) def set_asset_framerange(): diff --git a/openpype/hosts/fusion/plugins/create/create_saver.py b/openpype/hosts/fusion/plugins/create/create_saver.py index ecdad30b4c..58ffbe928a 100644 --- a/openpype/hosts/fusion/plugins/create/create_saver.py +++ b/openpype/hosts/fusion/plugins/create/create_saver.py @@ -223,6 +223,9 @@ class CreateSaver(NewCreator): attr_defs = [ self._get_render_target_enum(), self._get_reviewable_bool(), + BoolDef( + "custom_range", label="Custom range", default=False, + ) ] return attr_defs diff --git a/openpype/hosts/fusion/plugins/publish/collect_comp_frame_range.py b/openpype/hosts/fusion/plugins/publish/collect_comp_frame_range.py index 2db0002ee6..38d6577667 100644 --- a/openpype/hosts/fusion/plugins/publish/collect_comp_frame_range.py +++ b/openpype/hosts/fusion/plugins/publish/collect_comp_frame_range.py @@ -9,20 +9,14 @@ def get_comp_render_range(comp): global_start = comp_attrs["COMPN_GlobalStart"] global_end = comp_attrs["COMPN_GlobalEnd"] - frame_data = comp.GetData("openpype_instance") - handle_start = frame_data.get("handleStart", 0) - handle_end = frame_data.get("handleEnd", 0) - frame_start = frame_data.get("frameStart", 0) - frame_end = frame_data.get("frameEnd", 0) - # Whenever render ranges are undefined fall back # to the comp's global start and end if start == -1000000000: - start = frame_start + start = global_start if end == -1000000000: - end = frame_end + end = global_end - return start, end, global_start, global_end, handle_start, handle_end + return start, end, global_start, global_end class CollectFusionCompFrameRanges(pyblish.api.ContextPlugin): @@ -44,18 +38,12 @@ class CollectFusionCompFrameRanges(pyblish.api.ContextPlugin): start, end, global_start, global_end, - handle_start, - handle_end ) = get_comp_render_range(comp) data = {} - data["frameStart"] = int(start) - data["frameEnd"] = int(end) - data["frameStartHandle"] = int(global_start) - data["frameEndHandle"] = int(global_end) - data["handleStart"] = int(handle_start) - data["handleEnd"] = int(handle_end) - - self.log.debug("_ data: {}".format(data)) + data["compFrameStart"] = int(start) + data["compFrameEnd"] = int(end) + data["compFrameStartHandle"] = int(global_start) + data["compFrameEndHandle"] = int(global_end) context.data.update(data) diff --git a/openpype/hosts/fusion/plugins/publish/collect_instances.py b/openpype/hosts/fusion/plugins/publish/collect_instances.py index 4608f79420..9c27e3f027 100644 --- a/openpype/hosts/fusion/plugins/publish/collect_instances.py +++ b/openpype/hosts/fusion/plugins/publish/collect_instances.py @@ -1,4 +1,6 @@ +from math import e import os +from turtle import st import pyblish.api @@ -24,6 +26,23 @@ class CollectInstanceData(pyblish.api.InstancePlugin): creator_attributes = instance.data["creator_attributes"] instance.data.update(creator_attributes) + # get asset frame ranges + start = context.data["frameStart"] + end = context.data["frameEnd"] + handle_start = context.data["handleStart"] + handle_end = context.data["handleEnd"] + start_handle = start - handle_start + end_handle = end + handle_end + + if creator_attributes["custom_range"]: + # get comp frame ranges + start = context.data["compFrameStart"] + end = context.data["compFrameEnd"] + handle_start = 0 + handle_end = 0 + start_handle = context.data["compFrameStartHandle"] + end_handle = context.data["compFrameEndHandle"] + # Include start and end render frame in label subset = instance.data["subset"] start = context.data["frameStart"] @@ -31,16 +50,17 @@ class CollectInstanceData(pyblish.api.InstancePlugin): label = "{subset} ({start}-{end})".format(subset=subset, start=int(start), end=int(end)) + instance.data.update({ "label": label, # todo: Allow custom frame range per instance - "frameStart": context.data["frameStart"], - "frameEnd": context.data["frameEnd"], - "frameStartHandle": context.data["frameStartHandle"], - "frameEndHandle": context.data["frameStartHandle"], - "handleStart": context.data["handleStart"], - "handleEnd": context.data["handleEnd"], + "frameStart": start, + "frameEnd": end, + "frameStartHandle": start_handle, + "frameEndHandle": end_handle, + "handleStart": handle_start, + "handleEnd": handle_end, "fps": context.data["fps"], })