You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Check for unsaved changes when closing a scene
This commit is contained in:
@@ -287,14 +287,19 @@ void ShaderEditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
|
||||
p_layout->set_value("ShaderEditor", "selected_shader", selected_shader);
|
||||
}
|
||||
|
||||
String ShaderEditorPlugin::get_unsaved_status() const {
|
||||
String ShaderEditorPlugin::get_unsaved_status(const String &p_for_scene) const {
|
||||
if (!p_for_scene.is_empty()) {
|
||||
// TODO: handle built-in shaders.
|
||||
return String();
|
||||
}
|
||||
|
||||
// TODO: This should also include visual shaders and shader includes, but save_external_data() doesn't seem to save them...
|
||||
PackedStringArray unsaved_shaders;
|
||||
for (uint32_t i = 0; i < edited_shaders.size(); i++) {
|
||||
if (edited_shaders[i].shader_editor) {
|
||||
if (edited_shaders[i].shader_editor->is_unsaved()) {
|
||||
if (unsaved_shaders.is_empty()) {
|
||||
unsaved_shaders.append("Save changes to the following shaders(s) before quitting?");
|
||||
unsaved_shaders.append(TTR("Save changes to the following shaders(s) before quitting?"));
|
||||
}
|
||||
unsaved_shaders.append(edited_shaders[i].shader_editor->get_name());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user