diff options
author | kobewi <kobewi4e@gmail.com> | 2023-08-05 02:07:16 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-11-10 00:43:30 +0100 |
commit | a3627b6e37049ca55cc0d5227a4ff7bc1b19ae1e (patch) | |
tree | 86e7bf3fe77bc14aac3e4c36717940fa1da02332 /modules/gdscript | |
parent | 9df6491853b7b043afba3c6d56f4c5b21ac7fd7c (diff) | |
download | redot-engine-a3627b6e37049ca55cc0d5227a4ff7bc1b19ae1e.tar.gz |
Assign temporary path to preloaded resources
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 5 | ||||
-rw-r--r-- | modules/gdscript/gdscript.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 6245cc85a0..a2be6a86d7 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -992,6 +992,7 @@ void GDScript::set_path(const String &p_path, bool p_take_over) { String old_path = path; path = p_path; + path_valid = true; GDScriptCache::move_script(old_path, p_path); for (KeyValue<StringName, Ref<GDScript>> &kv : subclasses) { @@ -1000,6 +1001,9 @@ void GDScript::set_path(const String &p_path, bool p_take_over) { } String GDScript::get_script_path() const { + if (!path_valid && !get_path().is_empty()) { + return get_path(); + } return path; } @@ -1035,6 +1039,7 @@ Error GDScript::load_source_code(const String &p_path) { source = s; path = p_path; + path_valid = true; #ifdef TOOLS_ENABLED source_changed_cache = true; set_edited(false); diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 04b0a1d786..9717dd7ff1 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -171,6 +171,7 @@ class GDScript : public Script { //exported members String source; String path; + bool path_valid = false; // False if using default path. StringName local_name; // Inner class identifier or `class_name`. StringName global_name; // `class_name`. String fully_qualified_name; |