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

Method reload_all_scripts

modules/gdscript/gdscript.cpp:2547–2579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2545};
2546
2547void GDScriptLanguage::reload_all_scripts() {
2548#ifdef DEBUG_ENABLED
2549 print_verbose("GDScript: Reloading all scripts");
2550 Array scripts;
2551 {
2552 MutexLock lock(mutex);
2553
2554 SelfList<GDScript> *elem = script_list.first();
2555 while (elem) {
2556 if (elem->self()->get_path().is_resource_file()) {
2557 print_verbose("GDScript: Found: " + elem->self()->get_path());
2558 scripts.push_back(Ref<GDScript>(elem->self())); //cast to gdscript to avoid being erased by accident
2559 }
2560 elem = elem->next();
2561 }
2562
2563#ifdef TOOLS_ENABLED
2564 if (Engine::get_singleton()->is_editor_hint()) {
2565 // Reload all pointers to existing singletons so that tool scripts can work with the reloaded extensions.
2566 List<Engine::Singleton> singletons;
2567 Engine::get_singleton()->get_singletons(&singletons);
2568 for (const Engine::Singleton &E : singletons) {
2569 if (globals.has(E.name)) {
2570 _add_global(E.name, E.ptr);
2571 }
2572 }
2573 }
2574#endif // TOOLS_ENABLED
2575 }
2576
2577 reload_scripts(scripts, true);
2578#endif // DEBUG_ENABLED
2579}
2580
2581void GDScriptLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload) {
2582#ifdef DEBUG_ENABLED

Callers 2

poll_eventsMethod · 0.45
_reload_all_scriptsMethod · 0.45

Calls 9

firstMethod · 0.80
is_resource_fileMethod · 0.80
selfMethod · 0.80
get_singletonsMethod · 0.80
get_pathMethod · 0.45
push_backMethod · 0.45
nextMethod · 0.45
is_editor_hintMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected