How to add a Button likes AllowEditsModeEntry on the tool bar of the sequencer?
I want to add a button which switches some mode to preview sequence.
(This mode is implemented in our project)
Therefore, I attempted to add a button displaying the current mode by its icon and enabling mode changes through its submenu, just like the AllowEditsModeEntry button.
I constructed my button using the Editor Utility Tool Menu Entries, but it didn’t behave as I wanted it to.
I overrode GetIcon function of my main button to display the current mode switching some icons and placed sub menues for setting each mode as the child entries of my main button.
However, it seems that a button enabled “Is Sub Menu” or “Open Sub Menu on Click” can place sub menues as child entries but do not do any events like GetIcon.
Conversely, a button disabled “Is Sub Menu” and "Open Sub Menu on Click" enables to display dinamically icons according to the GetIcon implementation but can not have any sub menues.
Is there any way to construct a button which can be override functions and have submenues?
Ideally, I believe implementing this in Blueprint would be best.
We anticipate adding several more buttons like this in the future, and using Blueprint function calls would allow us to avoid worrying too much about dependencies between modules.
If it’s in C++, I’d prefer a reusable implementation so that future button additions can be handled entirely within Blueprint.
At worst, I think we’ll have to implement like Section.AddEntry(AllowEditsModeEntry) in SSequencer::PopulateToolBar every time a button is added.
If there’s a better approach, I’d appreciate your help.
Before digging in, would you prefer that I implement this solution in C++, or do you want everything done in Blueprint? I’m not entirely sure if there are any limitations on the Blueprint side, so I’ll need to check that. With C++, this can definitely be achieved.
I’ll look into the possibilities of doing it in Blueprint as well, but if you’re okay with using C++, that would probably be the most reliable approach.
From what I see, you manually constructed the button by providing all the required data to fill the FToolMenuEntry information and creating the menu yourself by calling AddMenuEntry.
In my opinion, this should already be available in the engine — I don’t see a reason why this type of widget shouldn’t be able to override its icon. I just tested it myself, and you’re right: the icon doesn’t override no matter what the GetIcon function returns. It looks like that override isn’t being called at all.
There’s probably an issue in the internal engine code where the GetIcon override isn’t checked. The ToolMenus interface module is great for achieving quick results and extending the Unreal Editor’s functionality, but for full control, some C++ implementation may still be required — just as you did in your case.
If you run into any issues with your implementation in the future, feel free to reopen this thread so we can continue the discussion.
I’ll also leave the steps here for anyone else who needs to extend the Sequencer Main Toolbar:
Steps to Extend the Sequencer Main Toolbar
1- Create an EditorUtilityToolMenuEntry Blueprint: This will define the information for the button you want to add to the Sequencer toolbar.
2- Set the Target Menu: In the Class Defaults, set Data → Menu to Sequencer.MainToolBar. This specifies that your entry will extend the Sequencer toolbar section.
3- Define a Section: Set your own section name (e.g., MySection) and fill in any additional data you need.
4- Create the Main Combo Button: To generate an “AllowEditsModeEntry”-type button, the first button must be of type ToolBarComboButton, so that we can expand it and add new menu entries when the main button is pressed.
5- Add Submenu Entries: Create another EditorUtilityToolMenuEntry Blueprint. Set Data → Menu to Sequencer.MainToolBar.MySection. This adds your new entry inside the previously created button. Set Entry Type to Menu Entry and User Interface Action Type to Radio Button.
6- Register the entries: In your initialization logic, find all the created classes, construct them, and call AddMenuEntryObject() on the constructed objects.
[Image Removed]
7- Manage checked entries: To save which Radial Button is checked that needs to be managed individualy. Override the GetCheckState function is update the value when neeeded. If you want to store the value when it is pressed, update the value then the button is clicked and the Event Execute triggers.