Godot Engine – Multi-platform 2D and 3D game engine
Expose `ResourceLoader::get_resource_type` to scripting
Chris Cranford3f0e3c85a742
diff --git a/core/core_bind.cpp b/core/core_bind.cppindex ef55210d61f..72a57476c74 100644--- a/core/core_bind.cpp+++ b/core/core_bind.cpp@@ -138,6 +138,10 @@ ResourceUID::ID ResourceLoader::get_resource_uid(const String &p_path) {return ::ResourceLoader::get_resource_uid(p_path);}+String ResourceLoader::get_resource_type(const String &p_path) {+ return ::ResourceLoader::get_resource_type(p_path);+}+Vector<String> ResourceLoader::list_directory(const String &p_directory) {return ::ResourceLoader::list_directory(p_directory);}@@ -157,6 +161,7 @@ void ResourceLoader::_bind_methods() {ClassDB::bind_method(D_METHOD("get_cached_ref", "path"), &ResourceLoader::get_cached_ref);ClassDB::bind_method(D_METHOD("exists", "path", "type_hint"), &ResourceLoader::exists, DEFVAL(""));ClassDB::bind_method(D_METHOD("get_resource_uid", "path"), &ResourceLoader::get_resource_uid);+ ClassDB::bind_method(D_METHOD("get_resource_type", "path"), &ResourceLoader::get_resource_type);ClassDB::bind_method(D_METHOD("list_directory", "directory_path"), &ResourceLoader::list_directory);BIND_ENUM_CONSTANT(THREAD_LOAD_INVALID_RESOURCE);diff --git a/core/core_bind.h b/core/core_bind.hindex ad138a4a28d..b71a1d50901 100644--- a/core/core_bind.h+++ b/core/core_bind.h@@ -84,6 +84,7 @@ public:Ref<Resource> get_cached_ref(const String &p_path);bool exists(const String &p_path, const String &p_type_hint = "");ResourceUID::ID get_resource_uid(const String &p_path);+ String get_resource_type(const String &p_path);Vector<String> list_directory(const String &p_directory);diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xmlindex c3f9de48bce..5c2e06e3a13 100644--- a/doc/classes/ResourceLoader.xml+++ b/doc/classes/ResourceLoader.xml@@ -64,6 +64,13 @@Returns the list of recognized extensions for a resource type.</description></method>+ <method name="get_resource_type">+ <return type="String" />+ <param index="0" name="path" type="String" />+ <description>+ Returns the resource type associated with a given resource path.+ </description>+ </method><method name="get_resource_uid"><return type="int" /><param index="0" name="path" type="String" />