| 2545 | }; |
| 2546 | |
| 2547 | void 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 | |
| 2581 | void GDScriptLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload) { |
| 2582 | #ifdef DEBUG_ENABLED |
no test coverage detected