Skip to content

Commit

Permalink
Temporary fix for singletons referencing one another (still spams err…
Browse files Browse the repository at this point in the history
…ors and results in autoload scripts being loaded multiple times)
  • Loading branch information
SaracenOne committed Aug 3, 2021
1 parent ebdfe25 commit afef47b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/object/script_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ bool ScriptServer::is_reload_scripts_on_save_enabled() {
return reload_scripts_on_save;
}

void ScriptServer::reload_all_scripts() {
for (int i = 0; i < _language_count; i++) {
_languages[i]->reload_all_scripts();
}
}

void ScriptServer::thread_enter() {
for (int i = 0; i < _language_count; i++) {
_languages[i]->thread_enter();
Expand Down
2 changes: 2 additions & 0 deletions core/object/script_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class ScriptServer {
static void register_language(ScriptLanguage *p_language);
static void unregister_language(ScriptLanguage *p_language);

static void reload_all_scripts();

static void set_reload_scripts_on_save(bool p_enable);
static bool is_reload_scripts_on_save_enabled();

Expand Down
2 changes: 2 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,8 @@ bool Main::start() {
}
}

ScriptServer::reload_all_scripts();

for (Node *E : to_add) {
sml->get_root()->add_child(E);
}
Expand Down

0 comments on commit afef47b

Please sign in to comment.