Merge pull request #78326 from KoBeWi/0110010001100101011000110110010101101110011000110111100101011111011001010110010001101001011101000110111101110010

Fix missing UID handling for binary formats
This commit is contained in:
Rémi Verschelde 2023-06-16 16:53:38 +02:00
commit c209ad222c
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -920,8 +920,11 @@ void ResourceLoaderBinary::get_dependencies(Ref<FileAccess> p_f, List<String> *p
for (int i = 0; i < external_resources.size(); i++) { for (int i = 0; i < external_resources.size(); i++) {
String dep; String dep;
String fallback_path;
if (external_resources[i].uid != ResourceUID::INVALID_ID) { if (external_resources[i].uid != ResourceUID::INVALID_ID) {
dep = ResourceUID::get_singleton()->id_to_text(external_resources[i].uid); dep = ResourceUID::get_singleton()->id_to_text(external_resources[i].uid);
fallback_path = external_resources[i].path; // Used by Dependency Editor, in case uid path fails.
} else { } else {
dep = external_resources[i].path; dep = external_resources[i].path;
} }
@ -929,6 +932,12 @@ void ResourceLoaderBinary::get_dependencies(Ref<FileAccess> p_f, List<String> *p
if (p_add_types && !external_resources[i].type.is_empty()) { if (p_add_types && !external_resources[i].type.is_empty()) {
dep += "::" + external_resources[i].type; dep += "::" + external_resources[i].type;
} }
if (!fallback_path.is_empty()) {
if (!p_add_types) {
dep += "::"; // Ensure that path comes third, even if there is no type.
}
dep += "::" + fallback_path;
}
p_dependencies->push_back(dep); p_dependencies->push_back(dep);
} }