Godot Editor addon considerations
I know a thing or two about making an editor addon for the Godot Engine.
Over the course of building Dialogue Manager (and then rebuilding it for Godot 4) and Puzzle Dependencies (and rebuilding it for Godot 4) I learnt a lot about what makes for a friendly guest within the editor.
This list is mostly for me as a reminder of the things I've come across but it might be useful to other addon developers so here it is.
Theming
Don't hardcode colours. You don't know what the user's editor looks like so what looks fine to you might be a mess for someone else. Instead, draw colours from the editor theme or the editor settings.
For example, Dialogue Manager draws it's syntax highlighting colours from Godot's script editor colour settings.
When making the tab icon, remember to set up the auto-scaling and colouring.
Using the right colours inside the SVG isn't enough to trigger the auto-colour switching, however.
If you set the fill
of the object to #E0E0E0
then it will automatically change that to a dark colour when using
a light theme.
Scale
Don't assume the editor is scaled is 1.0. Higher density screens will most likely have an editor scale of 1.5 or 2.0 so sizes and positions of things should be multiplied by it to get the correct values.
For example, Puzzle Dependencies takes the editor scale into account when laying out it's node graph.
Undo/redo
For most things this might just work without you having to do anything. For more complicated things, you should ensure that the user can undo their accidents when using your addon.
For example, Puzzle Dependencies hooks into Godot's UndoRedoManager to make graph actions undoable.
Storing configuration
Where are your files stored? If it's something that should live in source control then think about adding it to the project settings. If
not, then a simple JSON file can be stored outside of the project in the user://
directory.
Frictionless updating
Make sure your addon follows semantic versioning. If a new version is going to break everything then bump the major version. The minor version is for incremental changes and the patch version is for bugfixes.
You might also want to think about notifying your users when a new version has been published.
It's also possible to download and install new versions of your addon without leaving the editor.