From 19d2faac7ec6cd0dd793eae68e54563ed7b33c50 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 28 Dec 2021 15:19:24 +0100 Subject: [PATCH 1/8] Fix "Set Frame Range" loaders to retrieve the correct data from the version --- openpype/hosts/houdini/plugins/load/actions.py | 13 ++++++------- openpype/hosts/maya/plugins/load/actions.py | 5 ++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/houdini/plugins/load/actions.py b/openpype/hosts/houdini/plugins/load/actions.py index 6e9410ff58..acdb998c16 100644 --- a/openpype/hosts/houdini/plugins/load/actions.py +++ b/openpype/hosts/houdini/plugins/load/actions.py @@ -29,8 +29,8 @@ class SetFrameRangeLoader(api.Loader): version = context["version"] version_data = version.get("data", {}) - start = version_data.get("startFrame", None) - end = version_data.get("endFrame", None) + start = version_data.get("frameStart", None) + end = version_data.get("frameEnd", None) if start is None or end is None: print( @@ -67,8 +67,8 @@ class SetFrameRangeWithHandlesLoader(api.Loader): version = context["version"] version_data = version.get("data", {}) - start = version_data.get("startFrame", None) - end = version_data.get("endFrame", None) + start = version_data.get("frameStart", None) + end = version_data.get("frameEnd", None) if start is None or end is None: print( @@ -78,9 +78,8 @@ class SetFrameRangeWithHandlesLoader(api.Loader): return # Include handles - handles = version_data.get("handles", 0) - start -= handles - end += handles + start -= version_data.get("handleStart", 0) + end += version_data.get("handleEnd", 0) hou.playbar.setFrameRange(start, end) hou.playbar.setPlaybackRange(start, end) diff --git a/openpype/hosts/maya/plugins/load/actions.py b/openpype/hosts/maya/plugins/load/actions.py index 1a9adf6142..f55aa80b9e 100644 --- a/openpype/hosts/maya/plugins/load/actions.py +++ b/openpype/hosts/maya/plugins/load/actions.py @@ -68,9 +68,8 @@ class SetFrameRangeWithHandlesLoader(api.Loader): return # Include handles - handles = version_data.get("handles", 0) - start -= handles - end += handles + start -= version_data.get("handleStart", 0) + end += version_data.get("handleEnd", 0) cmds.playbackOptions(minTime=start, maxTime=end, From cee20eb256eecb083988c5834c474c845f247396 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 5 Jan 2022 11:25:33 +0100 Subject: [PATCH 2/8] Refactor other references to 'startFrame'/'endFrame' to 'frameStart'/'frameEnd' --- openpype/hosts/fusion/scripts/fusion_switch_shot.py | 2 +- .../plugins/publish/validate_abc_primitive_to_detail.py | 2 +- .../houdini/plugins/publish/validate_alembic_input_node.py | 2 +- .../plugins/publish/submit_houdini_render_deadline.py | 4 ++-- .../deadline/plugins/publish/submit_publish_job.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openpype/hosts/fusion/scripts/fusion_switch_shot.py b/openpype/hosts/fusion/scripts/fusion_switch_shot.py index 05b577c8ba..fd4128d840 100644 --- a/openpype/hosts/fusion/scripts/fusion_switch_shot.py +++ b/openpype/hosts/fusion/scripts/fusion_switch_shot.py @@ -176,7 +176,7 @@ def update_frame_range(comp, representations): versions = list(versions) versions = [v for v in versions - if v["data"].get("startFrame", None) is not None] + if v["data"].get("frameStart", None) is not None] if not versions: log.warning("No versions loaded to match frame range to.\n") diff --git a/openpype/hosts/houdini/plugins/publish/validate_abc_primitive_to_detail.py b/openpype/hosts/houdini/plugins/publish/validate_abc_primitive_to_detail.py index 8fe1b44b7a..3e17d3e8de 100644 --- a/openpype/hosts/houdini/plugins/publish/validate_abc_primitive_to_detail.py +++ b/openpype/hosts/houdini/plugins/publish/validate_abc_primitive_to_detail.py @@ -65,7 +65,7 @@ class ValidateAbcPrimitiveToDetail(pyblish.api.InstancePlugin): cls.log.debug("Checking with path attribute: %s" % path_attr) # Check if the primitive attribute exists - frame = instance.data.get("startFrame", 0) + frame = instance.data.get("frameStart", 0) geo = output.geometryAtFrame(frame) # If there are no primitives on the start frame then it might be diff --git a/openpype/hosts/houdini/plugins/publish/validate_alembic_input_node.py b/openpype/hosts/houdini/plugins/publish/validate_alembic_input_node.py index 17c9da837a..8d7e3b611f 100644 --- a/openpype/hosts/houdini/plugins/publish/validate_alembic_input_node.py +++ b/openpype/hosts/houdini/plugins/publish/validate_alembic_input_node.py @@ -38,7 +38,7 @@ class ValidateAlembicInputNode(pyblish.api.InstancePlugin): cls.log.warning("No geometry output node found, skipping check..") return - frame = instance.data.get("startFrame", 0) + frame = instance.data.get("frameStart", 0) geo = node.geometryAtFrame(frame) invalid = False diff --git a/openpype/modules/default_modules/deadline/plugins/publish/submit_houdini_render_deadline.py b/openpype/modules/default_modules/deadline/plugins/publish/submit_houdini_render_deadline.py index fa146c0d30..ace2aabb85 100644 --- a/openpype/modules/default_modules/deadline/plugins/publish/submit_houdini_render_deadline.py +++ b/openpype/modules/default_modules/deadline/plugins/publish/submit_houdini_render_deadline.py @@ -50,8 +50,8 @@ class HoudiniSubmitRenderDeadline(pyblish.api.InstancePlugin): # StartFrame to EndFrame by byFrameStep frames = "{start}-{end}x{step}".format( - start=int(instance.data["startFrame"]), - end=int(instance.data["endFrame"]), + start=int(instance.data["frameStart"]), + end=int(instance.data["frameEnd"]), step=int(instance.data["byFrameStep"]), ) diff --git a/openpype/modules/default_modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/default_modules/deadline/plugins/publish/submit_publish_job.py index 516bd755d0..a5ccbe9cf9 100644 --- a/openpype/modules/default_modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/default_modules/deadline/plugins/publish/submit_publish_job.py @@ -311,8 +311,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): import speedcopy self.log.info("Preparing to copy ...") - start = instance.data.get("startFrame") - end = instance.data.get("endFrame") + start = instance.data.get("frameStart") + end = instance.data.get("frameEnd") # get latest version of subset # this will stop if subset wasn't published yet From 7621f02a47995ead84a102793c9584a2b45f21dc Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 5 Jan 2022 12:35:25 +0100 Subject: [PATCH 3/8] Refactor "startFrame" -> "frameStart" --- .../plugins/publish/validate_primitive_hierarchy_paths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/plugins/publish/validate_primitive_hierarchy_paths.py b/openpype/hosts/houdini/plugins/publish/validate_primitive_hierarchy_paths.py index 3c15532be8..1eb36763bb 100644 --- a/openpype/hosts/houdini/plugins/publish/validate_primitive_hierarchy_paths.py +++ b/openpype/hosts/houdini/plugins/publish/validate_primitive_hierarchy_paths.py @@ -51,7 +51,7 @@ class ValidatePrimitiveHierarchyPaths(pyblish.api.InstancePlugin): cls.log.debug("Checking for attribute: %s" % path_attr) # Check if the primitive attribute exists - frame = instance.data.get("startFrame", 0) + frame = instance.data.get("frameStart", 0) geo = output.geometryAtFrame(frame) # If there are no primitives on the current frame then we can't From 7bf02646bc6896ff96a3c07ffff737d269924266 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 5 Jan 2022 13:38:19 +0100 Subject: [PATCH 4/8] Maya: Refactor `handles` to correctly extract handles with the frame range in export using `handleStart` and `handleEnd` as input --- openpype/hosts/maya/api/lib.py | 3 ++- .../maya/plugins/publish/extract_animation.py | 8 ++------ .../hosts/maya/plugins/publish/extract_ass.py | 8 ++------ .../plugins/publish/extract_camera_alembic.py | 19 ++++--------------- .../publish/extract_camera_mayaScene.py | 18 ++++-------------- .../hosts/maya/plugins/publish/extract_fbx.py | 8 ++------ .../maya/plugins/publish/extract_vrayproxy.py | 13 +++++++++---- .../plugins/publish/extract_yeti_cache.py | 4 ++-- 8 files changed, 27 insertions(+), 54 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 52ebcaff64..d003203959 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -297,7 +297,8 @@ def collect_animation_data(): data = OrderedDict() data["frameStart"] = start data["frameEnd"] = end - data["handles"] = 0 + data["handleStart"] = 0 + data["handleEnd"] = 0 data["step"] = 1.0 data["fps"] = fps diff --git a/openpype/hosts/maya/plugins/publish/extract_animation.py b/openpype/hosts/maya/plugins/publish/extract_animation.py index 7ecc40a68d..e0ed4411a8 100644 --- a/openpype/hosts/maya/plugins/publish/extract_animation.py +++ b/openpype/hosts/maya/plugins/publish/extract_animation.py @@ -35,12 +35,8 @@ class ExtractAnimation(openpype.api.Extractor): fullPath=True) or [] # Collect the start and end including handles - start = instance.data["frameStart"] - end = instance.data["frameEnd"] - handles = instance.data.get("handles", 0) or 0 - if handles: - start -= handles - end += handles + start = instance.data["frameStartHandle"] + end = instance.data["frameEndHandle"] self.log.info("Extracting animation..") dirname = self.staging_dir(instance) diff --git a/openpype/hosts/maya/plugins/publish/extract_ass.py b/openpype/hosts/maya/plugins/publish/extract_ass.py index 7461ccdf78..9025709178 100644 --- a/openpype/hosts/maya/plugins/publish/extract_ass.py +++ b/openpype/hosts/maya/plugins/publish/extract_ass.py @@ -38,13 +38,9 @@ class ExtractAssStandin(openpype.api.Extractor): self.log.info("Extracting ass sequence") # Collect the start and end including handles - start = instance.data.get("frameStart", 1) - end = instance.data.get("frameEnd", 1) - handles = instance.data.get("handles", 0) + start = instance.data.get("frameStartHandle", 1) + end = instance.data.get("frameEndHandle", 1) step = instance.data.get("step", 0) - if handles: - start -= handles - end += handles exported_files = cmds.arnoldExportAss(filename=file_path, selected=True, diff --git a/openpype/hosts/maya/plugins/publish/extract_camera_alembic.py b/openpype/hosts/maya/plugins/publish/extract_camera_alembic.py index 8950ed6254..b6f1826098 100644 --- a/openpype/hosts/maya/plugins/publish/extract_camera_alembic.py +++ b/openpype/hosts/maya/plugins/publish/extract_camera_alembic.py @@ -23,17 +23,9 @@ class ExtractCameraAlembic(openpype.api.Extractor): def process(self, instance): - # get settings - framerange = [instance.data.get("frameStart", 1), - instance.data.get("frameEnd", 1)] - handle_start = instance.data.get("handleStart", 0) - handle_end = instance.data.get("handleEnd", 0) - - # TODO: deprecated attribute "handles" - - if handle_start is None: - handle_start = instance.data.get("handles", 0) - handle_end = instance.data.get("handles", 0) + # Collect the start and end including handles + start = instance.data["frameStartHandle"] + end = instance.data["frameEndHandle"] step = instance.data.get("step", 1.0) bake_to_worldspace = instance.data("bakeToWorldSpace", True) @@ -63,10 +55,7 @@ class ExtractCameraAlembic(openpype.api.Extractor): job_str = ' -selection -dataFormat "ogawa" ' job_str += ' -attrPrefix cb' - job_str += ' -frameRange {0} {1} '.format(framerange[0] - - handle_start, - framerange[1] - + handle_end) + job_str += ' -frameRange {0} {1} '.format(start, end) job_str += ' -step {0} '.format(step) if bake_to_worldspace: diff --git a/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py b/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py index 888dc636b2..bac00dc711 100644 --- a/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py +++ b/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py @@ -118,19 +118,9 @@ class ExtractCameraMayaScene(openpype.api.Extractor): # no preset found pass - framerange = [instance.data.get("frameStart", 1), - instance.data.get("frameEnd", 1)] - handle_start = instance.data.get("handleStart", 0) - handle_end = instance.data.get("handleEnd", 0) - - # TODO: deprecated attribute "handles" - - if handle_start is None: - handle_start = instance.data.get("handles", 0) - handle_end = instance.data.get("handles", 0) - - range_with_handles = [framerange[0] - handle_start, - framerange[1] + handle_end] + # Collect the start and end including handles + start = instance.data["frameStartHandle"] + end = instance.data["frameEndHandle"] step = instance.data.get("step", 1.0) bake_to_worldspace = instance.data("bakeToWorldSpace", True) @@ -165,7 +155,7 @@ class ExtractCameraMayaScene(openpype.api.Extractor): "Performing camera bakes: {}".format(transform)) baked = lib.bake_to_world_space( transform, - frame_range=range_with_handles, + frame_range=[start, end], step=step ) baked_shapes = cmds.ls(baked, diff --git a/openpype/hosts/maya/plugins/publish/extract_fbx.py b/openpype/hosts/maya/plugins/publish/extract_fbx.py index 720a61b0a7..4a92e31ccb 100644 --- a/openpype/hosts/maya/plugins/publish/extract_fbx.py +++ b/openpype/hosts/maya/plugins/publish/extract_fbx.py @@ -166,12 +166,8 @@ class ExtractFBX(openpype.api.Extractor): self.log.info("Export options: {0}".format(options)) # Collect the start and end including handles - start = instance.data["frameStart"] - end = instance.data["frameEnd"] - handles = instance.data.get("handles", 0) - if handles: - start -= handles - end += handles + start = instance.data["frameStartHandle"] + end = instance.data["frameEndHandle"] options['bakeComplexStart'] = start options['bakeComplexEnd'] = end diff --git a/openpype/hosts/maya/plugins/publish/extract_vrayproxy.py b/openpype/hosts/maya/plugins/publish/extract_vrayproxy.py index 7103601b85..8bfbbd525d 100644 --- a/openpype/hosts/maya/plugins/publish/extract_vrayproxy.py +++ b/openpype/hosts/maya/plugins/publish/extract_vrayproxy.py @@ -28,14 +28,19 @@ class ExtractVRayProxy(openpype.api.Extractor): if not anim_on: # Remove animation information because it is not required for # non-animated subsets - instance.data.pop("frameStart", None) - instance.data.pop("frameEnd", None) + keys = ["frameStart", "frameEnd", + "handleStart", "handleEnd", + "frameStartHandle", "frameEndHandle", + # Backwards compatibility + "handles"] + for key in keys: + instance.data.pop(key, None) start_frame = 1 end_frame = 1 else: - start_frame = instance.data["frameStart"] - end_frame = instance.data["frameEnd"] + start_frame = instance.data["frameStartHandle"] + end_frame = instance.data["frameEndHandle"] vertex_colors = instance.data.get("vertexColors", False) diff --git a/openpype/hosts/maya/plugins/publish/extract_yeti_cache.py b/openpype/hosts/maya/plugins/publish/extract_yeti_cache.py index 05fe79ecc5..0d85708789 100644 --- a/openpype/hosts/maya/plugins/publish/extract_yeti_cache.py +++ b/openpype/hosts/maya/plugins/publish/extract_yeti_cache.py @@ -29,8 +29,8 @@ class ExtractYetiCache(openpype.api.Extractor): data_file = os.path.join(dirname, "yeti.fursettings") # Collect information for writing cache - start_frame = instance.data.get("frameStart") - end_frame = instance.data.get("frameEnd") + start_frame = instance.data.get("frameStartHandle") + end_frame = instance.data.get("frameEndHandle") preroll = instance.data.get("preroll") if preroll > 0: start_frame -= preroll From e00e26d3eb41652859a825b93f72e2b31aa0b154 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 5 Jan 2022 14:46:06 +0100 Subject: [PATCH 5/8] Refactor 'handles' to 'handleStart' & 'handleEnd' with backwards compatibility --- .../modules/ftrack_lib.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py index 26b197ee1d..7a0efe079e 100644 --- a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py +++ b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py @@ -138,12 +138,24 @@ class FtrackComponentCreator: if name == "ftrackreview-mp4": duration = data["duration"] - handles = data["handles"] + + handle_start = data.get("handleStart", None) + handle_end = data.get("handleEnd", None) + if handle_start is not None: + duration += handle_start + if handle_end is not None: + duration += handle_end + if handle_start is None and handle_end is None: + # Backwards compatibility; old style 'handles' + # We multiply by two because old-style handles defined + # both the handle start and handle end + duration += data.get("handles", 0) * 2 + fps = data["fps"] component_data["metadata"] = { 'ftr_meta': json.dumps({ 'frameIn': int(0), - 'frameOut': int(duration + (handles * 2)), + 'frameOut': int(duration), 'frameRate': float(fps) }) } From d72183e0a0b3936cc87d4dd5cb36e346feb82f58 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 25 Feb 2022 20:09:00 +0100 Subject: [PATCH 6/8] Update openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../openpype_flame_to_ftrack/modules/ftrack_lib.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py index 7a0efe079e..6256265730 100644 --- a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py +++ b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py @@ -139,17 +139,7 @@ class FtrackComponentCreator: if name == "ftrackreview-mp4": duration = data["duration"] - handle_start = data.get("handleStart", None) - handle_end = data.get("handleEnd", None) - if handle_start is not None: - duration += handle_start - if handle_end is not None: - duration += handle_end - if handle_start is None and handle_end is None: - # Backwards compatibility; old style 'handles' - # We multiply by two because old-style handles defined - # both the handle start and handle end - duration += data.get("handles", 0) * 2 + handles = data["handles"] fps = data["fps"] component_data["metadata"] = { From d32f2f946f540a265070b7af12bb1fd32db07d86 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 25 Feb 2022 20:09:05 +0100 Subject: [PATCH 7/8] Update openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../openpype_flame_to_ftrack/modules/ftrack_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py index 6256265730..7e2ef381a3 100644 --- a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py +++ b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py @@ -145,7 +145,7 @@ class FtrackComponentCreator: component_data["metadata"] = { 'ftr_meta': json.dumps({ 'frameIn': int(0), - 'frameOut': int(duration), + 'frameOut': int(duration + (handles * 2)), 'frameRate': float(fps) }) } From 2501c47ca7e396f8d725b2e0edebf504c9e7d7fa Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Sat, 26 Feb 2022 10:00:30 +0100 Subject: [PATCH 8/8] remove modifications in flame file --- .../openpype_flame_to_ftrack/modules/ftrack_lib.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py index 7e2ef381a3..26b197ee1d 100644 --- a/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py +++ b/openpype/hosts/flame/api/utility_scripts/openpype_flame_to_ftrack/modules/ftrack_lib.py @@ -138,9 +138,7 @@ class FtrackComponentCreator: if name == "ftrackreview-mp4": duration = data["duration"] - handles = data["handles"] - fps = data["fps"] component_data["metadata"] = { 'ftr_meta': json.dumps({