Creating a Timeline with calculated curves in Code?

Hi,

So I’m trying to come up with a way to generate a timeline in C++ that is accessible in Blueprint. I want there to be three float curves emerging from the timeline, one for Radius, and two angles (spherical coordinates)

I’m having problems finding the right way to get this to work. I’m thinking that maybe I should create an FTimeline* as a UProperty, and generate the curves inside of that, making keyframes where needed. My pseudocode would look like this:



.h filePublic:
	UPROPERTY(BP Callable)
	Ftimeline OrbitPath(KepElems, BodyData, GameDate){}

.cpp file
	Aav…::OrbitPath(KepElems, BodyData, GameDate)
	{
	
		avRadius = New Ucurve
		avTheta = New Ucurve - (yaw)
		avPhi = New Ucurve - (pitch)
	
		i=(360-precesion)/36;This_OrbitTime_Start=TimeFromAngle(angle i. , MJD, kepelems)
		This_OrbitTime_Finish=TimeFromAngle(angle Final , MJD, kepelems)
		
		
		For N=0, 36 DO
		{
			
			RadCoords = Kep2Rad(KepElems, BodyData, GameDate);
			addKeyFrame(avRadius) = (RadCoords.Radius, TimeFromAngle(i));
			addKeyFrame(avTheta) = (RadCoords.Theta, TimeFromAngle(i);
			addKeyFrame(avPhi) = (RadCoords.Phi, TimeFromAngle(i);
			
		}
		
}


Would this even be the right way to go about setting up something like this? Or should I make 3 separate FRichCurve UProperties and then reference those from a regular Timeline inside a Blueprint. Also, I want all of this to be available inside of an extension of AActor, which shouldn’t be a problem right?

I guess any example of creating a Timeline with custom curves in code is what I’m hoping for. I’m not sure when to use FRichCurve vs UCurveFloat, and then how to reference those inside of a Timeline.

Any pointers help, thanks!

Here’s an implementation of a timeline in c++ using FObjectFinder to get a Curve asset from the editor.

Using UCurveFloat, check out UCurveBase for everything you need to edit curves such as
AddKey(), DeleteKey(), UpdateOrAddKey(), SetKeyTime()

Hope this points you in the right direction.

Hmm, sort of the reverse of what I’m trying to do. I’m hoping to create the curves in C++ and have them accessible in the editor. Or just have a Timeline object as a UProperty that already has those curves included. I’m trying to find precedent for a FTimeline used as a UProperty, but it seems no one has ever done that.

Thanks though, every example helps!