From 9e1dcd50083c28fbc8c69f4c27e6aa1a9175d045 Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 13 Jun 2018 10:47:41 +0200 Subject: [PATCH 1/3] removed print from function --- colorbleed/lib.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/colorbleed/lib.py b/colorbleed/lib.py index 8e1d0becc6..73bd80f9ff 100644 --- a/colorbleed/lib.py +++ b/colorbleed/lib.py @@ -242,8 +242,6 @@ def collect_container_metadata(container): hostlib = importlib.import_module(package_name) if not hasattr(hostlib, "get_additional_data"): - print("{} has no function called " - "get_additional_data".format(package_name)) return {} return hostlib.get_additional_data(container) From 735eacb83924322d9f246d108fc09c1287ebf71b Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 29 Jun 2018 14:27:33 +0200 Subject: [PATCH 2/3] refactored out dependency --- colorbleed/maya/lib.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/colorbleed/maya/lib.py b/colorbleed/maya/lib.py index 1493f7385e..5ba2122072 100644 --- a/colorbleed/maya/lib.py +++ b/colorbleed/maya/lib.py @@ -13,8 +13,6 @@ from collections import OrderedDict, defaultdict from maya import cmds, mel from avalon import api, maya, io, pipeline -from cb.utils.maya import core -import cb.utils.maya.context log = logging.getLogger(__name__) @@ -287,6 +285,26 @@ def renderlayer(layer): cmds.editRenderLayerGlobals(currentRenderLayer=original) +@contextlib.contextmanager +def evaluation(mode="off"): + """Set the evaluation manager during context. + + Arguments: + mode (str): The mode to apply during context. + "off": The standard DG evaluation (stable) + "serial": A serial DG evaluation + "parallel": The Maya 2016+ parallel evaluation + + """ + + original = cmds.evaluationManager(query=True, mode=1)[0] + try: + cmds.evaluationManager(mode=mode) + yield + finally: + cmds.evaluationManager(mode=original) + + def get_renderer(layer): with renderlayer(layer): return cmds.getAttr("defaultRenderGlobals.currentRenderer") @@ -579,7 +597,7 @@ def extract_alembic(file, # Disable the parallel evaluation temporarily to ensure no buggy # exports are made. (PLN-31) # TODO: Make sure this actually fixes the issues - with cb.utils.maya.context.evaluation("off"): + with evaluation("off"): cmds.AbcExport(j=job_str, verbose=verbose) if verbose: From c4362004c5f31a6645908c56cf834ba5726d55c3 Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 2 Jul 2018 14:32:44 +0200 Subject: [PATCH 3/3] skipping None values --- colorbleed/plugins/maya/load/load_yeti_cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/colorbleed/plugins/maya/load/load_yeti_cache.py b/colorbleed/plugins/maya/load/load_yeti_cache.py index ec7ab11474..dd6ebbeb05 100644 --- a/colorbleed/plugins/maya/load/load_yeti_cache.py +++ b/colorbleed/plugins/maya/load/load_yeti_cache.py @@ -179,10 +179,14 @@ class YetiCacheLoader(api.Loader): # Apply attributes to pgYetiMaya node kwargs = {} for attr, value in node_settings["attrs"].items(): + if value is None: + continue + attribute = "%s.%s" % (yeti_node, attr) if isinstance(value, (str, unicode)): cmds.setAttr(attribute, value, type="string") continue + cmds.setAttr(attribute, value, **kwargs) # Ensure the node has no namespace identifiers