diff options
author | David Snopek <dsnopek@gmail.com> | 2023-05-11 16:46:53 -0500 |
---|---|---|
committer | David Snopek <dsnopek@gmail.com> | 2023-05-25 09:14:29 -0500 |
commit | 300716321072c719dc5c3f8a19126fe753747a60 (patch) | |
tree | 1c10336faff8a53cc872e01f335a05157db2e878 /editor/editor_data.cpp | |
parent | 809a98216267f3066b9fec2f02b2042bdc9d3e0d (diff) | |
download | redot-engine-300716321072c719dc5c3f8a19126fe753747a60.tar.gz |
Allow GDExtensions to add editor plugins
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 5d3037b4ec..596a2dfac1 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -485,6 +485,24 @@ EditorPlugin *EditorData::get_editor_plugin(int p_idx) { return editor_plugins[p_idx]; } +void EditorData::add_extension_editor_plugin(const StringName &p_class_name, EditorPlugin *p_plugin) { + ERR_FAIL_COND(extension_editor_plugins.has(p_class_name)); + extension_editor_plugins.insert(p_class_name, p_plugin); +} + +void EditorData::remove_extension_editor_plugin(const StringName &p_class_name) { + extension_editor_plugins.erase(p_class_name); +} + +bool EditorData::has_extension_editor_plugin(const StringName &p_class_name) { + return extension_editor_plugins.has(p_class_name); +} + +EditorPlugin *EditorData::get_extension_editor_plugin(const StringName &p_class_name) { + EditorPlugin **plugin = extension_editor_plugins.getptr(p_class_name); + return plugin == nullptr ? nullptr : *plugin; +} + void EditorData::add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon) { ERR_FAIL_COND_MSG(p_script.is_null(), "It's not a reference to a valid Script object."); CustomType ct; |