summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-11-12 12:13:55 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-11-12 12:13:55 +0100
commit8928b2044b76fb3160c5c17a48a93331233f01f9 (patch)
treedf3fb8fc2cc6376e5ac29b75ec3712ddcdd746cf /modules/gdscript/gdscript.cpp
parent89f2f7f278b27db396589d50e51be8a1e6dca919 (diff)
parenta3627b6e37049ca55cc0d5227a4ff7bc1b19ae1e (diff)
downloadredot-engine-8928b2044b76fb3160c5c17a48a93331233f01f9.tar.gz
Merge pull request #80281 from KoBeWi/unacceptable
Assign temporary path to preloaded resources
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r--modules/gdscript/gdscript.cpp5
1 files changed, 5 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);