Is there any way to modify bone tracks with C++?

Yes.

UObject* NewObject = AssetTools.CreateAsset(
	NewAssetName,
	InAssetPath,
	UAnimSequence::StaticClass(), nullptr /*, factory*/);

if (NewObject)
{
	if (UAnimSequence* NewSeq = Cast<UAnimSequence>(NewObject))
	{
		const int32 UseFrameRate = 30;

		// Notify asset registry
		FAssetRegistryModule::AssetCreated(NewSeq);

		// Set skeleton
		NewSeq->ResetAnimation();
		NewSeq->SetSkeleton(Skel);
		NewSeq->ImportFileFramerate = (float)UseFrameRate;
		NewSeq->ImportResampleFramerate = UseFrameRate;

		// Initialize data model
		IAnimationDataController& Controller = NewSeq->GetController();
		Controller.OpenBracket(LOCTEXT("InitializeAnimation", "Initialize New Anim Sequence"));
		{
			// This line is to set actual frame rate
			Controller.SetFrameRate(FFrameRate(UseFrameRate, 1), true);

			Controller.SetPlayLength(RawCurvesAnim->Duration, true);
			Controller.NotifyPopulated();
		}
		Controller.CloseBracket();
	}
}
2 Likes