🐛 don't call cmds.ogs() if in headless mode

This commit is contained in:
Ondrej Samohel 2023-10-13 18:06:53 +02:00
parent b1c4e0d505
commit 971164cd7f
No known key found for this signature in database
GPG key ID: 02376E18990A97C6

View file

@ -146,13 +146,15 @@ def suspended_refresh(suspend=True):
cmds.ogs(pause=True) is a toggle so we cant pass False.
"""
original_state = cmds.ogs(query=True, pause=True)
original_state = None
if not IS_HEADLESS:
original_state = cmds.ogs(query=True, pause=True)
try:
if suspend and not original_state:
if suspend and not original_state and not IS_HEADLESS:
cmds.ogs(pause=True)
yield
finally:
if suspend and not original_state:
if suspend and not original_state and not IS_HEADLESS:
cmds.ogs(pause=True)