Is there any way to get the class data from the animation blueprint asset obtained from the Content Manager?

Hello,

I have a custom C++ class named UHandsAnimInstance :

UCLASS(transient, Blueprintable, hideCategories = AnimInstance, BlueprintType)
class SENSORIALSDK_API UHandsAnimInstance : public UAnimInstance
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Fingers)
		bool isRight = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Fingers)
		FRotator wrist;
}

It has some custom properties inside and it is the parent class of an animation blueprint asset as you can see in this picture:

And it is located in this location: “/Game/SensorialXR/Blueprints/Gestures/RightHand”

My main problem is that I want to select that object from Content Manager so first I try to put that as a property in another class (AActor class):

UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TArray<UHandsAnimInstance*> gestureData;

But I cannot select any object in the editor selector:

So I tried to load all assets from a FString parameter that is the path of all UHandsAnimInstance at runtime using this code in the BeginPlay function inside the custom AActor class:

FString gesturesPath = "/Game/SensorialXR/Blueprints/Gestures/RightHand";
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
TArray<FAssetData> AssetData;
AssetRegistryModule.Get().GetAssetsByPath(FName(*gesturesPath), AssetData);
for (int i = 0; i < AssetData.Num(); i++) {
	UAnimBlueprint* animx = Cast<UAnimBlueprint>(AssetData[i].GetAsset());
	if (animx) {
		//Do Something (like add to the gestureData list)
	}
}

The problem is that the class of the obtained asset is UAnimBlueprint (that is why I cast that asset to that type):

But I cannot do anything neither get the UHandsAnimInstance object from that asset:

So, what can I do to get the data I want of my custom C++ class from a blueprint object in the content manager?

1 Like

AnimBlueprint is same as Blueprint with some extra animation editor features and it a class in same sense as C++ class based of UAnimInstance. So it also means, same as with blueprints you dealing here with classes not already created objects, you need to make object first (but keep in mind you can access defaults without doing that). the Animation blueprint object is created on start up off USkeletalMeshComponent, it won’t exist before it.

So most effacement way select AnimBlueprint is by selecting class it’s making, so:

 UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSubclassOf<UHandsAnimInstance>> gestureData;

You should have UClass of your animation blueprint, and then you can access defaults using GetDefaultObject function, to do anything more then that you need to create object of it or at very least set the class to SkeletalMeshComponent.

But if you really want to use UAnimBlueprint you can get class same as you would do that with UBlueprint using get Blueprint class:

Use “Va Rest” and “Victory” plugins can do this. I used these two plugins got “Morph Target” per frame data of the running animation in the scene.