Godot: Trying to "get_plugin_name" triggers an error

Created on 11 Feb 2019  路  6Comments  路  Source: godotengine/godot

Godot version: 3.1.beta3.official

OS/device including version: Solus 3.9999

Issue description:

image

In the documentation there is a method EditorPlugin.get_plugin_name() -> String but trying to call said method returns:

image

Invalid call. Nonexistent function 'get_plugin_name' in base 'EditorPlugin (plugin.gd)'

Steps to reproduce:

  • Create an EditorPlugin
  • In the plugin script call get_plugin_name

Minimal reproduction project:

plugin usability

Most helpful comment

That's quite confusing... how can get_plugin_name be expected to have a script implementation when you need that same name even before activating the plugin, to show it in the list? It's even one of the fields in plugin.cfg, surely Godot knows that name without requiring to write it again in code?

All 6 comments

It's a virtual method, it means you have to implement it in the script.

Ohh, my bad, sorry.

But isn't that weird? I think this method should always return the String with the plugin's folder name, no?

That's quite confusing... how can get_plugin_name be expected to have a script implementation when you need that same name even before activating the plugin, to show it in the list? It's even one of the fields in plugin.cfg, surely Godot knows that name without requiring to write it again in code?

Yeah I really don't see a reason for it to be virtual. What would be the use case for a script implementation, i.e. override, of this method?

I know a use case: when you want your plugin to be added with the "main editors" ie:
image
the return of get_plugin_name is used to display a custom name into the ToolButton.
I don't know if there's another one.

@Overblob if that's the case, it adds to the inconsistency in the way things are named^^" (also that means a plugin cannot have two main screens which sounds quite an arbitrary design decision, hard to guess that from the API)

Was this page helpful?
0 / 5 - 0 ratings