Jump to content

[SOLVED] Extending the Editor Panel


photo

Recommended Posts

Posted

The plugin sample explains pretty clearly how to add new UIs via the plugin tab in the Tools menu, but is there a way I can launch my plugin from the editor toolbar panel without modifying the source code?

Posted

Yes, this is in regards to the editor toolbar. See image:

 

editor.png

Posted

Hey, Philip!

 

You can have a look at <sdkroot>/data/core/editor/editor_panel.h file, it contains all panel UI. Basically, what you need to do is call panel_gb.addChild and pass your custom widgets from the plugin.

 

Don't forget to remove your widgets once the plugin is unloaded!

Posted

Very cool, got it to work, although can I append my WidgetIcon object to a particular index within the toolbar?

Say for example I want to explicitly append past the Quit icon. It appears to always be placing it below the main toolbar, even if I specify GUI_ALIGN_RIGHT | GUI_ALIGN_EXPAND.

 

 

//Get the editor toolbar
Gui gui = engine.getGui();
panel_gb = Panel::panel_gb;

//Create a VBox separator to put our icon within
my_vb = new WidgetVBox(gui,1,1);

//Create the icon and add it to the toolbar
my_i = new WidgetIcon(gui, "editor_my_icon.png");
my_i.setCallback(GUI_RELEASED, "MYEditor::my_pressed");
my_vb.addChild(my_i);

//Now add the group to the toolbar
panel_gb.addChild(my_vb);

Posted

I guess I know the reason.

 

That's because panel_gb has WidgetHBox as its first and only one child, so you need to get that hbox and add your stuff to it.

×
×
  • Create New...