添加右键菜单创建BoxShape 资源
This commit is contained in:
parent
8492dd5448
commit
c8a551888d
@ -0,0 +1,32 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Factory/BagShapeFactory.h"
|
||||||
|
|
||||||
|
#include "ProjectFish/DataAsset/BagShapeAsset.h"
|
||||||
|
|
||||||
|
UBagShapeFactory::UBagShapeFactory()
|
||||||
|
{
|
||||||
|
bCreateNew = true;
|
||||||
|
bEditAfterNew = true;
|
||||||
|
SupportedClass = UBagShapeAsset::StaticClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
UObject* UBagShapeFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
UBagShapeAsset* NewBagShapeAsset = NewObject<UBagShapeAsset>(InParent, Class, Name, Flags | RF_Transactional);
|
||||||
|
if (NewBagShapeAsset)
|
||||||
|
{
|
||||||
|
NewBagShapeAsset->BagWidth = 5;
|
||||||
|
NewBagShapeAsset->BagHeight = 5;
|
||||||
|
NewBagShapeAsset->InitializeBagShape();
|
||||||
|
}
|
||||||
|
return NewBagShapeAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UBagShapeFactory::ShouldShowInNewMenu() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Factories/Factory.h"
|
||||||
|
#include "BagShapeFactory.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class PROJECTFISHEDITOR_API UBagShapeFactory : public UFactory
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
public:
|
||||||
|
UBagShapeFactory();
|
||||||
|
|
||||||
|
//interface
|
||||||
|
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
||||||
|
virtual bool ShouldShowInNewMenu() const override;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user