| 772 | } |
| 773 | |
| 774 | Ref<Resource> ResourceConverterTexture2D::convert(const Ref<MissingResource> &res, ResourceInfo::LoadType p_type, int ver_major, Error *r_error) { |
| 775 | String name; |
| 776 | Ref<Resource> texture; |
| 777 | |
| 778 | if (p_type == ResourceInfo::LoadType::NON_GLOBAL_LOAD) { |
| 779 | return res; |
| 780 | } |
| 781 | auto info = ResourceInfo::get_info_from_resource(res); |
| 782 | ERR_FAIL_COND_V_MSG(!info.is_valid(), res, "Missing resource has no compat metadata??????????? This should have been set by the missing resource instance function(s)!!!!!!!!"); |
| 783 | String type = info->type; |
| 784 | int flags = res->get("flags"); |
| 785 | String load_path = res->get("load_path"); |
| 786 | if (res->get("load_path").get_type() == Variant::NIL) { |
| 787 | auto compressed_texture = Ref<CompressedTexture2D>(memnew(CompressedTexture2D)); |
| 788 | info->set_on_resource(compressed_texture); |
| 789 | return compressed_texture; |
| 790 | } |
| 791 | if (p_type == ResourceInfo::GLTF_LOAD || p_type == ResourceInfo::REAL_LOAD) { |
| 792 | texture = ResourceCompatLoader::custom_load(load_path, type, p_type, r_error, false, ResourceFormatLoader::CACHE_MODE_IGNORE); |
| 793 | } |
| 794 | ERR_FAIL_COND_V_MSG(texture.is_null(), res, "Failed to load texture " + load_path); |
| 795 | Ref<ResourceInfo> existing_dict = ResourceInfo::get_info_from_resource(texture); |
| 796 | if (existing_dict.is_valid()) { |
| 797 | existing_dict = merge_resource_info(existing_dict, info, flags); |
| 798 | existing_dict->set_on_resource(texture); |
| 799 | } else { |
| 800 | WARN_PRINT("ResourceInfo is not valid for MissingResource?!?!1!!!!!1111!"); |
| 801 | info->set_on_resource(texture); |
| 802 | } |
| 803 | return texture; |
| 804 | } |
| 805 | |
| 806 | // get recognized extensions |
| 807 | void ResourceFormatLoaderCompatTexture2D::get_recognized_extensions(List<String> *p_extensions) const { |
no test coverage detected