| 1258 | return resource; |
| 1259 | } |
| 1260 | Error ResourceInteractiveLoaderXML::poll() { |
| 1261 | if (error != OK) |
| 1262 | return error; |
| 1263 | |
| 1264 | bool exit; |
| 1265 | Tag *tag = parse_tag(&exit); |
| 1266 | |
| 1267 | if (!tag) { |
| 1268 | error = ERR_FILE_CORRUPT; |
| 1269 | if (!exit) { // shouldn't have exited |
| 1270 | ERR_FAIL_V(error); |
| 1271 | } |
| 1272 | error = ERR_FILE_EOF; |
| 1273 | return error; |
| 1274 | } |
| 1275 | |
| 1276 | Ref<Resource> res; |
| 1277 | //Object *obj=NULL; |
| 1278 | |
| 1279 | bool main; |
| 1280 | |
| 1281 | if (tag->name == "ext_resource") { |
| 1282 | error = ERR_FILE_CORRUPT; |
| 1283 | ERR_FAIL_COND_V_MSG(!tag->args.has("path"), ERR_FILE_CORRUPT, local_path + ":" + itos(get_current_line()) + ": <ext_resource> missing 'path' field."); |
| 1284 | |
| 1285 | String type = "Resource"; |
| 1286 | if (tag->args.has("type")) |
| 1287 | type = tag->args["type"]; |
| 1288 | |
| 1289 | String path = tag->args["path"]; |
| 1290 | |
| 1291 | ERR_FAIL_COND_V_MSG(path.begins_with("local://"), ERR_FILE_CORRUPT, local_path + ":" + itos(get_current_line()) + ": <ext_resource> can't use a local path, this is a bug?."); |
| 1292 | |
| 1293 | if (path.find("://") == -1 && path.is_relative_path()) { |
| 1294 | // path is relative to file being loaded, so convert to a resource path |
| 1295 | path = GDRESettings::get_singleton()->localize_path(local_path.get_base_dir().path_join(path)); |
| 1296 | } |
| 1297 | |
| 1298 | if (remaps.has(path)) { |
| 1299 | path = remaps[path]; |
| 1300 | } |
| 1301 | |
| 1302 | int er_idx = tag->args.has("index") ? tag->args["index"].to_int() : -1; |
| 1303 | |
| 1304 | Ref<Resource> res = load_external_resource(path, type, er_idx); |
| 1305 | |
| 1306 | if (res.is_null()) { |
| 1307 | if (ResourceLoader::get_abort_on_missing_resources()) { |
| 1308 | ERR_FAIL_V_MSG(error, local_path + ":" + itos(get_current_line()) + ": <ext_resource> referenced nonexistent resource at: " + path); |
| 1309 | } else { |
| 1310 | ResourceLoader::notify_dependency_error(local_path, path, type); |
| 1311 | } |
| 1312 | } else { |
| 1313 | resource_cache.push_back(res); |
| 1314 | } |
| 1315 | |
| 1316 | if (tag->args.has("index")) { |
| 1317 | ExtResource er; |
no test coverage detected