-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add _get_unsaved_status()
method to EditorPlugin and implement it for script and shader editors
#67503
Add _get_unsaved_status()
method to EditorPlugin and implement it for script and shader editors
#67503
Conversation
ea63051
to
80d79f6
Compare
Rebased and ready for review. I did a small modification: godot.windows.editor.dev.x86_64_Ms3syKkV8H.mp4I added it as another commit, but I can rebase it into 2 commits if that's better. |
fd9af29
to
ed159e4
Compare
ed159e4
to
a741d60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested, but the code looks mostly correct (left a couple of notes).
The feature itself is fine, though I think we should at some point make it more convenient to handle unsaved resources specifically. I proposed before an API that would allow plugins to mark arbitrary strings as dirty, which could be used to identify resources and any other stuff as unsaved.
But maybe we just need this new method and some kind of _get_unsaved_files
which returns a list. This can be done in a follow-up though.
a741d60
to
b883f32
Compare
Thanks! |
This PR adds
_get_unsaved_status()
. When editor is being closed, it calls this method on every plugin. The method returns a string. If the string is not empty, its content will be displayed in save confirmation dialog and the user can normally choose to save or discard. If the returned string is empty, the editor will close normally.I implemented this method for script editor and shader editor, so unsaved scripts will now prompt on editor exit. Unfortunately you can't discard them due to #18010
Fixes #55026
Fixes #36281
Supersedes #55586