mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Added function ResourceLoader.exists(), to check if a resource exists. Closes #19140
This commit is contained in:
@@ -112,11 +112,15 @@ PoolStringArray _ResourceLoader::get_dependencies(const String &p_path) {
|
||||
return ret;
|
||||
};
|
||||
|
||||
bool _ResourceLoader::has(const String &p_path) {
|
||||
bool _ResourceLoader::has_cached(const String &p_path) {
|
||||
|
||||
String local_path = ProjectSettings::get_singleton()->localize_path(p_path);
|
||||
return ResourceCache::has(local_path);
|
||||
};
|
||||
}
|
||||
|
||||
bool _ResourceLoader::exists(const String &p_path, const String &p_type_hint) {
|
||||
return ResourceLoader::exists(p_path, p_type_hint);
|
||||
}
|
||||
|
||||
void _ResourceLoader::_bind_methods() {
|
||||
|
||||
@@ -125,7 +129,8 @@ void _ResourceLoader::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_recognized_extensions_for_type", "type"), &_ResourceLoader::get_recognized_extensions_for_type);
|
||||
ClassDB::bind_method(D_METHOD("set_abort_on_missing_resources", "abort"), &_ResourceLoader::set_abort_on_missing_resources);
|
||||
ClassDB::bind_method(D_METHOD("get_dependencies", "path"), &_ResourceLoader::get_dependencies);
|
||||
ClassDB::bind_method(D_METHOD("has", "path"), &_ResourceLoader::has);
|
||||
ClassDB::bind_method(D_METHOD("has_cached", "path"), &_ResourceLoader::has_cached);
|
||||
ClassDB::bind_method(D_METHOD("exists", "path", "type_hint"), &_ResourceLoader::exists, DEFVAL(""));
|
||||
}
|
||||
|
||||
_ResourceLoader::_ResourceLoader() {
|
||||
|
||||
Reference in New Issue
Block a user