Skip to content

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Aug 18, 2025

Follow-up to #99639
Makes the plugin accessible without using undocumented hacks.

@KoBeWi KoBeWi added this to the 4.x milestone Aug 18, 2025
@KoBeWi KoBeWi requested review from a team as code owners August 18, 2025 17:36
@badsectoracula
Copy link
Contributor

I modified the MRP from #99639 to use the name and it works fine. It is basically almost what i had in mind when i wrote that comment about a more convenient API. However i think the EditorInterface::get_editor_plugin method should just return null if it fails instead of creating an error so that it can be used to check the existence of a plugin in addition to providing its object - this can allow plugins to use other plugins as optional dependencies without errors (an alternative could be to add a has_editor_plugin method or something to that extent but i think the single method is better - though it could be renamed to find_editor_plugin instead so that its behavior is a bit more obvious and consistent with, e.g., Node::find_child which also returns null if a child is not found).

As a hypothetical example, a script that generates decal-like meshes from splines for roads, stripes, etc to be placed against the environment could also have optional dependencies on one or more terrain plugins that expose functionality to modify the terrain so that it can also provide UI to adjust the terrain to "match" the generated mesh but without having a hard dependency on any of them (e.g. one could use it just fine for urban environments, environments with a custom terrain system or environments whose terrain was made externally).

In any case, the following ZIP contains the MRP with the gridmap replacer script code modified to use get_editor_plugin and expose a name for itself and a second editor plugin that uses get_editor_plugin to access a function in the gridmap replacer script.

gridmap-editor-scripting-test-with-editor-name.zip

@KoBeWi
Copy link
Member Author

KoBeWi commented Sep 9, 2025

I removed the error.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants