I have figured out that extending/customizing the editor toolbar in UE4 sucks.
Why does it suck?
- Limited and undocumented API for working with the toolbars
- Lots of shit is hardcoded c++ and can't be extended without recompiles.
- The straightforward method to add things work, but...
- There are extension hooks that can insert things
- There are dynamic entries which insert things
- The model is convoluted and can't be controlled
Ok, so what is the model?
There are
- Menus - These can contain entries of sorts
- Sections - A grouping within a menu
- Entries - Like a button or menu-entry
A simplified model would be
-
name: File
sections:
-
name: Saves and stuff
entries:
- New
- Save
- Load
-
name: Quit
entries:
- Restart
- Quit
This is the 'source' model, which is copied and extended as it is turned into UI elements.
Extensions and turning into UI
An extension or hook can be triggered with information like File.New
and decide to add it's own entry File.NewFromTemplate
.
This makes it impossible to adjust the original model to remove such extensions without removing File.New
.
There are also dynamic sections (or entries?) which are invoked during UI-model-preparation. I kind of understand these, since one might want to hide buttons or entries depending on the environment (available compilers, etc etc).
Though this seems like a redundant feature and system, when one could instead extend the entries themselves with callbacks to determine whether they should be visible or enabled instead. 🤔
UE4 menu customization
In 4.26 it seems that an experimental menu editing feature was added. The only documentation is some bloke mentioning it in a twitter thread. It works by doing a post-process of the assembled model (after dynamics, but before hooks?). It can do visibility overrides, and even reorder entries.
It can still not deal with entries added by hooks, which severly limits the usability.
The feature is incomplete, in 4.26.2 at least. There is an embryo of implementing a save to the per-project-user-settings, but it has no effect.
Overall verdict?
There are some methods which are clearly implemented to extend the system a tiny bit for BPs and python. But what good is that when the overall toolbars can't be controlled and there is limited pixel real estate?
The effect is exacerbated by the UI design in the editor itself, as one can only choose between ridiculously large toolbar buttons, or tiny buttons without help.
You know what's an easier solution?
- Make a dockable widget
- Add buttons to it
- Dock it
- Hide the tab
- Boom! 💣💥 (haha) - Now you've got a better toolbar that is easier to work with and extend than the toolbar from Epic 😒
References
- Emperor of Wisdom - ToolMenuEntryScript
Chronological (or something ¯\_(ツ)_/¯ )
- Next: UE4 Notes
- Prev: Things to print
- Next: UE4 Notes