添加bagshape 资源
This commit is contained in:
parent
841f21a27d
commit
8492dd5448
@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AssetActions/BagShapeAssetTypeAction.h"
|
||||
|
||||
#include "ProjectFish/DataAsset/BagShapeAsset.h"
|
||||
|
||||
|
||||
UClass* FBagShapeAssetTypeAction::GetSupportedClass() const
|
||||
{
|
||||
return UBagShapeAsset::StaticClass();
|
||||
}
|
||||
|
||||
void FBagShapeAssetTypeAction::OpenAssetEditor(const TArray<UObject*>& InObjects,
|
||||
TSharedPtr<IToolkitHost> EditWithinLevelEditor)
|
||||
{
|
||||
FAssetTypeActions_Base::OpenAssetEditor(InObjects, EditWithinLevelEditor);
|
||||
}
|
||||
|
||||
|
||||
void FBagShapeAssetTypeAction::GetActions(const TArray<UObject*>& InObjects, struct FToolMenuSection& Section)
|
||||
{
|
||||
FAssetTypeActions_Base::GetActions(InObjects, Section);
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
#include "ProjectFishEditor.h"
|
||||
|
||||
#include "AssetTypeActions_Base.h"
|
||||
#include "DataTableRowSelectorCustomization.h"
|
||||
#include "AssetActions/BagShapeAssetTypeAction.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FProjectFishEditorModule"
|
||||
|
||||
@ -9,7 +11,9 @@ void FProjectFishEditorModule::StartupModule()
|
||||
FPropertyEditorModule& PropModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
||||
PropModule.RegisterCustomPropertyTypeLayout("SkillDataConfig"
|
||||
, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FDataTableRowSelectorCustomization::MakeInstance));
|
||||
|
||||
|
||||
//注册资源类型编辑器
|
||||
RegisterAssetTypeActions();
|
||||
}
|
||||
|
||||
void FProjectFishEditorModule::ShutdownModule()
|
||||
@ -18,6 +22,32 @@ void FProjectFishEditorModule::ShutdownModule()
|
||||
{
|
||||
PropModule->UnregisterCustomPropertyTypeLayout("SkillDataConfig");
|
||||
}
|
||||
UnregisterAssetTypeActions();
|
||||
}
|
||||
|
||||
void FProjectFishEditorModule::RegisterAssetTypeActions()
|
||||
{
|
||||
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
||||
IAssetTools& AssetTools = AssetToolsModule.Get();
|
||||
|
||||
//BagShape
|
||||
TSharedRef<FAssetTypeActions_Base> BagShapeAction = MakeShareable(new FBagShapeAssetTypeAction);
|
||||
AssetTools.RegisterAssetTypeActions(BagShapeAction);
|
||||
CreatedAssetTypeActions.Add(BagShapeAction);
|
||||
}
|
||||
|
||||
void FProjectFishEditorModule::UnregisterAssetTypeActions()
|
||||
{
|
||||
if (FModuleManager::Get().IsModuleLoaded("AssetTools"))
|
||||
{
|
||||
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
||||
IAssetTools& AssetTools = AssetToolsModule.Get();
|
||||
for (auto action : CreatedAssetTypeActions)
|
||||
{
|
||||
AssetTools.UnregisterAssetTypeActions(action.ToSharedRef());
|
||||
}
|
||||
}
|
||||
CreatedAssetTypeActions.Empty();
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
@ -21,7 +21,9 @@ public class ProjectFishEditor : ModuleRules
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"ProjectFish",
|
||||
"InputCore"
|
||||
"InputCore",
|
||||
"AssetTools",
|
||||
"UnrealEd"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetTypeActions_Base.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class PROJECTFISHEDITOR_API FBagShapeAssetTypeAction: public FAssetTypeActions_Base
|
||||
{
|
||||
public:
|
||||
virtual FText GetName() const override {return FText::FromString("Bag Shape");}
|
||||
virtual FColor GetTypeColor() const override { return FColor(129, 196, 115); }
|
||||
virtual UClass* GetSupportedClass() const override;
|
||||
virtual void OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<IToolkitHost> EditWithinLevelEditor = TSharedPtr<IToolkitHost>()) override;
|
||||
virtual bool HasActions(const TArray<UObject*>& InObjects) const override {return true;}
|
||||
virtual uint32 GetCategories() override {return EAssetTypeCategories::Gameplay;}
|
||||
virtual void GetActions(const TArray<UObject*>& InObjects, struct FToolMenuSection& Section) override;
|
||||
virtual bool CanFilter() override {return true;}
|
||||
};
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetTypeActions_Base.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class FProjectFishEditorModule : public IModuleInterface
|
||||
@ -8,4 +9,12 @@ class FProjectFishEditorModule : public IModuleInterface
|
||||
public:
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
private:
|
||||
//Bagshap 编辑器相关
|
||||
void RegisterAssetTypeActions();
|
||||
void UnregisterAssetTypeActions();
|
||||
|
||||
/** Asset type actions */
|
||||
TArray<TSharedPtr<FAssetTypeActions_Base>> CreatedAssetTypeActions;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user