Download

How to get values frim a UCurveLinearColor curve at specific time?

Hey everyone,

I’m using curves to control stuff in galaxy simulator.

So far I’ve had no trouble getting float curve values with GetFloatValue.

But for the life of me I can’t get the value at a point in time from a UCurveLinearColor curve :frowning:

Can anyone offer any example code?

Hi ioFlow Studios,

I haven’t used it myself but just looking at the source it looks like you call this method just like you would GetFloatValue(time).


FLinearColor UCurveLinearColor::GetLinearColorValue( float InTime ) const

–tmek

Hi Tmek,

Ta, that is indeed the correct way to do it.

Turns out it was one of those weird “yes you’re doing right now but you gotta do a full rebuild from VS instead of just a hot reload before it’ll start working” things.

Also, the ToFColor thing either doesn’t work properly, or it is working but what it’s supposed to do is too clever for my little brain to understand.

I ended up ditching it for this:

FLinearColor LinearColor = Splines[SplineIndex]->PrimaryColorIO->GetLinearColorValue(UnitDepth);
// StarColor = LinearColor.ToFColor(true);
StarColor.R = int(LinearColor.R * 255.0f);
StarColor.G = int(LinearColor.G * 255.0f);
StarColor.B = int(LinearColor.B * 255.0f);