-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Don't save unnecessarily with save_before_running
#90034
base: master
Are you sure you want to change the base?
Conversation
6ee720d
to
3b01a1d
Compare
With editor plugins, this may not be the case: godotengine/godot-proposals#2153 I fully support this PR, but we need to have zero false negatives before it can be merged without risk. People are used to the current behavior, so not saving some scenes that should be saved due to a bug could end up wasting hours of people's time. |
Excited to see this change come in! The current behavior is triggering a lot of unnecessary file watch behavior since unchanged scenes get new modify times. I am wondering if rather than changing the behavior only for The current behavior of "Save All Scenes" is really "Re-Save All Open Scenes" and that's not super useful. I'd expect it to either 1) save all dirty scenes (strict subset of open ones so I think that's why the current implementation is what it is) or 2) Re-Save All Scenes regardless of open status. Doing a full re-save but only of open scenes feels like a weird in-between that isn't correct for either reasonable interpretation. Personally I'd prefer to have it just do option #1 (hence this suggestion) but I could see a use case for full re-save too. Most applications that support multiple documents simply have a "Save All" option (commonly bound to Also I noticed it technically resaves everything that's open (including shaders and scripts) so "Save All" might be a more correct name as well. |
save_before_running
3b01a1d
to
cb24521
Compare
Ok I reworked Save all Scenes. It can be used only if any scene is unsaved. godot.windows.editor.dev.x86_64_LaqdPMnqcw.mp4 |
godotengine#90034 Prevents saving scenes/files before debugging unless the scene/file has changed.
This change works like a charm for scenes and scripts. In testing, however, I noticed that any open shaders always re-save any time any scene is saved (whether or not they are modified). I tracked it down to needing an void ShaderEditorPlugin::save_external_data() {
for (EditedShader &edited_shader : edited_shaders) {
if (edited_shader.shader_editor) {
if (edited_shader.shader_editor->is_unsaved()) {
edited_shader.shader_editor->save_external_data();
}
}
}
_update_shader_list();
} It might be worth including that in this PR also for completeness sake. |
cb24521
to
31196c0
Compare
How does this work with changes to resources, instead of scenes? Currently I think a lot of the Godot workflow hinges on scene saving actually saving all dependent resources, even if there's no change to the scene itself. Saving changes to resources specifically is pretty cumbersome currently with just the save button in the inspector IIRC. |
Apparently if you make a change in external resource, the editor will save the current scene which will also save that resource 🤔 EDIT: |
31196c0
to
cbc12d8
Compare
When
save_before_running
is enabled, it will save all scenes, which can lead to longer running times if you have many opened scenes. That's rather absurd.This PR changes that mechanism to only save when there are unsaved changes in the scene (which we can detect pretty reliably).
Fixes #78753
Fixes #94563