Skip to content

Commit

Permalink
Rework global class hiding in addons
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Jun 25, 2024
1 parent 6b281c0 commit 5f695f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 5f695f0

Please sign in to comment.