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

Method from_json

utility/import_info.cpp:351–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351Ref<ImportInfo> ImportInfo::from_json(const Dictionary &p_json) {
352 Ref<ImportInfo> iinfo;
353 ERR_FAIL_COND_V_MSG(!p_json.has("iitype"), Ref<ImportInfo>(), "ImportInfo: iitype not found in json");
354 ImportInfo::IInfoType iitype = (ImportInfo::IInfoType)p_json["iitype"];
355 if (iitype == ImportInfo::MODERN) {
356 iinfo = Ref<ImportInfo>(memnew(ImportInfoModern));
357 } else if (iitype == ImportInfo::V2) {
358 iinfo = Ref<ImportInfo>(memnew(ImportInfov2));
359 } else if (iitype == ImportInfo::GDEXT) {
360 iinfo = Ref<ImportInfo>(memnew(ImportInfoGDExt));
361 } else if (iitype == ImportInfo::DUMMY) {
362 iinfo = Ref<ImportInfo>(memnew(ImportInfoDummy));
363 } else if (iitype == ImportInfo::REMAP) {
364 iinfo = Ref<ImportInfo>(memnew(ImportInfoRemap));
365 } else {
366 ERR_FAIL_V_MSG(Ref<ImportInfo>(), "ImportInfo: invalid iitype: " + itos(iitype));
367 }
368 ERR_FAIL_COND_V_MSG(!iinfo.is_valid(), Ref<ImportInfo>(), "ImportInfo: could not create import info from json");
369 iinfo->_set_from_json(p_json);
370 return iinfo;
371}
372
373String ImportInfoModern::get_type() const {
374 return cf->get_value("remap", "type", "");

Callers

nothing calls this directly

Calls 2

_set_from_jsonMethod · 0.80
is_validMethod · 0.45

Tested by

no test coverage detected