Hi everyone,
in BP I can call Create Control Bus Mix, how can I turn the resulting object into an asset to be stored on disk? Calling Create Asset asks for an Asset class (which I assume is Sound Control Bus Mix) and a Factory instance. The latter I have no idea how to create, although it is there somewhere.
Use case is I want to create modulation presets which I can interpolate a la INA GRM tools. I figured the Control Bus Mixes would be the way to go here.
Is this the right way to do it anyway?
Greetings,
Christoph
I’ve dug around and found the FEditorFileUtils::SaveAssetAs() C++ utility function, which was really easy to put in a BP function library
In your MyGame.Build.Cs:
PrivateDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
In your project create a new BP Function Library C++, with:
#include "FileHelpers.h"
...
UCLASS()
class UMyUtils : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static void SaveToDisk(UObject* Asset);
};
Then in the CPP it’s as simple as:
void UMyUtils ::SaveToDisk(UObject* Asset)
{
TArray<UObject*> Assets;
Assets.Add(Asset);
TArray<UObject*> OutSavedAssets;
FEditorFileUtils::SaveAssetsAs(Assets, OutSavedAssets);
}
It will produce a file save dialog and generally do what it says on the tin. How refreshing!