Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_plugin_enabled seems not to work as expected #92074

Closed
donn-xx opened this issue May 18, 2024 · 2 comments
Closed

is_plugin_enabled seems not to work as expected #92074

donn-xx opened this issue May 18, 2024 · 2 comments

Comments

@donn-xx
Copy link

donn-xx commented May 18, 2024

Tested versions

v4.3.dev.custom_build [29b3d9e]

System information

Godot v4.3.dev (29b3d9e) - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (nvidia; 535.171.04) - Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz (6 Threads)

Issue description

These files exist:
res://addons/resource_wrangler
res://addons/resource_wrangler/plugin.cfg

The plugin is also enabled in Settings.

This line:

print( EditorInterface.is_plugin_enabled("resource_wrangler" ))

prints false

Looking at the source:

return EditorNode::get_singleton()->is_addon_plugin_enabled(p_plugin);

bool EditorInterface::is_plugin_enabled(const String &p_plugin) const {
	return EditorNode::get_singleton()->is_addon_plugin_enabled(p_plugin);
}

Leads to:
https://github.com/godotengine/godot/blob/master/editor/editor_node.cpp#L3662

bool EditorNode::is_addon_plugin_enabled(const String &p_addon) const {
	if (p_addon.begins_with("res://")) {
		return addon_name_to_plugin.has(p_addon);
	}

	return addon_name_to_plugin.has("res://addons/" + p_addon + "/plugin.cfg");
}

Which seems that at least the file path comparison should return true. (Which is seems not to?) But how does any of that confirm whether the plugin is actually enabled?

Steps to reproduce

All as above.

Minimal reproduction project (MRP)

All as above.

@tracefree
Copy link

Hi! So the way this is supposed to work is that addon_name_to_plugin is a HashMap that uses the path to the plugin.cfg as a key and the corresponding EditorPlugin instance as a value for enabled plugins. So the question is why does your plugin not get added to addon_name_to_plugin when you enable the plugin in the project settings. The function works as expected for my own plugin, can you maybe upload an MRP?

@donn-xx
Copy link
Author

donn-xx commented May 22, 2024

Well... Damn. It works now. I guess it's a Nothing Burger made from Heisenbugs. Sorry everyone and thanks trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants