abstract the headless command as function in lib.py

This commit is contained in:
Kayla Man 2023-06-22 19:02:18 +08:00
parent b150e0b6a1
commit 56a90a47f5
2 changed files with 11 additions and 1 deletions

View file

@ -2,6 +2,7 @@
import os
import nuke
from qtpy import QtWidgets
from openpype.hosts.nuke.api.lib import is_headless
def file_extensions():
@ -26,7 +27,7 @@ def open_file(filepath):
# To remain in the same window, we have to clear the script and read
# in the contents of the workfile.
nuke.scriptClear()
headless = QtWidgets.QApplication.instance() is None
headless = is_headless()
if not headless:
autosave = nuke.toNode("preferences")["AutoSaveName"].evaluate()
autosave_prmpt = "Autosave detected.\nWould you like to load the autosave file?" # noqa