diff --git a/openpype/hosts/nuke/api/workio.py b/openpype/hosts/nuke/api/workio.py index 99e95dbd77..d674e3ba4d 100644 --- a/openpype/hosts/nuke/api/workio.py +++ b/openpype/hosts/nuke/api/workio.py @@ -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)