mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
add allow_autosave argument as kwargs in open_file function in nuke
This commit is contained in:
parent
8c5b9321e4
commit
47b2a38cd4
1 changed files with 6 additions and 5 deletions
|
|
@ -19,16 +19,17 @@ def save_file(filepath):
|
|||
nuke.Root().setModified(False)
|
||||
|
||||
|
||||
def open_file(filepath):
|
||||
def open_file(filepath, allow_autosave=True):
|
||||
filepath = filepath.replace("\\", "/")
|
||||
|
||||
# To remain in the same window, we have to clear the script and read
|
||||
# in the contents of the workfile.
|
||||
nuke.scriptClear()
|
||||
autosave = "{}.autosave".format(filepath)
|
||||
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
|
||||
if allow_autosave:
|
||||
autosave = "{}.autosave".format(filepath)
|
||||
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)
|
||||
nuke.Root()["name"].setValue(filepath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue