diff options
| author | DmitriySalnikov <salnikov.mine@yandex.ru> | 2023-11-26 09:53:05 +0300 |
|---|---|---|
| committer | DmitriySalnikov <salnikov.mine@yandex.ru> | 2023-11-30 04:07:21 +0300 |
| commit | 8cdbec0434fd95c303c670985406224c2c6b5232 (patch) | |
| tree | 344b0cb7dd6528dd29cdd5389182c10c92c770a6 /modules/gdscript | |
| parent | 5df98679672c12d96b4ac4d96ee17f1559207401 (diff) | |
| download | redot-engine-8cdbec0434fd95c303c670985406224c2c6b5232.tar.gz | |
Update cached singletons when reloading GDScripts
Diffstat (limited to 'modules/gdscript')
| -rw-r--r-- | modules/gdscript/gdscript.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 05c2558417..0103168be3 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2323,6 +2323,19 @@ void GDScriptLanguage::reload_all_scripts() { } elem = elem->next(); } + +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + // Reload all pointers to existing singletons so that tool scripts can work with the reloaded extensions. + List<Engine::Singleton> singletons; + Engine::get_singleton()->get_singletons(&singletons); + for (const Engine::Singleton &E : singletons) { + if (globals.has(E.name)) { + _add_global(E.name, E.ptr); + } + } + } +#endif } //as scripts are going to be reloaded, must proceed without locking here |
