Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya: pointcache #4201

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions openpype/hosts/maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion openpype/hosts/maya/plugins/publish/extract_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def process(self, instance):
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(
Expand Down