diff options
Diffstat (limited to 'scene/resources/resource_format_text.cpp')
-rw-r--r-- | scene/resources/resource_format_text.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index c3628125b4..7719cc28d2 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -851,26 +851,34 @@ void ResourceLoaderText::get_dependencies(Ref<FileAccess> p_f, List<String> *p_d String path = next_tag.fields["path"]; String type = next_tag.fields["type"]; + String fallback_path; bool using_uid = false; if (next_tag.fields.has("uid")) { - //if uid exists, return uid in text format, not the path + // If uid exists, return uid in text format, not the path. String uidt = next_tag.fields["uid"]; ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(uidt); if (uid != ResourceUID::INVALID_ID) { + fallback_path = path; // Used by Dependency Editor, in case uid path fails. path = ResourceUID::get_singleton()->id_to_text(uid); using_uid = true; } } if (!using_uid && !path.contains("://") && path.is_relative_path()) { - // path is relative to file being loaded, so convert to a resource path + // Path is relative to file being loaded, so convert to a resource path. path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().path_join(path)); } if (p_add_types) { path += "::" + type; } + if (!fallback_path.is_empty()) { + if (!p_add_types) { + path += "::"; // Ensure that path comes third, even if there is no type. + } + path += "::" + fallback_path; + } p_dependencies->push_back(path); |