| 349 | } |
| 350 | |
| 351 | Ref<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 | |
| 373 | String ImportInfoModern::get_type() const { |
| 374 | return cf->get_value("remap", "type", ""); |
nothing calls this directly
no test coverage detected