添加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 "ProjectFishEditor.h"
|
||||||
|
|
||||||
|
#include "AssetTypeActions_Base.h"
|
||||||
#include "DataTableRowSelectorCustomization.h"
|
#include "DataTableRowSelectorCustomization.h"
|
||||||
|
#include "AssetActions/BagShapeAssetTypeAction.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "FProjectFishEditorModule"
|
#define LOCTEXT_NAMESPACE "FProjectFishEditorModule"
|
||||||
|
|
||||||
@ -10,6 +12,8 @@ void FProjectFishEditorModule::StartupModule()
|
|||||||
PropModule.RegisterCustomPropertyTypeLayout("SkillDataConfig"
|
PropModule.RegisterCustomPropertyTypeLayout("SkillDataConfig"
|
||||||
, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FDataTableRowSelectorCustomization::MakeInstance));
|
, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FDataTableRowSelectorCustomization::MakeInstance));
|
||||||
|
|
||||||
|
//注册资源类型编辑器
|
||||||
|
RegisterAssetTypeActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProjectFishEditorModule::ShutdownModule()
|
void FProjectFishEditorModule::ShutdownModule()
|
||||||
@ -18,6 +22,32 @@ void FProjectFishEditorModule::ShutdownModule()
|
|||||||
{
|
{
|
||||||
PropModule->UnregisterCustomPropertyTypeLayout("SkillDataConfig");
|
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
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
|||||||
@ -21,7 +21,9 @@ public class ProjectFishEditor : ModuleRules
|
|||||||
"Slate",
|
"Slate",
|
||||||
"SlateCore",
|
"SlateCore",
|
||||||
"ProjectFish",
|
"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
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "AssetTypeActions_Base.h"
|
||||||
#include "Modules/ModuleManager.h"
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
class FProjectFishEditorModule : public IModuleInterface
|
class FProjectFishEditorModule : public IModuleInterface
|
||||||
@ -8,4 +9,12 @@ class FProjectFishEditorModule : public IModuleInterface
|
|||||||
public:
|
public:
|
||||||
virtual void StartupModule() override;
|
virtual void StartupModule() override;
|
||||||
virtual void ShutdownModule() 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