添加背包配置编辑器
This commit is contained in:
parent
5713ef088b
commit
b01db99502
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "AssetActions/BagConfigAssetTypeAction.h"
|
#include "AssetActions/BagConfigAssetTypeAction.h"
|
||||||
|
|
||||||
|
#include "AssetEditor/BagConfigAssetEditor.h"
|
||||||
#include "ProjectFish/DataAsset/BagConfigAsset.h"
|
#include "ProjectFish/DataAsset/BagConfigAsset.h"
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +15,16 @@ UClass* FBagConfigAssetTypeAction::GetSupportedClass() const
|
|||||||
void FBagConfigAssetTypeAction::OpenAssetEditor(const TArray<UObject*>& InObjects,
|
void FBagConfigAssetTypeAction::OpenAssetEditor(const TArray<UObject*>& InObjects,
|
||||||
TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
|
TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
|
||||||
{
|
{
|
||||||
//FAssetTypeActions_Base::OpenAssetEditor(InObjects, EditWithinLevelEditor);
|
EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;
|
||||||
|
|
||||||
|
for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
|
||||||
|
{
|
||||||
|
if (UBagConfigAsset* BagConfigAsset = Cast<UBagConfigAsset>(*ObjIt))
|
||||||
|
{
|
||||||
|
TSharedRef<FBagConfigAssetEditor> EditorToolkit = MakeShareable(new FBagConfigAssetEditor());
|
||||||
|
EditorToolkit->Initialize(Mode, EditWithinLevelEditor, BagConfigAsset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 FBagConfigAssetTypeAction::GetCategories()
|
uint32 FBagConfigAssetTypeAction::GetCategories()
|
||||||
|
|||||||
@ -0,0 +1,73 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "AssetEditor/BagConfigAssetEditor.h"
|
||||||
|
#include "ProjectFish/DataAsset/BagConfigAsset.h"
|
||||||
|
|
||||||
|
const FName FBagConfigAssetEditor::BagConfigEditorTabId(TEXT("BagConfigEditor"));
|
||||||
|
|
||||||
|
void FBagConfigAssetEditor::Initialize(const EToolkitMode::Type Mode,
|
||||||
|
const TSharedPtr<class IToolkitHost>& InitToolkitHost, class UBagConfigAsset* InBagConfigAsset)
|
||||||
|
{
|
||||||
|
BagConfigAsset = InBagConfigAsset;
|
||||||
|
|
||||||
|
const TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_BagConfigAssetEditor_Layout_v1")
|
||||||
|
->AddArea
|
||||||
|
(
|
||||||
|
FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical)
|
||||||
|
->Split
|
||||||
|
(
|
||||||
|
FTabManager::NewStack()
|
||||||
|
->SetSizeCoefficient(1.0f)
|
||||||
|
->AddTab(BagConfigEditorTabId, ETabState::OpenedTab)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, TEXT("BagShapeAssetEditorApp"), StandaloneDefaultLayout, true, true, InBagConfigAsset);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FName FBagConfigAssetEditor::GetToolkitFName() const
|
||||||
|
{
|
||||||
|
return FName("BagConfigEditor");
|
||||||
|
}
|
||||||
|
|
||||||
|
FText FBagConfigAssetEditor::GetBaseToolkitName() const
|
||||||
|
{
|
||||||
|
return FText::FromString("BagConfig");
|
||||||
|
}
|
||||||
|
|
||||||
|
FString FBagConfigAssetEditor::GetWorldCentricTabPrefix() const
|
||||||
|
{
|
||||||
|
return TEXT("BagConfig");
|
||||||
|
}
|
||||||
|
|
||||||
|
FLinearColor FBagConfigAssetEditor::GetWorldCentricTabColorScale() const
|
||||||
|
{
|
||||||
|
return FLinearColor::White;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FBagConfigAssetEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& tabManager)
|
||||||
|
{
|
||||||
|
WorkspaceMenuCategory = tabManager->AddLocalWorkspaceMenuCategory( FText::FromString("BagShape"));
|
||||||
|
|
||||||
|
tabManager->RegisterTabSpawner(BagConfigEditorTabId, FOnSpawnTab::CreateSP(this, &FBagConfigAssetEditor::SpawnBagConfigEditorTab))
|
||||||
|
.SetDisplayName( FText::FromString("BagShapeEditor"))
|
||||||
|
.SetGroup(WorkspaceMenuCategory.ToSharedRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
void FBagConfigAssetEditor::UnregisterTabSpawners(const TSharedRef<FTabManager>& tabManager)
|
||||||
|
{
|
||||||
|
tabManager->UnregisterTabSpawner(BagConfigEditorTabId);
|
||||||
|
}
|
||||||
|
|
||||||
|
TSharedRef<SDockTab> FBagConfigAssetEditor::SpawnBagConfigEditorTab(const FSpawnTabArgs& Args)
|
||||||
|
{
|
||||||
|
// return SNew(SDockTab)
|
||||||
|
// .TabRole(ETabRole::PanelTab)
|
||||||
|
// [
|
||||||
|
// SNew(SBagShapeEditorWidget)
|
||||||
|
// .BagShapeAsset(BagShapeAsset)
|
||||||
|
// ];
|
||||||
|
return SNew(SDockTab);
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class PROJECTFISHEDITOR_API FBagConfigAssetEditor: public FAssetEditorToolkit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Initialize(const EToolkitMode::Type Mode, const TSharedPtr<class IToolkitHost>& InitToolkitHost, class UBagConfigAsset* InBagConfigAsset);
|
||||||
|
|
||||||
|
// IAssetEditorInstance interface
|
||||||
|
virtual FName GetToolkitFName() const override;
|
||||||
|
virtual FText GetBaseToolkitName() const override;
|
||||||
|
virtual FString GetWorldCentricTabPrefix() const override;
|
||||||
|
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
||||||
|
|
||||||
|
// FAssetEditorToolkit interface
|
||||||
|
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& tabManager) override;
|
||||||
|
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& tabManager) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TSharedRef<SDockTab> SpawnBagConfigEditorTab(const FSpawnTabArgs& Args);
|
||||||
|
|
||||||
|
class UBagConfigAsset* BagConfigAsset;
|
||||||
|
/** Tab IDs */
|
||||||
|
static const FName BagConfigEditorTabId;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user