♻️ simplify the code

This commit is contained in:
Ondrej Samohel 2023-10-16 09:57:22 +02:00
parent 971164cd7f
commit cffe48fc20
No known key found for this signature in database
GPG key ID: 02376E18990A97C6

View file

@ -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)