mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Jakub's comment
This commit is contained in:
parent
8736370b4e
commit
82d18355c8
1 changed files with 4 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
"""Host API required Work Files tool"""
|
"""Host API required Work Files tool"""
|
||||||
import os
|
import os
|
||||||
import nuke
|
import nuke
|
||||||
|
from qtpy import QtWidgets
|
||||||
|
|
||||||
|
|
||||||
def file_extensions():
|
def file_extensions():
|
||||||
|
|
@ -19,13 +20,14 @@ def save_file(filepath):
|
||||||
nuke.Root().setModified(False)
|
nuke.Root().setModified(False)
|
||||||
|
|
||||||
|
|
||||||
def open_file(filepath, allow_autosave=True):
|
def open_file(filepath):
|
||||||
filepath = filepath.replace("\\", "/")
|
filepath = filepath.replace("\\", "/")
|
||||||
|
|
||||||
# To remain in the same window, we have to clear the script and read
|
# To remain in the same window, we have to clear the script and read
|
||||||
# in the contents of the workfile.
|
# in the contents of the workfile.
|
||||||
nuke.scriptClear()
|
nuke.scriptClear()
|
||||||
if allow_autosave:
|
headless = QtWidgets.QApplication.instance() is None
|
||||||
|
if not headless:
|
||||||
autosave = "{}.autosave".format(filepath)
|
autosave = "{}.autosave".format(filepath)
|
||||||
autosave_prmpt = "Autosave detected.\nWould you like to load the autosave file?" # noqa
|
autosave_prmpt = "Autosave detected.\nWould you like to load the autosave file?" # noqa
|
||||||
if os.path.isfile(autosave) and nuke.ask(autosave_prmpt):
|
if os.path.isfile(autosave) and nuke.ask(autosave_prmpt):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue