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

Method convert

compat/script_loader.cpp:126–161  ·  view source on GitHub ↗

for embedded scripts

Source from the content-addressed store, hash-verified

124
125// for embedded scripts
126Ref<Resource> FakeScriptConverterCompat::convert(const Ref<MissingResource> &res, ResourceInfo::LoadType p_type, int ver_major, Error *r_error) {
127 Ref<FakeScript> fake_script;
128 auto resource_info = ResourceInfo::get_info_from_resource(res);
129 if (res->get_original_class() != "GDScript" && res->get_original_class() != "CSharpScript") {
130 fake_script.instantiate();
131 fake_script->set_original_class(res->get_original_class());
132 fake_script->set_load_type(p_type);
133 set_real_from_missing_resource(res, fake_script, p_type);
134 } else {
135 if (res->get_original_class() == "GDScript") {
136 Ref<FakeGDScript> fake_gd_script;
137 fake_gd_script.instantiate();
138 fake_script = fake_gd_script;
139 } else if (res->get_original_class() == "CSharpScript") {
140 Ref<FakeCSharpScript> fake_csharp_script;
141 fake_csharp_script.instantiate();
142 fake_script = fake_csharp_script;
143 }
144 fake_script->set_load_type(p_type);
145 String path = res->get_path();
146 if (path.is_empty()) {
147 if (resource_info.is_valid()) {
148 path = resource_info->original_path;
149 }
150 }
151 fake_script->set_original_class(res->get_original_class());
152 if (is_external_resource(res) && p_type != ResourceInfo::LoadType::FAKE_LOAD && p_type != ResourceInfo::LoadType::NON_GLOBAL_LOAD) {
153 fake_script->load_source_code(path);
154 } else {
155 set_real_from_missing_resource(res, fake_script, p_type);
156 }
157 }
158 // ResourceFormatGDScriptLoader::_set_resource_info(resource_info, path);
159 resource_info->set_on_resource(fake_script);
160 return fake_script;
161}
162
163bool FakeScriptConverterCompat::handles_type(const String &p_type, int ver_major) const {
164 return p_type == "Script" || p_type == "GDScript" || p_type == "CSharpScript";

Callers 12

loadMethod · 0.45
loadMethod · 0.45
decode_variant_3Method · 0.45
decode_variant_2Method · 0.45
save_imageMethod · 0.45
save_image_as_bmpMethod · 0.45
save_image_as_tgaMethod · 0.45
save_image_as_svgMethod · 0.45
save_hdr_bufferFunction · 0.45
_convert_atexMethod · 0.45
preprocess_imagesFunction · 0.45

Calls 7

get_original_classMethod · 0.80
set_load_typeMethod · 0.80
set_on_resourceMethod · 0.80
set_original_classMethod · 0.45
get_pathMethod · 0.45
is_validMethod · 0.45
load_source_codeMethod · 0.45

Tested by

no test coverage detected