Hello,
I have problem with creating custom DataAsset editor module. I would like to create custom editor module for my own DataAsset types with functionality to export/import data from .json files. I have working JSONParser and toolbar but rest of the view (List of struct properties) still does not work.
I would like my view to look like that:
At the moment I have working toolbar but properties/details view display only empty space.
Here is method responsible for initializing view for specified DataAsset types.
void FDataAssetEditor::InitDataAssetEditor(const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UProjectNameDataAsset* InitItem)
{
ItemBeingEdited = InitItem; TSharedPtr<FItemEditor> ItemEditorPtr = SharedThis(this);
// Bind commands
FGraphEditorCommands::Register();
FItemEditorCommands::Register();
// Default layout const TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_ItemEditor_Layout_v6")
->AddArea
( FTabManager::NewPrimaryArea()
->SetOrientation(Orient_Vertical)
->Split ( FTabManager::NewStack()
[INDENT=2]->SetSizeCoefficient(0.1f)
->SetHideTabWell(true)
->AddTab(GetToolbarTabId(), ETabState::OpenedTab)
)
->Split
([/INDENT]
[INDENT=3]FTabManager::NewSplitter()
->SetOrientation(Orient_Horizontal)
->SetSizeCoefficient(0.9f)
->Split
([/INDENT]
[INDENT=4]FTabManager::NewStack()
->SetSizeCoefficient(0.8f) ->SetHideTabWell(true)
->AddTab(FItemEditorTabs::ViewportID, ETabState::OpenedTab)
))
->Split
([/INDENT]
[INDENT=5]FTabManager::NewSplitter() ->SetOrientation(Orient_Vertical)
->SetSizeCoefficient(0.2f)
->Split
([/INDENT]
[INDENT=6]FTabManager::NewStack()
->SetSizeCoefficient(0.75f)
->SetHideTabWell(true)
->AddTab(FItemEditorTabs::DetailsID, ETabState::OpenedTab)[/INDENT]
[INDENT=5])[/INDENT]
[INDENT=4])[/INDENT]
[INDENT=3])[/INDENT]
[INDENT=2]);[/INDENT]
BindEditorCommands();
// Initialize the asset editor
InitAssetEditor(Mode, InitToolkitHost, ItemEditorAppName, StandaloneDefaultLayout, /*bCreateDefaultStandaloneMenu=*/ true, /*bCreateDefaultToolbar=*/ true, InitItem);
ExtendToolbar();
RegenerateMenusAndToolbars();
}
This is the function registering TabSpawners:
void FItemEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& TabManager)
{ WorkspaceMenuCategory = TabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_ItemEditor", "Item Editor"));
auto WorkspaceMenuCategoryRef = WorkspaceMenuCategory.ToSharedRef();
FAssetEditorToolkit::RegisterTabSpawners(TabManager);
TabManager->RegisterTabSpawner(FItemEditorTabs::DetailsID, FOnSpawnTab::CreateSP(this, &FItemEditor::SpawnTab_Details))
[INDENT=2].SetDisplayName(LOCTEXT("DetailsTabLabel", "Details"))
.SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));[/INDENT]
}
If I comment out code from function
RegisterTabSpawners()
I get ‘Unrecognized tab’ but at least it display my tab.
What should I do to make this display my details tab properly?
Tell me if you need more details.
Thank for any help.