This patch causes blender to display a confirm-menu, much like the current confirm-quit menu, if there are unsaved changes to the blend (but not unpacked images) when the user requests an open, open recent, or drag-drop open operation.
Note: This patch displays the blender style confirm menu on all platforms.
Note: Blender currently does not report image edits to un-packed external images as unsaved changes to wm.file_saved, nor does it save them when you file->save the file.
You can see a brief video of this in operation here...
https://www.youtube.com/watch?v=DxyentHv-rM&feature=youtu.be
how does it work?
The operator main_openfile INVOKE was changed to check for unsaved changes, and if so, present a confirm menu. If the user confirms, the main_openfile operator is re-invoked with a discard_unsaved_changes property set.
Previously, open-recent and a file-drop operation were treated as main_openfile:EXEC. This patch changes them to be INVOKE, which seems reasonable, since they are both user-initiated operations. The new INVOKE code checks to see if a filepath is supplied, and if not, conditionally displays the file chooser.
There are no checks for unsaved changes in EXEC. Existing python scripts which invoke main_openfile:EXEC to open a file will still open immediately, potentially discarding unsaved changes.