|
@@ -1057,6 +1057,26 @@ void GDScript::_bind_methods() {
|
|
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDScript::_new, MethodInfo("new"));
|
|
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDScript::_new, MethodInfo("new"));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void GDScript::set_path_cache(const String &p_path) {
|
|
|
|
+ if (ResourceCache::has(p_path)) {
|
|
|
|
+ set_path(p_path, true);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (is_root_script()) {
|
|
|
|
+ Script::set_path_cache(p_path);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String old_path = path;
|
|
|
|
+ path = p_path;
|
|
|
|
+ path_valid = true;
|
|
|
|
+ GDScriptCache::move_script(old_path, p_path);
|
|
|
|
+
|
|
|
|
+ for (KeyValue<StringName, Ref<GDScript>> &kv : subclasses) {
|
|
|
|
+ kv.value->set_path_cache(p_path);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
void GDScript::set_path(const String &p_path, bool p_take_over) {
|
|
void GDScript::set_path(const String &p_path, bool p_take_over) {
|
|
if (is_root_script()) {
|
|
if (is_root_script()) {
|
|
Script::set_path(p_path, p_take_over);
|
|
Script::set_path(p_path, p_take_over);
|