MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_unsaved_status

Method get_unsaved_status

editor/script/script_editor_plugin.cpp:4779–4820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4777}
4778
4779String ScriptEditorPlugin::get_unsaved_status(const String &p_for_scene) const {
4780 const PackedStringArray unsaved_scripts = script_editor->get_unsaved_scripts();
4781 if (unsaved_scripts.is_empty()) {
4782 return String();
4783 }
4784
4785 PackedStringArray message;
4786 if (!p_for_scene.is_empty()) {
4787 PackedStringArray unsaved_built_in_scripts;
4788
4789 const String scene_file = p_for_scene.get_file();
4790 for (const String &E : unsaved_scripts) {
4791 if (!E.is_resource_file() && E.contains(scene_file)) {
4792 unsaved_built_in_scripts.append(E);
4793 }
4794 }
4795
4796 if (unsaved_built_in_scripts.is_empty()) {
4797 return String();
4798 } else {
4799 message.resize(unsaved_built_in_scripts.size() + 1);
4800 message.write[0] = TTR("There are unsaved changes in the following built-in script(s):");
4801
4802 int i = 1;
4803 for (const String &E : unsaved_built_in_scripts) {
4804 message.write[i] = E.trim_suffix("(*)");
4805 i++;
4806 }
4807 return String("\n").join(message);
4808 }
4809 }
4810
4811 message.resize(unsaved_scripts.size() + 1);
4812 message.write[0] = TTR("Save changes to the following script(s) before quitting?");
4813
4814 int i = 1;
4815 for (const String &E : unsaved_scripts) {
4816 message.write[i] = E.trim_suffix("(*)");
4817 i++;
4818 }
4819 return String("\n").join(message);
4820}
4821
4822void ScriptEditorPlugin::save_external_data() {
4823 if (!EditorNode::get_singleton()->is_exiting()) {

Callers

nothing calls this directly

Calls 12

TTRFunction · 0.85
get_unsaved_scriptsMethod · 0.80
is_resource_fileMethod · 0.80
trim_suffixMethod · 0.80
joinMethod · 0.80
sizeMethod · 0.65
StringClass · 0.50
is_emptyMethod · 0.45
get_fileMethod · 0.45
containsMethod · 0.45
appendMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected