mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
autosave nk script will be loaded if the script is found in the work directory
This commit is contained in:
parent
65e5aa40cf
commit
3e02ea6263
1 changed files with 7 additions and 1 deletions
|
|
@ -25,7 +25,13 @@ 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()
|
||||
nuke.scriptReadFile(filepath)
|
||||
autosave = f"{filepath}.autosave"
|
||||
autosave_prmpt = "Autosave detected.\nWould you like to load the autosave file?" # noqa
|
||||
if os.path.isfile(autosave) and nuke.ask(autosave_prmpt):
|
||||
filepath = autosave
|
||||
nuke.scriptReadFile(filepath)
|
||||
else:
|
||||
nuke.scriptReadFile(filepath)
|
||||
nuke.Root()["name"].setValue(filepath)
|
||||
nuke.Root()["project_directory"].setValue(os.path.dirname(filepath))
|
||||
nuke.Root().setModified(False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue