diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-21 16:54:23 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-21 16:54:23 +0100 |
commit | ebd0b40f6ec2c1db17fa0561f5a3403913032c3b (patch) | |
tree | 57e6fdab1358325977c1ed326af2ff5ad89d353c /core/io/resource_loader.cpp | |
parent | 5551eed499efebd97875a7f3fc4ef57fd23e8d1d (diff) | |
parent | dddd8d43f618874642a228800187fb0912c46c20 (diff) | |
download | redot-engine-ebd0b40f6ec2c1db17fa0561f5a3403913032c3b.tar.gz |
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
Diffstat (limited to 'core/io/resource_loader.cpp')
-rw-r--r-- | core/io/resource_loader.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 68b9f8b6f7..7447119ab7 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -99,6 +99,12 @@ String ResourceFormatLoader::get_resource_type(const String &p_path) const { return ret; } +String ResourceFormatLoader::get_resource_script_class(const String &p_path) const { + String ret; + GDVIRTUAL_CALL(_get_resource_script_class, p_path, ret); + return ret; +} + ResourceUID::ID ResourceFormatLoader::get_resource_uid(const String &p_path) const { int64_t uid = ResourceUID::INVALID_ID; GDVIRTUAL_CALL(_get_resource_uid, p_path, uid); @@ -184,6 +190,7 @@ void ResourceFormatLoader::_bind_methods() { GDVIRTUAL_BIND(_recognize_path, "path", "type"); GDVIRTUAL_BIND(_handles_type, "type"); GDVIRTUAL_BIND(_get_resource_type, "path"); + GDVIRTUAL_BIND(_get_resource_script_class, "path"); GDVIRTUAL_BIND(_get_resource_uid, "path"); GDVIRTUAL_BIND(_get_dependencies, "path", "add_types"); GDVIRTUAL_BIND(_rename_dependencies, "path", "renames"); @@ -764,6 +771,19 @@ String ResourceLoader::get_resource_type(const String &p_path) { return ""; } +String ResourceLoader::get_resource_script_class(const String &p_path) { + String local_path = _validate_local_path(p_path); + + for (int i = 0; i < loader_count; i++) { + String result = loader[i]->get_resource_script_class(local_path); + if (!result.is_empty()) { + return result; + } + } + + return ""; +} + ResourceUID::ID ResourceLoader::get_resource_uid(const String &p_path) { String local_path = _validate_local_path(p_path); |