Hi. I’m new to this editor scripting world. I figured out how to get the list of morph targets in a selected skeletal mesh. Now I can’t find a way to create the curve metadata for them. I’m trying to get the morph target names and loop through it adding a curve with the same name for each one.
I found some pieces of the puzzle here and there, but I can’t get it to work together.
Like I said, listing the morph targets was easy, 3 lines of code after days of research LOL.
I think it could be a really useful script, since there’s a lot of repetion in the curve-morph target setup for animations.
If you’re still looking, I couldn’t find any way in python or BP, but if you can do c++, the core part looks like this:
if (UAnimCurveMetaData* AnimCurveMetaData = SkeletalMesh->GetAssetUserData<UAnimCurveMetaData>())
{
// Process each parsed entry
for (const FCurveMetaDataEntry& Entry : Entries)
{
FName CurveFName(*Entry.CurveName);
AnimCurveMetaData->AddCurveMetaData(CurveFName);
AnimCurveMetaData->SetCurveMetaDataBoneLinks(CurveFName, Entry.LinkedBones, Entry.MaxLOD, Skeleton);
AnimCurveMetaData->SetCurveMetaDataMaterial(CurveFName, Entry.bMaterial);
AnimCurveMetaData->SetCurveMetaDataMorphTarget(CurveFName, Entry.bMorphTarget);
UE_LOG(LOG_CAT(), Log, TEXT("Added curve metadata for '%s'"), *Entry.CurveName);
}
// ReSharper disable once CppExpressionWithoutSideEffects
SkeletalMesh->MarkPackageDirty();
return true;
}
UE_LOG(LOG_CAT(), Warning, TEXT("PasteAnimCurves: SkeletalMesh has no AnimCurveMetaData asset user data"));
return false;
}
FCurveMetaDataEntryis a just a struct type I made, but you can use these methods to programmatically add mesh curves just by using values from whatever source you had.