#pragma once #include "CoreMinimal.h" #include "Factories/Factory.h" #include "Factories/EnumFactory.h" #include "WingHandler.h" #include "WingFactories.generated.h" class WingFactories { public: // Create an asset on disk, using a factory instance. // Returns the main object. If there are problems, // prints error messages and returns nullptr. static UObject *CreateAsset(const FString &Path, UFactory *Factory, WingOut Errors); // Some factories are blacklisted, mainly because they // pop up dialog boxes. In those cases, we deal with it // primarily by adding those factories to the blacklist, // and then implementing replacement factories. static bool IsBlacklisted(TSubclassOf FactoryClass); // Check if the factory class can be used to create assets. // makes sure it's not abstract, calls CanCreateNew, // calls ShouldShowInNewMenu, and verifies not blacklisted. static bool CanCreate(TSubclassOf FactoryClass); // Get the names of the editable properties for a factory class. static TArray GetParameterNames(TSubclassOf FactoryClass); // This takes a factory name and turns it into a string // that we can present to the user. Mainly, it removes // the word 'Factory', and anything that comes after. static FString DeriveFactoryName(TSubclassOf FactoryClass); // Verifies that the asset path is a valid path, and also // that there's not something already there at that path. static bool CheckNewAssetPath(const FString &Path, WingOut Errors); }; // The original UEnumFactory may pop a dialog. We made a better one. UCLASS() class UEnumFactoryWing : public UEnumFactory { GENERATED_BODY() public: virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; };