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