Animation Property Access System in C++?

Instead of doing any of this proxy stuff, cant we just use NativeThreadSafeUpdateAnimation override?

If you look at lyra, all the calculations are done in BlueprintThreadSafeUpdateAnimation . So following the same pattern cant we just make normal BP read-only Uproperties in UAnimInstance in c++. Do calculations and set those value in NativeThreadSafeUpdateAnimation override function?

If you peak NativeThreadSafeUpdateAnimation definition , the comment says “// Native thread safe update override point. Executed on a worker thread just prior to graph update
// for linked anim instances, only called when the hosting node(s) are relevant”
So from what I understand, this function 1) runs on a worker thread 2) Runs before anim graph thus making all our calculations available to use.

As far as accessing external values such as character world position or acceleration or velocity etc goes, those are being read not modified. So there shouldn’t be any problem there.

So like do you even need a property access system equivalent in c++? One problem that I can think of is if worker thread ran more than once before the main thread then that would result in
a property having same value over multiple ticks.
One hack that I can think of is I guess use a bool initialize it to false. Make it true every tick in NativeUpdateAnimation. Then in NativeThreadSafeUpdateAnimation check if the bool is true.
If true then do calculations and set it to false, if bool is false then skip this tick. This way we know that main thread has had a chance to run before worker thread.

6 Likes