void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const { if (p_type == "") { return get_recognized_extensions(p_extensions); } Set<String> found; for (int i = 0; i < importers.size(); i++) { String res_type = importers[i]->get_resource_type(); if (res_type == String()) continue; if (!ClassDB::is_parent_class(res_type, p_type)) continue; List<String> local_exts; importers[i]->get_recognized_extensions(&local_exts); for (List<String>::Element *F = local_exts.front(); F; F = F->next()) { if (!found.has(F->get())) { p_extensions->push_back(F->get()); found.insert(F->get()); } } } }
bool ImageFormatLoader::recognize(const String &p_extension) const { List<String> extensions; get_recognized_extensions(&extensions); for (List<String>::Element *E = extensions.front(); E; E = E->next()) { if (E->get().nocasecmp_to(p_extension.get_extension()) == 0) return true; } return false; }
void ResourceFormatLoaderText::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const { if (p_type=="") { get_recognized_extensions(p_extensions); return; } if (p_type=="PackedScene") p_extensions->push_back("tscn"); else p_extensions->push_back("tres"); }
bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_for_type) const { String extension = p_path.get_extension(); List<String> extensions; if (p_for_type == String()) { get_recognized_extensions(&extensions); } else { get_recognized_extensions_for_type(p_for_type, &extensions); } for (List<String>::Element *E = extensions.front(); E; E = E->next()) { if (E->get().nocasecmp_to(extension) == 0) return true; } return false; }
void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const { if (p_type=="") { get_recognized_extensions(p_extensions); return; } List<String> extensions; ObjectTypeDB::get_extensions_for_type(p_type,&extensions); extensions.sort(); for(List<String>::Element *E=extensions.front();E;E=E->next()) { String ext = E->get().to_lower(); if (ext=="res") continue; // p_extensions->push_back("x"+ext); p_extensions->push_back(ext); } p_extensions->push_back("res"); }
void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const { if (p_type == "" || handles_type(p_type)) get_recognized_extensions(p_extensions); }