Description
What problem does this solve or what need does it fill?
Right now (especially after #15434) it's hard to do anything with curve data after it's been added to an AnimationClip
. For the sake of post-processing and general reuse, it would be good if there was a way of obtaining a Curve
from an AnimationCurve
. This would allow, for example, the curve to be inspected, sampled, etc. without needing to actually animate something.
What solution would you like?
Use the type registry to register pointers that allow conversion dyn AnimationCurve -> dyn Curve<T>
when the type of the property being animated is known extrinsically. Ideally, these could be packaged together with some utilities in order to allow something like a Box< dyn Curve<Transform>>
to be extracted from an AnimationClip
together with a target ID. (Note that Curve<Transform>
is actually not quite the right idea, since not every property of the Transform
may actually be animated.)
What alternative(s) have you considered?
Do something hacky and hijack the AnimationGraph
machinery in order to get it to read out values instead of animating things. Alternatively, attempt to downcast the AnimationCurve
types directly into the types used by the glTF loader.