How to get all morph target names from mesh?

Hello.

Is it possible to get array with morph target names from characters mesh?

Code examples are welcome…

Thank you!

Solved!

TArray<FString> APeopleCharacterNative::GetCharacterMorphs() {
	TArray<FString> outputArray;

	USkeletalMeshComponent* mesh = GetMesh();
	USkeletalMesh * skelMesh = mesh->SkeletalMesh;
	TMap< FName, UMorphTarget * > myMap = skelMesh->MorphTargetIndexMap;

	for (TPair< FName, UMorphTarget * > Entry : myMap) {
		outputArray.Add(Entry.Key.ToString());
	}

	return outputArray;
}

Thank you for posting this, Arthur, this put me on the right track. But there is a mistake in your code. You incorrectly try to coerce skelMesh->MorphTargetIndexMap, which is of type TMap< FName, int32 > into TMap< FName, UMorphTarget* >, which results in a compile error.

Simply change TMap< FName, UMorphTarget*> to TMap< FName, int32 >.

(Also of note, you can use this in conjunction with mesh->GetMorphTarget(Entry.Key) or the GetMorphTarget blueprint node to create a name:weight map)

I know it’s been some time, but I am encountering the prolbem nowadays and maybe you can help me out.
It seems the above code isn’t working, what can be corrected so it works? trying to get a list of blendshapes out of character.

Hi @Deemk0, that’s really not enough information to go off of to help you. Please post a new question, include the code, and include the error message or misbehavior you are seeing.