Unrecognized Tab

I’m working on creating a custom editor plugin at the moment. The problem I’ve come across is I’m getting “Unrecognized Tab” for my Viewport and Properties panels at the moment when I launch my editor.

I can’t really figure out whats going on. When I debug, it seems like TabManager is invalid in RegisterTabSpawners but its hard to tell without a debug db for the Slate DLL.

Am I missing something that I should be using for creating a custom window like this? Cheers! Code is below, I can attach the full file if needed.

const FName FDialogueTreeEditor::GraphCanvasTabId( TEXT( "DialogueTreeEditor_GraphCanvas" ) );
const FName FDialogueTreeEditor::PropertiesTabId( TEXT( "DialogueTreeEditor_Properties" ) );

void FDialogueTreeEditor::RegisterTabSpawners(const TSharedRef& TabManager)
{
	FAssetEditorToolkit::RegisterTabSpawners(TabManager);

	const IWorkspaceMenuStructure& MenuStructure = WorkspaceMenu::GetMenuStructure();

	TabManager->RegisterTabSpawner( GraphCanvasTabId, FOnSpawnTab::CreateSP(this, &FDialogueTreeEditor::SpawnTab_GraphCanvas) )
		.SetDisplayName( TEXT("Viewport") )
		.SetGroup( MenuStructure.GetAssetEditorCategory() );

	TabManager->RegisterTabSpawner( PropertiesTabId, FOnSpawnTab::CreateSP(this, &FDialogueTreeEditor::SpawnTab_Properties) )
		.SetDisplayName( NSLocEdL( "PropertiesTab", "Properties" ) )
		.SetGroup( MenuStructure.GetAssetEditorCategory() );
}

void FDialogueTreeEditor::InitDialogueEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UObject* ObjectToEdit)
{
	DialogueTree = CastChecked(ObjectToEdit);

	// Support undo/redo
	DialogueTree->SetFlags(RF_Transactional);

	GEditor->RegisterForUndo(this);

	// TODO re-add
	//FDialogueTreeGraphEditorCommands::Register();

	BindGraphCommands();

	CreateInternalWidgets();

	const TSharedRef StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_DialogueTreeEditor_Layout_v2")
		->AddArea
		(
		FTabManager::NewPrimaryArea() ->SetOrientation(Orient_Vertical)
		->Split
		(
		FTabManager::NewStack()
		->SetSizeCoefficient(0.1f)
		->AddTab(GetToolbarTabId(), ETabState::OpenedTab) ->SetHideTabWell( true )
		)
		->Split
		(
		FTabManager::NewSplitter() ->SetOrientation(Orient_Horizontal) ->SetSizeCoefficient(0.9f)
		->Split
		(
		FTabManager::NewStack()
		->SetSizeCoefficient(0.8f)
		->AddTab(GraphCanvasTabId, ETabState::OpenedTab) ->SetHideTabWell( true )
		)
		->Split
		(
		FTabManager::NewStack()
		->SetSizeCoefficient(0.2f)
		->AddTab(PropertiesTabId, ETabState::OpenedTab)
		)
		)
		);

	const bool bCreateDefaultStandaloneMenu = true;
	const bool bCreateDefaultToolbar = true;
	
	FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost,DialogueEditorAppIdentifier, StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, ObjectToEdit, false);

	ExtendToolbar();
	RegenerateMenusAndToolbars();

	if(IsWorldCentricAssetEditor())
	{
		SpawnToolkitTab(GetToolbarTabId(), FString(), EToolkitTabSpot::ToolBar);
		SpawnToolkitTab(GraphCanvasTabId, FString(), EToolkitTabSpot::Viewport);
		SpawnToolkitTab(PropertiesTabId, FString(), EToolkitTabSpot::Details);
	}
}

Turns out this was restoring an old tab layout… So I guess the question is, how do I clear the layout data?

Right, the editor will always load the existing layout from preferences and try to restore it. The old layout file will have the tab identifiers from whatever older version of your UI was used at the time, and will persist those layout settings, even after being closed and reopened (unless the tab identifier has changed!) The easiest way to reset this is to simply reset the editor’s UI layout in the Preferences panel.

–Mike

Hi,

Have you found a way to handle this case programmatically by code?

Thanks!

Hi,

Have you found a way to handle this case programmatically by code?

Thanks!