Hello, I am working on a Blueprint generator.
I want to create blueprints based on objects described in files. These descriptions include behaviour, this is why I need to create a BP Event Graph.
In this function, I create an empty Blueprint:
TObjectPtr<UBlueprint> CreateBlueprint(FString BpPath, TSubclassOf<UObject> ParentClass) {
// Check if there is already an asset at the path's location.
if (StaticLoadObject(UObject::StaticClass(), nullptr, *BpPath))
return nullptr;
// Check that the parent class is blueprintable
if (!FKismetEditorUtilities::CanCreateBlueprintOfClass(ParentClass))
return nullptr;
// Create a package
TObjectPtr<UPackage> Package = CreatePackage(*BpPath);
if (!Package.Get())
return nullptr;
// Find the Blueprint Class to create
UClass* BpClass = nullptr;
UClass* BpGenClass = nullptr;
FModuleManager::LoadModuleChecked<IKismetCompilerInterface>("KismetCompiler")
.GetBlueprintTypesForClass(ParentClass, BpClass, BpGenClass);
// Create the Blueprint
TObjectPtr<UBlueprint> Blueprint = FKismetEditorUtilities::CreateBlueprint(
ParentClass,
Package,
*FPaths::GetBaseFilename(BpPath),
BPTYPE_Normal,
BpClass,
BpGenClass
);
// Add an Event Graph to the Blueprint
// Add Nodes to the Event Graph
// Connect the Nodes
/*
Example Event Graph:
[OnTick]--->[AddActorLocalRotation]
[Actor = this ]
[Rotation = (0, 1, 0) ]
*/
// Register the Blueprint
FAssetRegistryModule::AssetCreated(Blueprint);
Blueprint->MarkPackageDirty();
return Blueprint;
}
My current goal is to create a dummy Event Graph like the one in the comment.
How can I create the Event Graph, populate it with Nodes (built-in nodes, not custom) and connect them?
Thanks a lot in advance.