mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Merge pull request #124 from aardschok/122
Refactor out inhouse dependency
This commit is contained in:
commit
2660ca2ac8
1 changed files with 21 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue