[4.6.1 - Plugin] Why do FLevelEditorModule::RegisterTabSpawner generates two menu entries for my tab?

I’m developing a plugin for Optitrack that have a tab to interface the server. When I register my tab-spawner using FGlobalTabmanager it works as expected but the tab is not dockable into the Level Editor. Instead when I use FLevelEditorMoudule the tab is dockable like the ContentBrowser tab but it also generates two entries for the tab inside the “Window” menu. Why do this happen? How can I control whether or not generate these menus?

Here’s a picture that explains the overall situation: (full size) http://i.imgur.com/J7zbXT6.jpg

http://i.imgur.com/J7zbXT6.jpg

Hi,

Are you adding a MenuEntry using MenuExtender somewhere in your code? Maybe youre adding one entry by yourself and LevelEditorModule adds another one when you register your tab spawner?

Nope, this is pretty much all the code that initializes the plugin module. If I comment the highlighted block of code it does not generate the menu anymore. I’ve added a link to the image with better readability.

I see. I just dont get it why you’re binding function that registers tab spawner to level editor’s tab spawner OnChanged event. Most likely it gets called twice.

Try to register your tab spawner only once, during plugin startup like this:
LevelEditorModule.GetLevelEditorTabManager()->RegisterTabSpawner(…)

Because at this point the LevelEditorModule.GetLevelEditorTabManager() returns a nullptr. The tabmanager is not ready yet, that’s why I have to use the event.
And no, it’s called just once. I’ve set a breakpoint and it stops only once. I’m trying to understand what happens when I register the tabspawner. And why it doesn’t happen when I use the global tab manager.

Meh, I didnt notice that you are trying to register tab spawner with GlobalTabManager istead of registering Nomad tab spawner, like this:

FGlobalTabmanager::Get()->RegisterNomadTabSpawner(…)

This way you can get your tab to be dockable everywhere and by using MenuExtender you can create menu entry under ‘Window’ menu

Nope, I still get the same effect. It works and I get a dockable tab but also the two menu items. Here’s the source code if you’d like to try by yourself Log in with Atlassian account

Ok it looks like this is the solution for me, but still it does not answer to the question “why two entries are added to the menu?”

28250-optitrack-plugin-help_solution.jpg

This is still an issue in 4.18.3.

Just call RegisterNomadTabSpawner and it gives you 2 entries under windows.

the FTabSpawnerEntry& returned by RegisterTabSpawner() and RegisterNomadTabSpawner() has a method called:

SetAutoGenerateMenuEntry(bool)

Which can be set to false.