MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / set_real_from_missing_resource

Method set_real_from_missing_resource

compat/resource_loader_compat.cpp:718–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718Ref<Resource> ResourceCompatConverter::set_real_from_missing_resource(Ref<MissingResource> mr, Ref<Resource> res, ResourceInfo::LoadType load_type, const HashMap<String, String> &prop_map) {
719 if (res.is_null()) {
720 ERR_FAIL_V_MSG(Ref<Resource>(), "Failed to cast material to object: " + mr->get_path());
721 }
722 List<PropertyInfo> property_info;
723 mr->get_property_list(&property_info);
724 for (auto &property : property_info) {
725 bool is_storage = property.usage & PROPERTY_USAGE_STORAGE;
726 // if (property.usage & PROPERTY_USAGE_STORAGE) {
727 if (property.name == "resource_path") {
728 res->set_path_cache(mr->get(property.name));
729 } else if (is_storage) {
730 Ref<MissingResource> m_res = mr->get(property.name);
731 const String &set_prop = prop_map.has(property.name) ? prop_map[property.name] : property.name;
732 if (m_res.is_valid()) {
733 res->set(set_prop, get_real_from_missing_resource(m_res, load_type));
734 } else {
735 res->set(set_prop, mr->get(property.name));
736 }
737 } else {
738 // WARN_PRINT("Property " + property.name + " is not storage");
739 }
740 // }
741 }
742 res->set_path_cache(mr->get_path());
743 return res;
744}
745
746bool ResourceCompatConverter::is_external_resource(Ref<MissingResource> mr) {
747 if (mr.is_null()) {

Callers

nothing calls this directly

Calls 5

get_property_listMethod · 0.80
setMethod · 0.80
get_pathMethod · 0.45
getMethod · 0.45
is_validMethod · 0.45

Tested by

no test coverage detected