Merge pull request #91337 from KoBeWi/unhack_addons

Rework global class hiding in addons
This commit is contained in:
Rémi Verschelde 2024-06-26 11:08:21 +02:00
commit 2d22dfab4a
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -160,8 +160,13 @@ bool CreateDialog::_should_hide_type(const StringName &p_type) const {
String script_path = ScriptServer::get_global_class_path(p_type);
if (script_path.begins_with("res://addons/")) {
if (!EditorNode::get_singleton()->is_addon_plugin_enabled(script_path.get_slicec('/', 3))) {
return true; // Plugin is not enabled.
int i = script_path.find("/", 13); // 13 is length of "res://addons/".
while (i > -1) {
const String plugin_path = script_path.substr(0, i).path_join("plugin.cfg");
if (FileAccess::exists(plugin_path)) {
return !EditorNode::get_singleton()->is_addon_plugin_enabled(plugin_path);
}
i = script_path.find("/", i + 1);
}
}
}