// Fill out your copyright notice in the Description page of Project Settings. #include "AssetEditor/BagShapeAssetEditor.h" #include "ProjectFish/DataAsset/BagShapeAsset.h" #include "Widgets/BagShapeEditorWidget.h" const FName FBagShapeAssetEditor::BagShapeEditorTabId(TEXT("BagShapeEditor")); void FBagShapeAssetEditor::Initialize(const EToolkitMode::Type Mode, const TSharedPtr& InitToolkitHost, UBagShapeAsset* InBagShapeAsset) { BagShapeAsset = InBagShapeAsset; const TSharedRef StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_BagShapeAssetEditor_Layout_v1") ->AddArea ( FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical) ->Split ( FTabManager::NewStack() ->SetSizeCoefficient(1.0f) ->AddTab(BagShapeEditorTabId, ETabState::OpenedTab) ) ); FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, TEXT("BagShapeAssetEditorApp"), StandaloneDefaultLayout, true, true, InBagShapeAsset); } FName FBagShapeAssetEditor::GetToolkitFName() const { return FName("BagShapeEditor"); } FText FBagShapeAssetEditor::GetBaseToolkitName() const { return FText::FromString("Base BagShapeEditor"); } FString FBagShapeAssetEditor::GetWorldCentricTabPrefix() const { return TEXT("ShapeTab"); } FLinearColor FBagShapeAssetEditor::GetWorldCentricTabColorScale() const { //return FLinearColor::White; return FLinearColor(1.f, 0.8f, 0.45f, 0.5f); } void FBagShapeAssetEditor::RegisterTabSpawners(const TSharedRef& tabManager) { WorkspaceMenuCategory = tabManager->AddLocalWorkspaceMenuCategory( FText::FromString("BagShape")); tabManager->RegisterTabSpawner(BagShapeEditorTabId, FOnSpawnTab::CreateSP(this, &FBagShapeAssetEditor::SpawnBagShapeEditorTab)) .SetDisplayName( FText::FromString("BagShapeEditor")) .SetGroup(WorkspaceMenuCategory.ToSharedRef()); } void FBagShapeAssetEditor::UnregisterTabSpawners(const TSharedRef& tabManager) { tabManager->UnregisterTabSpawner(BagShapeEditorTabId); } TSharedRef FBagShapeAssetEditor::SpawnBagShapeEditorTab(const FSpawnTabArgs& Args) { return SNew(SDockTab) .TabRole(ETabRole::PanelTab) [ SNew(SBagShapeEditorWidget) .BagShapeAsset(BagShapeAsset) ]; }