diff --git a/openpype/hosts/nuke/api/workio.py b/openpype/hosts/nuke/api/workio.py index 5692f8e63c..50e22391b2 100644 --- a/openpype/hosts/nuke/api/workio.py +++ b/openpype/hosts/nuke/api/workio.py @@ -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)