From fcc26cd9f7d36d823e42656fa6f2a9952c8efdf3 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 21:47:05 +0100 Subject: [PATCH 1/9] add all frame data to context and fix order --- .../global/publish/collect_avalon_entities.py | 11 ++++++++++- .../global/publish/collect_rendered_files.py | 2 +- pype/plugins/maya/publish/collect_scene.py | 14 ++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pype/plugins/global/publish/collect_avalon_entities.py b/pype/plugins/global/publish/collect_avalon_entities.py index 103f5abd1a..53f11aa693 100644 --- a/pype/plugins/global/publish/collect_avalon_entities.py +++ b/pype/plugins/global/publish/collect_avalon_entities.py @@ -15,7 +15,7 @@ import pyblish.api class CollectAvalonEntities(pyblish.api.ContextPlugin): """Collect Anatomy into Context""" - order = pyblish.api.CollectorOrder + order = pyblish.api.CollectorOrder - 0.02 label = "Collect Avalon Entities" def process(self, context): @@ -47,7 +47,16 @@ class CollectAvalonEntities(pyblish.api.ContextPlugin): context.data["assetEntity"] = asset_entity data = asset_entity['data'] + + context.data["frameStart"] = data.get("frameStart") + context.data["frameEnd"] = data.get("frameEnd") + handles = int(data.get("handles") or 0) context.data["handles"] = handles context.data["handleStart"] = int(data.get("handleStart", handles)) context.data["handleEnd"] = int(data.get("handleEnd", handles)) + + frame_start_h = data.get("frameStart") - context.data["handleStart"] + frame_end_h = data.get("frameEnd") + context.data["handleEnd"] + context.data["frameStartHandle"] = frame_start_h + context.data["frameEndHandle"] = frame_end_h diff --git a/pype/plugins/global/publish/collect_rendered_files.py b/pype/plugins/global/publish/collect_rendered_files.py index 552fd49f6d..8ecf7ba156 100644 --- a/pype/plugins/global/publish/collect_rendered_files.py +++ b/pype/plugins/global/publish/collect_rendered_files.py @@ -13,7 +13,7 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin): `PYPE_PUBLISH_DATA`. Those files _MUST_ share same context. """ - order = pyblish.api.CollectorOrder - 0.0001 + order = pyblish.api.CollectorOrder - 0.1 targets = ["filesequence"] label = "Collect rendered frames" diff --git a/pype/plugins/maya/publish/collect_scene.py b/pype/plugins/maya/publish/collect_scene.py index 089019f2d3..e6976356e8 100644 --- a/pype/plugins/maya/publish/collect_scene.py +++ b/pype/plugins/maya/publish/collect_scene.py @@ -9,13 +9,14 @@ from pype.maya import lib class CollectMayaScene(pyblish.api.ContextPlugin): """Inject the current working file into context""" - order = pyblish.api.CollectorOrder - 0.1 + order = pyblish.api.CollectorOrder - 0.01 label = "Maya Workfile" hosts = ['maya'] def process(self, context): """Inject the current working file""" - current_file = context.data['currentFile'] + current_file = cmds.file(query=True, sceneName=True) + context.data['currentFile'] = current_file folder, file = os.path.split(current_file) filename, ext = os.path.splitext(file) @@ -24,9 +25,6 @@ class CollectMayaScene(pyblish.api.ContextPlugin): data = {} - for key, value in lib.collect_animation_data().items(): - data[key] = value - # create instance instance = context.create_instance(name=filename) subset = 'workfile' + task.capitalize() @@ -38,7 +36,11 @@ class CollectMayaScene(pyblish.api.ContextPlugin): "publish": True, "family": 'workfile', "families": ['workfile'], - "setMembers": [current_file] + "setMembers": [current_file], + "frameStart": context.data['frameStart'], + "frameEnd": context.data['frameEnd'], + "handleStart": context.data['handleStart'], + "handleEnd": context.data['handleEnd'] }) data['representations'] = [{ From 4778dbd3e6aa48d11c653f429e87018bdd55d1e4 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 21:47:37 +0100 Subject: [PATCH 2/9] remove handles from custom pointcache range --- pype/plugins/maya/publish/extract_pointcache.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pype/plugins/maya/publish/extract_pointcache.py b/pype/plugins/maya/publish/extract_pointcache.py index cec4886712..e40ab6e7da 100644 --- a/pype/plugins/maya/publish/extract_pointcache.py +++ b/pype/plugins/maya/publish/extract_pointcache.py @@ -25,12 +25,8 @@ class ExtractAlembic(pype.api.Extractor): nodes = instance[:] # 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) - if handles: - start -= handles - end += handles + start = float(instance.data.get("frameStartHandle", 1)) + end = float(instance.data.get("frameEndHandle", 1)) attrs = instance.data.get("attr", "").split(";") attrs = [value for value in attrs if value.strip()] From b329fde9835df94a56def669c2bb60ceb913f473 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 21:48:14 +0100 Subject: [PATCH 3/9] use custom frame range if other than asset --- .../plugins/maya/publish/collect_instances.py | 44 ++++++++++++++++--- pype/plugins/maya/publish/collect_render.py | 41 ++++++++++++----- 2 files changed, 68 insertions(+), 17 deletions(-) diff --git a/pype/plugins/maya/publish/collect_instances.py b/pype/plugins/maya/publish/collect_instances.py index 5af717ba4d..9ea3ebe7fa 100644 --- a/pype/plugins/maya/publish/collect_instances.py +++ b/pype/plugins/maya/publish/collect_instances.py @@ -1,6 +1,7 @@ from maya import cmds import pyblish.api +import json class CollectInstances(pyblish.api.ContextPlugin): @@ -32,6 +33,13 @@ class CollectInstances(pyblish.api.ContextPlugin): objectset = cmds.ls("*.id", long=True, type="objectSet", recursive=True, objectsOnly=True) + ctx_frame_start = context.data['frameStart'] + ctx_frame_end = context.data['frameEnd'] + ctx_handle_start = context.data['handleStart'] + ctx_handle_end = context.data['handleEnd'] + ctx_frame_start_handle = context.data['frameStartHandle'] + ctx_frame_end_handle = context.data['frameEndHandle'] + context.data['objectsets'] = objectset for objset in objectset: @@ -108,14 +116,36 @@ class CollectInstances(pyblish.api.ContextPlugin): label = "{0} ({1})".format(name, data["asset"]) - if "handles" in data: - data["handleStart"] = data["handles"] - data["handleEnd"] = data["handles"] - # Append start frame and end frame to label if present if "frameStart" and "frameEnd" in data: - data["frameStartHandle"] = data["frameStart"] - data["handleStart"] - data["frameEndHandle"] = data["frameEnd"] + data["handleEnd"] + + # if frame range on maya set is the same as full shot range + # adjust the values to match the asset data + if (ctx_frame_start_handle == data["frameStart"] + and ctx_frame_end_handle == data["frameEnd"]): + data["frameStartHandle"] = ctx_frame_start_handle + data["frameEndHandle"] = ctx_frame_end_handle + data["frameStart"] = ctx_frame_start + data["frameEnd"] = ctx_frame_end + data["handleStart"] = ctx_handle_start + data["handleEnd"] = ctx_handle_end + + # if there are user values on start and end frame not matching + # the asset, use them + + else: + if "handles" in data: + data["handleStart"] = data["handles"] + data["handleEnd"] = data["handles"] + else: + data["handleStart"] = 0 + data["handleEnd"] = 0 + + data["frameStartHandle"] = data["frameStart"] - data["handleStart"] + data["frameEndHandle"] = data["frameEnd"] + data["handleEnd"] + + if "handles" in data: + data.pop('handles') label += " [{0}-{1}]".format(int(data["frameStartHandle"]), int(data["frameEndHandle"])) @@ -127,7 +157,7 @@ class CollectInstances(pyblish.api.ContextPlugin): # Produce diagnostic message for any graphical # user interface interested in visualising it. self.log.info("Found: \"%s\" " % instance.data["name"]) - self.log.debug("DATA: \"%s\" " % instance.data) + self.log.debug("DATA: {} ".format(json.dumps(instance.data, indent=4))) def sort_by_family(instance): """Sort by family""" diff --git a/pype/plugins/maya/publish/collect_render.py b/pype/plugins/maya/publish/collect_render.py index be3878e6bd..88c1be477d 100644 --- a/pype/plugins/maya/publish/collect_render.py +++ b/pype/plugins/maya/publish/collect_render.py @@ -41,6 +41,7 @@ import re import os import types import six +import json from abc import ABCMeta, abstractmethod from maya import cmds @@ -202,6 +203,28 @@ class CollectMayaRender(pyblish.api.ContextPlugin): full_paths.append(full_path) aov_dict["beauty"] = full_paths + frame_start_render = int(self.get_render_attribute("startFrame", + layer=layer_name)) + frame_end_render = int(self.get_render_attribute("endFrame", + layer=layer_name)) + + if (int(context.data['frameStartHandle']) == frame_start_render and + int(context.data['frameEndHandle']) == frame_end_render): + + handle_start = context.data['handleStart'] + handle_end = context.data['handleEnd'] + frame_start = context.data['frameStart'] + frame_end = context.data['frameEnd'] + frame_start_handle = context.data['frameStartHandle'] + frame_end_handle = context.data['frameEndHandle'] + else: + handle_start = 0 + handle_end = 0 + frame_start = frame_start_render + frame_end = frame_end_render + frame_start_handle = frame_start_render + frame_end_handle = frame_end_render + full_exp_files.append(aov_dict) self.log.info(full_exp_files) self.log.info("collecting layer: {}".format(layer_name)) @@ -211,20 +234,18 @@ class CollectMayaRender(pyblish.api.ContextPlugin): "attachTo": attachTo, "setMembers": layer_name, "publish": True, - "frameStart": int(context.data["assetEntity"]['data']['frameStart']), - "frameEnd": int(context.data["assetEntity"]['data']['frameEnd']), - "frameStartHandle": int(self.get_render_attribute("startFrame", - layer=layer_name)), - "frameEndHandle": int(self.get_render_attribute("endFrame", - layer=layer_name)), + + "handleStart": handle_start, + "handleEnd": handle_end, + "frameStart": frame_start, + "frameEnd": frame_end, + "frameStartHandle": frame_start_handle, + "frameEndHandle": frame_end_handle, "byFrameStep": int( self.get_render_attribute("byFrameStep", layer=layer_name)), "renderer": self.get_render_attribute("currentRenderer", layer=layer_name), - "handleStart": int(context.data["assetEntity"]['data']['handleStart']), - "handleEnd": int(context.data["assetEntity"]['data']['handleEnd']), - # instance subset "family": "renderlayer", "families": ["renderlayer"], @@ -267,7 +288,7 @@ class CollectMayaRender(pyblish.api.ContextPlugin): instance = context.create_instance(expected_layer_name) instance.data["label"] = label instance.data.update(data) - pass + self.log.debug("data: {}".format(json.dumps(data, indent=4))) def parse_options(self, render_globals): """Get all overrides with a value, skip those without From 5649b112f1772e6acf8544829b380e48aca29268 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 21:48:34 +0100 Subject: [PATCH 4/9] remove unnecessary current scene collector --- .../plugins/maya/publish/collect_current_file.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 pype/plugins/maya/publish/collect_current_file.py diff --git a/pype/plugins/maya/publish/collect_current_file.py b/pype/plugins/maya/publish/collect_current_file.py deleted file mode 100644 index 0b38ebcf3d..0000000000 --- a/pype/plugins/maya/publish/collect_current_file.py +++ /dev/null @@ -1,16 +0,0 @@ -from maya import cmds - -import pyblish.api - - -class CollectMayaCurrentFile(pyblish.api.ContextPlugin): - """Inject the current working file into context""" - - order = pyblish.api.CollectorOrder - 0.5 - label = "Maya Current File" - hosts = ['maya'] - - def process(self, context): - """Inject the current working file""" - current_file = cmds.file(query=True, sceneName=True) - context.data['currentFile'] = current_file From e5fd3d3b5df0f2717d5a566264940ddabcaf8ad9 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Sat, 21 Mar 2020 19:13:53 +0100 Subject: [PATCH 5/9] frame range validator remake --- .../maya/publish/validate_frame_range.py | 158 +++++++++++++++--- 1 file changed, 135 insertions(+), 23 deletions(-) diff --git a/pype/plugins/maya/publish/validate_frame_range.py b/pype/plugins/maya/publish/validate_frame_range.py index d4aad812d5..26235b37ae 100644 --- a/pype/plugins/maya/publish/validate_frame_range.py +++ b/pype/plugins/maya/publish/validate_frame_range.py @@ -1,18 +1,18 @@ import pyblish.api import pype.api +from maya import cmds + class ValidateFrameRange(pyblish.api.InstancePlugin): """Valides the frame ranges. - Checks the `startFrame`, `endFrame` and `handles` data. - This does NOT ensure there's actual data present. + This is optional validator checking if the frame range matches the one of + asset. - This validates: - - `startFrame` is lower than or equal to the `endFrame`. - - must have both the `startFrame` and `endFrame` data. - - The `handles` value is not lower than zero. + Repair action will change everything to match asset. + This can be turned off by artist to allow custom ranges. """ label = "Validate Frame Range" @@ -20,26 +20,138 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): families = ["animation", "pointcache", "camera", - "renderlayer", - "colorbleed.vrayproxy"] + "render", + "review", + "yeticache"] + optional = True + actions = [pype.api.RepairAction] def process(self, instance): + context = instance.context - start = instance.data.get("frameStart", None) - end = instance.data.get("frameEnd", None) - handles = instance.data.get("handles", None) + frame_start_handle = int(context.data.get("frameStartHandle")) + frame_end_handle = int(context.data.get("frameEndHandle")) + handles = int(context.data.get("handles")) + handle_start = int(context.data.get("handleStart")) + handle_end = int(context.data.get("handleEnd")) + frame_start = int(context.data.get("frameStart")) + frame_end = int(context.data.get("frameEnd")) - # Check if any of the values are present - if any(value is None for value in [start, end]): - raise ValueError("No time values for this instance. " - "(Missing `startFrame` or `endFrame`)") + inst_start = int(instance.data.get("frameStartHandle")) + inst_end = int(instance.data.get("frameEndHandle")) - self.log.info("Comparing start (%s) and end (%s)" % (start, end)) - if start > end: - raise RuntimeError("The start frame is a higher value " - "than the end frame: " - "{0}>{1}".format(start, end)) + # basic sanity checks + assert frame_start_handle <= frame_end_handle, ( + "start frame is lower then end frame") - if handles is not None: - if handles < 0.0: - raise RuntimeError("Handles are set to a negative value") + assert handles >= 0, ("handles cannot have negative values") + + # compare with data on instance + errors = [] + + if(inst_start != frame_start_handle): + errors.append("Instance start frame [ {} ] doesn't " + "match the one set on instance [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + inst_start, + frame_start_handle, + handle_start, frame_start, frame_end, handle_end + )) + + if(inst_end != frame_end_handle): + errors.append("Instance end frame [ {} ] doesn't " + "match the one set on instance [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + inst_end, + frame_end_handle, + handle_start, frame_start, frame_end, handle_end + )) + + minTime = int(cmds.playbackOptions(minTime=True, query=True)) + maxTime = int(cmds.playbackOptions(maxTime=True, query=True)) + animStartTime = int(cmds.playbackOptions(animationStartTime=True, + query=True)) + animEndTime = int(cmds.playbackOptions(animationEndTime=True, + query=True)) + + if int(minTime) != inst_start: + errors.append("Start of Maya timeline is set to frame [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + minTime, + frame_start_handle, + handle_start, frame_start, frame_end, handle_end + )) + + if int(maxTime) != inst_end: + errors.append("End of Maya timeline is set to frame [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + maxTime, + frame_end_handle, + handle_start, frame_start, frame_end, handle_end + )) + + if int(animStartTime) != inst_start: + errors.append("Animation start in Maya is set to frame [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + animStartTime, + frame_start_handle, + handle_start, frame_start, frame_end, handle_end + )) + + if int(animEndTime) != inst_end: + errors.append("Animation start in Maya is set to frame [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + animEndTime, + frame_end_handle, + handle_start, frame_start, frame_end, handle_end + )) + + render_start = int(cmds.getAttr("defaultRenderGlobals.startFrame")) + render_end = int(cmds.getAttr("defaultRenderGlobals.endFrame")) + + if int(render_start) != inst_start: + errors.append("Render settings start frame is set to [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + int(render_start), + frame_start_handle, + handle_start, frame_start, frame_end, handle_end + )) + + if int(render_end) != inst_end: + errors.append("Render settings end frame is set to [ {} ] " + " and doesn't match the one set on asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + int(render_end), + frame_end_handle, + handle_start, frame_start, frame_end, handle_end + )) + + for e in errors: + self.log.error(e) + + assert len(errors) == 0, ("Frame range settings are incorrect") + + @classmethod + def repair(cls, instance): + """ + Repair by calling avalon reset frame range function. This will set + timeline frame range, render settings range and frame information + on instance container to match asset data. + """ + import avalon.maya.interactive + avalon.maya.interactive.reset_frame_range() + cls.log.debug("-" * 80) + cls.log.debug("{}.frameStart".format(instance.data["name"])) + cmds.setAttr( + "{}.frameStart".format(instance.data["name"]), + instance.context.data.get("frameStartHandle")) + + cmds.setAttr( + "{}.frameEnd".format(instance.data["name"]), + instance.context.data.get("frameEndHandle")) + cls.log.debug("-" * 80) From 8d32d77668ebb7b535f5b660d72bfec367788d30 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Sat, 21 Mar 2020 21:00:39 +0100 Subject: [PATCH 6/9] remove debug prints --- pype/plugins/maya/publish/validate_frame_range.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pype/plugins/maya/publish/validate_frame_range.py b/pype/plugins/maya/publish/validate_frame_range.py index 26235b37ae..0be77644a0 100644 --- a/pype/plugins/maya/publish/validate_frame_range.py +++ b/pype/plugins/maya/publish/validate_frame_range.py @@ -145,8 +145,6 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): """ import avalon.maya.interactive avalon.maya.interactive.reset_frame_range() - cls.log.debug("-" * 80) - cls.log.debug("{}.frameStart".format(instance.data["name"])) cmds.setAttr( "{}.frameStart".format(instance.data["name"]), instance.context.data.get("frameStartHandle")) @@ -154,4 +152,3 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): cmds.setAttr( "{}.frameEnd".format(instance.data["name"]), instance.context.data.get("frameEndHandle")) - cls.log.debug("-" * 80) From 0e991c4fb572ebfb3a54c8d9e8b882f8377fdba1 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Sat, 21 Mar 2020 23:21:41 +0100 Subject: [PATCH 7/9] shutting up hound --- .../plugins/maya/publish/collect_instances.py | 9 ++++---- pype/plugins/maya/publish/collect_render.py | 21 ++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/pype/plugins/maya/publish/collect_instances.py b/pype/plugins/maya/publish/collect_instances.py index 9ea3ebe7fa..1d59a68bf6 100644 --- a/pype/plugins/maya/publish/collect_instances.py +++ b/pype/plugins/maya/publish/collect_instances.py @@ -122,7 +122,7 @@ class CollectInstances(pyblish.api.ContextPlugin): # if frame range on maya set is the same as full shot range # adjust the values to match the asset data if (ctx_frame_start_handle == data["frameStart"] - and ctx_frame_end_handle == data["frameEnd"]): + and ctx_frame_end_handle == data["frameEnd"]): # noqa: W503, E501 data["frameStartHandle"] = ctx_frame_start_handle data["frameEndHandle"] = ctx_frame_end_handle data["frameStart"] = ctx_frame_start @@ -141,8 +141,8 @@ class CollectInstances(pyblish.api.ContextPlugin): data["handleStart"] = 0 data["handleEnd"] = 0 - data["frameStartHandle"] = data["frameStart"] - data["handleStart"] - data["frameEndHandle"] = data["frameEnd"] + data["handleEnd"] + data["frameStartHandle"] = data["frameStart"] - data["handleStart"] # noqa: E501 + data["frameEndHandle"] = data["frameEnd"] + data["handleEnd"] # noqa: E501 if "handles" in data: data.pop('handles') @@ -157,7 +157,8 @@ class CollectInstances(pyblish.api.ContextPlugin): # Produce diagnostic message for any graphical # user interface interested in visualising it. self.log.info("Found: \"%s\" " % instance.data["name"]) - self.log.debug("DATA: {} ".format(json.dumps(instance.data, indent=4))) + self.log.debug( + "DATA: {} ".format(json.dumps(instance.data, indent=4))) def sort_by_family(instance): """Sort by family""" diff --git a/pype/plugins/maya/publish/collect_render.py b/pype/plugins/maya/publish/collect_render.py index 88c1be477d..365b0b5a13 100644 --- a/pype/plugins/maya/publish/collect_render.py +++ b/pype/plugins/maya/publish/collect_render.py @@ -203,13 +203,13 @@ class CollectMayaRender(pyblish.api.ContextPlugin): full_paths.append(full_path) aov_dict["beauty"] = full_paths - frame_start_render = int(self.get_render_attribute("startFrame", - layer=layer_name)) - frame_end_render = int(self.get_render_attribute("endFrame", - layer=layer_name)) + frame_start_render = int(self.get_render_attribute( + "startFrame", layer=layer_name)) + frame_end_render = int(self.get_render_attribute( + "endFrame", layer=layer_name)) - if (int(context.data['frameStartHandle']) == frame_start_render and - int(context.data['frameEndHandle']) == frame_end_render): + if (int(context.data['frameStartHandle']) == frame_start_render + and int(context.data['frameEndHandle']) == frame_end_render): # noqa: W503, E501 handle_start = context.data['handleStart'] handle_end = context.data['handleEnd'] @@ -506,7 +506,7 @@ class AExpectedFiles: expected_files.append( '{}.{}.{}'.format(file_prefix, str(frame).rjust( - layer_data["padding"], "0"), + layer_data["padding"], "0"), layer_data["defaultExt"])) return expected_files @@ -642,7 +642,7 @@ class ExpectedFilesArnold(AExpectedFiles): enabled_aovs = [] try: if not (cmds.getAttr('defaultArnoldRenderOptions.aovMode') - and not cmds.getAttr('defaultArnoldDriver.mergeAOVs')): + and not cmds.getAttr('defaultArnoldDriver.mergeAOVs')): # noqa: W503, E501 # AOVs are merged in mutli-channel file return enabled_aovs except ValueError: @@ -763,10 +763,7 @@ class ExpectedFilesVray(AExpectedFiles): if enabled: # todo: find how vray set format for AOVs enabled_aovs.append( - ( - self._get_vray_aov_name(aov), - default_ext) - ) + (self._get_vray_aov_name(aov), default_ext)) return enabled_aovs def _get_vray_aov_name(self, node): From 80aa8a52b755b36a11769d2a4e81ee7fb3b189e8 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Mon, 23 Mar 2020 11:58:11 +0100 Subject: [PATCH 8/9] validate only important things --- .../maya/publish/validate_frame_range.py | 90 ++++++------------- 1 file changed, 27 insertions(+), 63 deletions(-) diff --git a/pype/plugins/maya/publish/validate_frame_range.py b/pype/plugins/maya/publish/validate_frame_range.py index 0be77644a0..c0a43fe4c7 100644 --- a/pype/plugins/maya/publish/validate_frame_range.py +++ b/pype/plugins/maya/publish/validate_frame_range.py @@ -7,8 +7,9 @@ from maya import cmds class ValidateFrameRange(pyblish.api.InstancePlugin): """Valides the frame ranges. - This is optional validator checking if the frame range matches the one of - asset. + This is optional validator checking if the frame range on instance + matches the one of asset. It also validate render frame range of render + layers Repair action will change everything to match asset. @@ -20,7 +21,7 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): families = ["animation", "pointcache", "camera", - "render", + "renderlayer", "review", "yeticache"] optional = True @@ -67,69 +68,32 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): handle_start, frame_start, frame_end, handle_end )) - minTime = int(cmds.playbackOptions(minTime=True, query=True)) - maxTime = int(cmds.playbackOptions(maxTime=True, query=True)) - animStartTime = int(cmds.playbackOptions(animationStartTime=True, - query=True)) - animEndTime = int(cmds.playbackOptions(animationEndTime=True, - query=True)) + if "renderlayer" in self.families: - if int(minTime) != inst_start: - errors.append("Start of Maya timeline is set to frame [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - minTime, - frame_start_handle, - handle_start, frame_start, frame_end, handle_end - )) + render_start = int(cmds.getAttr("defaultRenderGlobals.startFrame")) + render_end = int(cmds.getAttr("defaultRenderGlobals.endFrame")) - if int(maxTime) != inst_end: - errors.append("End of Maya timeline is set to frame [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - maxTime, - frame_end_handle, - handle_start, frame_start, frame_end, handle_end - )) + if int(render_start) != inst_start: + errors.append("Render settings start frame is set to [ {} ] " + "and doesn't match the one set on " + "asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + int(render_start), + frame_start_handle, + handle_start, frame_start, frame_end, + handle_end + )) - if int(animStartTime) != inst_start: - errors.append("Animation start in Maya is set to frame [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - animStartTime, - frame_start_handle, - handle_start, frame_start, frame_end, handle_end - )) - - if int(animEndTime) != inst_end: - errors.append("Animation start in Maya is set to frame [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - animEndTime, - frame_end_handle, - handle_start, frame_start, frame_end, handle_end - )) - - render_start = int(cmds.getAttr("defaultRenderGlobals.startFrame")) - render_end = int(cmds.getAttr("defaultRenderGlobals.endFrame")) - - if int(render_start) != inst_start: - errors.append("Render settings start frame is set to [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - int(render_start), - frame_start_handle, - handle_start, frame_start, frame_end, handle_end - )) - - if int(render_end) != inst_end: - errors.append("Render settings end frame is set to [ {} ] " - " and doesn't match the one set on asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - int(render_end), - frame_end_handle, - handle_start, frame_start, frame_end, handle_end - )) + if int(render_end) != inst_end: + errors.append("Render settings end frame is set to [ {} ] " + "and doesn't match the one set on " + "asset [ {} ]: " + "{}/{}/{}/{} (handle/start/end/handle)".format( + int(render_end), + frame_end_handle, + handle_start, frame_start, frame_end, + handle_end + )) for e in errors: self.log.error(e) From 566d4952486a24cd8e3e867490a9647fac57a582 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Mon, 23 Mar 2020 18:06:26 +0100 Subject: [PATCH 9/9] simplified frame range validator --- .../maya/publish/validate_frame_range.py | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/pype/plugins/maya/publish/validate_frame_range.py b/pype/plugins/maya/publish/validate_frame_range.py index c0a43fe4c7..0d51a83cf5 100644 --- a/pype/plugins/maya/publish/validate_frame_range.py +++ b/pype/plugins/maya/publish/validate_frame_range.py @@ -68,33 +68,6 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): handle_start, frame_start, frame_end, handle_end )) - if "renderlayer" in self.families: - - render_start = int(cmds.getAttr("defaultRenderGlobals.startFrame")) - render_end = int(cmds.getAttr("defaultRenderGlobals.endFrame")) - - if int(render_start) != inst_start: - errors.append("Render settings start frame is set to [ {} ] " - "and doesn't match the one set on " - "asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - int(render_start), - frame_start_handle, - handle_start, frame_start, frame_end, - handle_end - )) - - if int(render_end) != inst_end: - errors.append("Render settings end frame is set to [ {} ] " - "and doesn't match the one set on " - "asset [ {} ]: " - "{}/{}/{}/{} (handle/start/end/handle)".format( - int(render_end), - frame_end_handle, - handle_start, frame_start, frame_end, - handle_end - )) - for e in errors: self.log.error(e) @@ -103,12 +76,8 @@ class ValidateFrameRange(pyblish.api.InstancePlugin): @classmethod def repair(cls, instance): """ - Repair by calling avalon reset frame range function. This will set - timeline frame range, render settings range and frame information - on instance container to match asset data. + Repair instance container to match asset data. """ - import avalon.maya.interactive - avalon.maya.interactive.reset_frame_range() cmds.setAttr( "{}.frameStart".format(instance.data["name"]), instance.context.data.get("frameStartHandle"))