feat: updated godot version
This commit is contained in:
parent
0c508b0831
commit
42b028dbb5
4694 changed files with 236470 additions and 401376 deletions
|
|
@ -30,13 +30,11 @@
|
|||
|
||||
#include "script_language.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/core_bind.h"
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/debugger/script_debugger.h"
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/templates/sort_array.h"
|
||||
|
||||
ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES];
|
||||
|
|
@ -47,6 +45,7 @@ thread_local bool ScriptServer::thread_entered = false;
|
|||
|
||||
bool ScriptServer::scripting_enabled = true;
|
||||
bool ScriptServer::reload_scripts_on_save = false;
|
||||
ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
|
||||
|
||||
// These need to be the last static variables in this file, since we're exploiting the reverse-order destruction of static variables.
|
||||
static bool is_program_exiting = false;
|
||||
|
|
@ -173,7 +172,6 @@ void Script::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("get_global_name"), &Script::get_global_name);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("has_script_method", "method_name"), &Script::has_method);
|
||||
ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_script_property_list"), &Script::_get_script_property_list);
|
||||
|
|
@ -192,12 +190,27 @@ void Script::_bind_methods() {
|
|||
|
||||
void Script::reload_from_file() {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (Engine::get_singleton()->is_editor_hint() && is_tool()) {
|
||||
get_language()->reload_tool_script(this, true);
|
||||
} else {
|
||||
Array scripts = { this };
|
||||
get_language()->reload_scripts(scripts, true);
|
||||
// Replicates how the ScriptEditor reloads script resources, which generally handles it.
|
||||
// However, when scripts are to be reloaded but aren't open in the internal editor, we go through here instead.
|
||||
const Ref<Script> rel = ResourceLoader::load(ResourceLoader::path_remap(get_path()), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
if (rel.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_source_code(rel->get_source_code());
|
||||
set_last_modified_time(rel->get_last_modified_time());
|
||||
|
||||
// Only reload the script when there are no compilation errors to prevent printing the error messages twice.
|
||||
if (rel->is_valid()) {
|
||||
if (Engine::get_singleton()->is_editor_hint() && is_tool()) {
|
||||
get_language()->reload_tool_script(this, true);
|
||||
} else {
|
||||
// It's important to set p_keep_state to true in order to manage reloading scripts
|
||||
// that are currently instantiated.
|
||||
reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
Resource::reload_from_file();
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue