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

Method convert

compat/texture_loader_compat.cpp:774–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772}
773
774Ref<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
807void ResourceFormatLoaderCompatTexture2D::get_recognized_extensions(List<String> *p_extensions) const {

Callers 1

Calls 13

merge_resource_infoFunction · 0.85
set_on_resourceMethod · 0.80
set_nameMethod · 0.80
get_original_classMethod · 0.80
get_sizeMethod · 0.80
push_backMethod · 0.80
is_validMethod · 0.45
getMethod · 0.45
get_typeMethod · 0.45
handles_typeMethod · 0.45
get_pathMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected