diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp new file mode 100644 index 0000000..aab5dce --- /dev/null +++ b/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp @@ -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(InParent, Class, Name, Flags | RF_Transactional); + if (NewBagShapeAsset) + { + NewBagShapeAsset->BagWidth = 5; + NewBagShapeAsset->BagHeight = 5; + NewBagShapeAsset->InitializeBagShape(); + } + return NewBagShapeAsset; +} + +bool UBagShapeFactory::ShouldShowInNewMenu() const +{ + return true; +} diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h b/ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h new file mode 100644 index 0000000..775873f --- /dev/null +++ b/ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h @@ -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; +};