Editor: Fix documentation for built-in scripts

This commit is contained in:
Danil Alexeev 2025-05-02 19:22:05 +03:00
parent 1cf573f44d
commit 0a07ae7bf1
No known key found for this signature in database
GPG key ID: 5A52F75A8679EC57
6 changed files with 79 additions and 24 deletions

View file

@ -1009,7 +1009,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
Ref<Resource> scr = se->get_edited_resource();
if (scr->is_built_in()) {
continue; //internal script, who cares
continue; // Internal script, who cares.
}
if (trim_trailing_whitespace_on_save) {
@ -1089,10 +1089,9 @@ void ScriptEditor::_mark_built_in_scripts_as_saved(const String &p_parent_path)
Ref<Script> scr = edited_res;
if (scr.is_valid()) {
trigger_live_script_reload(scr->get_path());
if (scr->is_tool()) {
scr->reload(true);
}
clear_docs_from_script(scr);
scr->reload(true);
update_docs_from_script(scr);
}
}
}
@ -1143,7 +1142,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) {
}
if (edited_res->is_built_in()) {
continue; //internal script, who cares
continue; // Internal script, who cares.
}
uint64_t last_date = se->edited_file_data.last_modified_time;
@ -2722,24 +2721,21 @@ void ScriptEditor::save_all_scripts() {
se->apply_code();
}
Ref<Script> scr = edited_res;
if (scr.is_valid()) {
clear_docs_from_script(scr);
}
if (!edited_res->is_built_in()) {
Ref<TextFile> text_file = edited_res;
Ref<Script> scr = edited_res;
if (text_file.is_valid()) {
_save_text_file(text_file, text_file->get_path());
continue;
}
if (scr.is_valid()) {
clear_docs_from_script(scr);
}
EditorNode::get_singleton()->save_resource(edited_res); //external script, save it
if (scr.is_valid()) {
update_docs_from_script(scr);
}
// External script, save it.
EditorNode::get_singleton()->save_resource(edited_res);
} else {
// For built-in scripts, save their scenes instead.
const String scene_path = edited_res->get_path().get_slice("::", 0);
@ -2747,6 +2743,10 @@ void ScriptEditor::save_all_scripts() {
scenes_to_save.insert(scene_path);
}
}
if (scr.is_valid()) {
update_docs_from_script(scr);
}
}
if (!scenes_to_save.is_empty()) {