godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.1k stars 69 forks source link

Add `EditorInterface` `plugin_enabled` and `plugin_disabled` signals #2104

Open me2beats opened 3 years ago

me2beats commented 3 years ago

Describe the project you are working on

Plugins

Describe the problem or limitation you are having in your project

I'm going to write a series of plugins that do something when a certain plugin X becomes active or inactive.

The problem is I can't seem to do it in an efficient way.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Adding plugin_enabled and plugin_disabled signals would solve the problem.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

plugin_name:String plugin_enabled
plugin_name:String plugin_disabled

If this enhancement will not be used often, can it be worked around with a few lines of script?

This would be inefficient

Is there a reason why this should be core and not an add-on in the asset library?

These signals could be used by the engine itself as well.

Zylann commented 3 years ago

In a use case like this it should be combined with a way to query wich plugin is enabled, as some plugins may already be enabled when Godot starts or when the plugin starts, and doing this solely with signals would suffer from execution order.