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

Commit

Permalink
Add optional keyword to suspend_refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
tokejepsen committed Dec 2, 2022
1 parent a2abcd2 commit a465315
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
8 changes: 4 additions & 4 deletions openpype/hosts/maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def get_main_window():


@contextlib.contextmanager
def suspended_refresh():
def suspended_refresh(suspend=True):
"""Suspend viewport refreshes"""

original_state = cmds.refresh(query=True, suspend=True)
try:
cmds.refresh(suspend=True)
cmds.refresh(suspend=suspend)
yield
finally:
cmds.refresh(suspend=False)
cmds.refresh(suspend=original_state)


@contextlib.contextmanager
Expand Down
20 changes: 7 additions & 13 deletions openpype/hosts/maya/plugins/publish/extract_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,15 @@ def process(self, instance):
start=start,
end=end))

if instance.data.get("refresh", False):
with suspended_refresh(suspend=instance.data.get("refresh", False)):
with maintained_selection():
cmds.select(nodes, noExpand=True)
extract_alembic(file=path,
startFrame=start,
endFrame=end,
**options)
else:
with suspended_refresh():
with maintained_selection():
cmds.select(nodes, noExpand=True)
extract_alembic(file=path,
startFrame=start,
endFrame=end,
**options)
extract_alembic(
file=path,
startFrame=start,
endFrame=end,
**options
)

if "representations" not in instance.data:
instance.data["representations"] = []
Expand Down

0 comments on commit a465315

Please sign in to comment.