调整菜单创建bagshape
This commit is contained in:
parent
c8a551888d
commit
bc36d855ac
@ -18,6 +18,13 @@ void FBagShapeAssetTypeAction::OpenAssetEditor(const TArray<UObject*>& InObjects
|
||||
}
|
||||
|
||||
|
||||
uint32 FBagShapeAssetTypeAction::GetCategories()
|
||||
{
|
||||
//系统原有
|
||||
//return EAssetTypeCategories::Gameplay;
|
||||
return MyAssetCategory;
|
||||
}
|
||||
|
||||
void FBagShapeAssetTypeAction::GetActions(const TArray<UObject*>& InObjects, struct FToolMenuSection& Section)
|
||||
{
|
||||
FAssetTypeActions_Base::GetActions(InObjects, Section);
|
||||
|
||||
@ -7,8 +7,6 @@
|
||||
|
||||
UBagShapeFactory::UBagShapeFactory()
|
||||
{
|
||||
bCreateNew = true;
|
||||
bEditAfterNew = true;
|
||||
SupportedClass = UBagShapeAsset::StaticClass();
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ void FProjectFishEditorModule::ShutdownModule()
|
||||
{
|
||||
PropModule->UnregisterCustomPropertyTypeLayout("SkillDataConfig");
|
||||
}
|
||||
//注销资源类型编辑器
|
||||
UnregisterAssetTypeActions();
|
||||
}
|
||||
|
||||
@ -29,9 +30,10 @@ void FProjectFishEditorModule::RegisterAssetTypeActions()
|
||||
{
|
||||
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
||||
IAssetTools& AssetTools = AssetToolsModule.Get();
|
||||
|
||||
//注册自定义的菜单
|
||||
EAssetTypeCategories::Type BoxShapeAssetCategory = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT("Bag")), FText::FromString(TEXT("BagSystem")));
|
||||
//BagShape
|
||||
TSharedRef<FAssetTypeActions_Base> BagShapeAction = MakeShareable(new FBagShapeAssetTypeAction);
|
||||
TSharedRef<FAssetTypeActions_Base> BagShapeAction = MakeShareable(new FBagShapeAssetTypeAction(BoxShapeAssetCategory));
|
||||
AssetTools.RegisterAssetTypeActions(BagShapeAction);
|
||||
CreatedAssetTypeActions.Add(BagShapeAction);
|
||||
}
|
||||
|
||||
@ -11,13 +11,20 @@
|
||||
class PROJECTFISHEDITOR_API FBagShapeAssetTypeAction: public FAssetTypeActions_Base
|
||||
{
|
||||
public:
|
||||
FBagShapeAssetTypeAction(EAssetTypeCategories::Type InAssetCategory)
|
||||
{
|
||||
MyAssetCategory = InAssetCategory;
|
||||
}
|
||||
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 uint32 GetCategories() override; ;
|
||||
virtual void GetActions(const TArray<UObject*>& InObjects, struct FToolMenuSection& Section) override;
|
||||
virtual bool CanFilter() override {return true;}
|
||||
|
||||
private:
|
||||
EAssetTypeCategories::Type MyAssetCategory;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user