Customizing the editor's toolbar buttons menu via custom plugin
I want to do a simple experiment for my learning purposes. I want to extend the editor, by adding a new button in the toolbar menu (next to say QuickSettings), and when clicked it just displays a message box. However, this customization should be done via a plugin. I managed to create a "blank" plugin, and working fine. Now I just want to make it extend the editor a bit, by creating a button and its implementation (displaying a message) residing in my plugin.
I've done some research here and wasn't satisfied. So I've done more research, and found something interesting in MultiBox.cpp line 237, which has the ApplyCustomizedBlocks() method. There is this CustomizationData object that probably is what I'm looking for. Yet I'm kind of confused as to how to populate it, and whether or not I'm looking in the right place to begin with.
Could you guys give me any pointers?
So in order to integrate new UI into existing things like the menu bar or the toolbar, you'll need to take advantage of the extension points system, step one you need to turn on showing the existing extension points in the UI. Then restart the editor.
Alright, now we know the extension names given to the different sections of the toolbar. Now we need to inject our toolbar items where we want them.
This part takes some digging, but the easiest way is to figure out who is creating the toolbar. To do that you should use the Widget Reflector. Window > Developer Tools > Widget Reflector.
Now we know the file and line number that created it, so we we click on the file/line in the Widget Reflector to check it out.
Once in that file, we scroll up a little-ways we see where the toolbar is pulling any extenders from.
Ok, so we now know the LevelEditor Module is the one responsible for creating the toolbar, and also provides the actual accessor for adding extensions to it as well. So in your plugin module when you initialize you'll add yourself to the list of extenders for the toolbar.
It would look something like that, your extender's delegate will be called when the toolbar is being created so that you can create whatever widgets you need to appear in the toolbar. Note the importance of the "Settings" string, that's the extension hook we found after turning on show extension points. If there is no extension area with that name your extension will never be called.
Also, make sure you save the reference to the MyExtender, you'll need to remember to unregister it from the toolbar extender manager for the LevelEditor module when your module is unloaded.
So that's the crash course in extending the existing editor UI from a plugin. Can't wait to see what you make!
Cheers, Nick (Epic Games)
I just want to share a tutorial I put together after finishing this experiment:
Hope you find that useful. :)
answered Apr 17 '14 at 11:00 AM
Hello again Nick,
I'm trying to wrap up my experiment, by adding a new button and having it display a log message.
Here's what I did so far:
I defined a new commad in my plugin's header:
In the StartupModule(), and after adding my new extender, I put the following:
I'm trying to map the MyButton command to a callback function I defined in my plugin header like this:
I implemented it to simply print a log message.
Now the problem is, and according to my research, that there is one missing step, which is registering the command. I need to have a RegisterCommands() function, where I should define in it something like this:
My question is how do I get RegisterCommands() defined, and is there any more things I'm missing?
Thank you for the help!
Note: I implemented AddToolbarExtension() like this.
Another example and tutorial here...
answered Feb 09 '15 at 01:28 AM
SND R Keene
Follow this question
Once you sign in you will be able to subscribe for any updates here