summaryrefslogtreecommitdiffstats
path: root/core/extension/gdextension_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/extension/gdextension_manager.cpp')
-rw-r--r--core/extension/gdextension_manager.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/extension/gdextension_manager.cpp b/core/extension/gdextension_manager.cpp
index 8701e6d77b..63e809bc7c 100644
--- a/core/extension/gdextension_manager.cpp
+++ b/core/extension/gdextension_manager.cpp
@@ -50,6 +50,11 @@ GDExtensionManager::LoadStatus GDExtensionManager::load_extension(const String &
extension->initialize_library(GDExtension::InitializationLevel(i));
}
}
+
+ for (const KeyValue<String, String> &kv : extension->class_icon_paths) {
+ gdextension_class_icon_paths[kv.key] = kv.value;
+ }
+
gdextension_map[p_path] = extension;
return LOAD_STATUS_OK;
}
@@ -74,6 +79,11 @@ GDExtensionManager::LoadStatus GDExtensionManager::unload_extension(const String
extension->deinitialize_library(GDExtension::InitializationLevel(i));
}
}
+
+ for (const KeyValue<String, String> &kv : extension->class_icon_paths) {
+ gdextension_class_icon_paths.erase(kv.key);
+ }
+
gdextension_map.erase(p_path);
return LOAD_STATUS_OK;
}
@@ -95,6 +105,19 @@ Ref<GDExtension> GDExtensionManager::get_extension(const String &p_path) {
return E->value;
}
+bool GDExtensionManager::class_has_icon_path(const String &p_class) const {
+ // TODO: Check that the icon belongs to a registered class somehow.
+ return gdextension_class_icon_paths.has(p_class);
+}
+
+String GDExtensionManager::class_get_icon_path(const String &p_class) const {
+ // TODO: Check that the icon belongs to a registered class somehow.
+ if (gdextension_class_icon_paths.has(p_class)) {
+ return gdextension_class_icon_paths[p_class];
+ }
+ return "";
+}
+
void GDExtensionManager::initialize_extensions(GDExtension::InitializationLevel p_level) {
ERR_FAIL_COND(int32_t(p_level) - 1 != level);
for (KeyValue<String, Ref<GDExtension>> &E : gdextension_map) {