Getting the animations list from persona?

Hey all,

I need to propose my player to choose from a list of animations and hence I’d like to get the list of animations available for a skeleton or skeletal mesh, like the one in the asset browser in persona:

51383-animlist.jpg

I searched the uskeleton, uskeletalmesh, uskeletalmeshcomponent, etc. but found nothing returning an array of animations assets/sequences.

Any help ?

Thanks

Cedric

1 Like

Still no answer, but just in case any one reads this and is interested, as a workaround i did put each skeleton’s set of animations in a specific directory and merely list the content of each dir to get my anims per skeleton.

Not elegant but it works. If anyone has a real solution, i’m all ears :slight_smile:

Cheers

Cedric

Hi I think this is what you need

.h
UFUNCTION()
TArray<UAnimationAsset*> GetAllAnimationOfSkeleton(USkeleton* Skeleton);

.cpp
TArray<UAnimationAsset*> ATestActor::GetAllAnimationOfSkeleton(USkeleton* Skeleton)
{
	TArray<UAnimationAsset*> AnimsArray;

	if (Skeleton == NULL){ return AnimsArray; }

	for (TObjectIterator<UAnimationAsset> Itr; Itr; ++Itr)
	{
		if (Skeleton->GetWorld() != (*Itr)->GetWorld()){ continue; }

		if (Skeleton == (*Itr)->GetSkeleton())
		{
			AnimsArray.Add(*Itr);
		}
	}
	return AnimsArray;
}
1 Like

Hi Mhoussel,

Thank you very much, i will test this asap and report here.

Cheers

Cedric

Hi Mhousse1247,

Ok, i took the time to understand and test the function, it is exactly what i needed.

Thanks a ton,

Cheers

Cedric