mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
♻️ simplify the code
This commit is contained in:
parent
971164cd7f
commit
cffe48fc20
1 changed files with 7 additions and 5 deletions
|
|
@ -146,15 +146,17 @@ def suspended_refresh(suspend=True):
|
|||
|
||||
cmds.ogs(pause=True) is a toggle so we cant pass False.
|
||||
"""
|
||||
original_state = None
|
||||
if not IS_HEADLESS:
|
||||
original_state = cmds.ogs(query=True, pause=True)
|
||||
if IS_HEADLESS:
|
||||
yield
|
||||
return
|
||||
|
||||
original_state = cmds.ogs(query=True, pause=True)
|
||||
try:
|
||||
if suspend and not original_state and not IS_HEADLESS:
|
||||
if suspend and not original_state:
|
||||
cmds.ogs(pause=True)
|
||||
yield
|
||||
finally:
|
||||
if suspend and not original_state and not IS_HEADLESS:
|
||||
if suspend and not original_state:
|
||||
cmds.ogs(pause=True)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue