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

Method _set_resource_info

compat/script_loader.cpp:95–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93// void _set_resource_info(Ref<ResourceInfo> &info, const String &p_path) const;
94
95Error ResourceFormatGDScriptLoader::_set_resource_info(Ref<ResourceInfo> &info, const String &p_path) {
96 info->type = _get_resource_type(p_path);
97 if (info->type == "") {
98 return ERR_FILE_UNRECOGNIZED;
99 }
100 String extension = p_path.get_extension().to_lower();
101 auto rev = GDRESettings::get_singleton()->get_bytecode_revision();
102 if (rev) {
103 auto decomp = GDScriptDecomp::create_decomp_for_commit(rev);
104 if (decomp.is_valid()) {
105 Ref<GodotVer> ver = decomp->get_godot_ver();
106 if (ver.is_valid() && ver->is_valid_semver()) {
107 info->ver_major = ver->get_major();
108 info->ver_minor = ver->get_minor();
109 }
110 info->ver_format = decomp->get_bytecode_version();
111 }
112 }
113 if (extension == "gd") {
114 info->resource_format = "GDScriptText";
115 } else if (extension == "gdc" || extension == "gde") {
116 info->resource_format = "GDScriptBytecode";
117 } else if (extension == "cs") {
118 info->resource_format = "CSharpScriptText";
119 } else {
120 info->resource_format = "GDScriptText";
121 }
122 return OK;
123}
124
125// for embedded scripts
126Ref<Resource> FakeScriptConverterCompat::convert(const Ref<MissingResource> &res, ResourceInfo::LoadType p_type, int ver_major, Error *r_error) {

Callers

nothing calls this directly

Calls 7

get_bytecode_revisionMethod · 0.80
get_godot_verMethod · 0.80
is_valid_semverMethod · 0.80
get_majorMethod · 0.80
get_minorMethod · 0.80
is_validMethod · 0.45
get_bytecode_versionMethod · 0.45

Tested by

no test coverage detected