Merge pull request #4201 from tokejepsen/enhancement/maya_pointcache

This commit is contained in:
Ondřej Samohel 2022-12-09 18:26:19 +01:00 committed by GitHub
commit ebc5eda1ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -128,13 +128,18 @@ def get_main_window():
@contextlib.contextmanager
def suspended_refresh(suspend=True):
"""Suspend viewport refreshes"""
original_state = cmds.refresh(query=True, suspend=True)
"""Suspend viewport refreshes
cmds.ogs(pause=True) is a toggle so we cant pass False.
"""
original_state = cmds.ogs(query=True, pause=True)
try:
cmds.refresh(suspend=suspend)
if suspend and not original_state:
cmds.ogs(pause=True)
yield
finally:
cmds.refresh(suspend=original_state)
if suspend and not original_state:
cmds.ogs(pause=True)
@contextlib.contextmanager

View file

@ -86,7 +86,8 @@ class ExtractAlembic(publish.Extractor):
start=start,
end=end))
with suspended_refresh(suspend=instance.data.get("refresh", False)):
suspend = not instance.data.get("refresh", False)
with suspended_refresh(suspend=suspend):
with maintained_selection():
cmds.select(nodes, noExpand=True)
extract_alembic(