Is there a way to access the animation clips created in the playable editor through the playable API?
I created a playable that I play with a playable director, but I can’t seem to find a way to access dynamically the animation clips the playable contains through code.
Yes I suppose: I mean that I have a playable director attached to a game object, I created a playable with a timeline and I start it with the director in a script.
In fact, I could extend my question to any properties modified in a playable: Is there any way to access to data of the key frames inside a playable asset, to get and set the values used by a key frame of a specific animation?
If you convert your animation tracks to clip tracks, you can access the animation clips through the timeline API. You can edit the clips using the AnimationUtility class, just like any other clip.
var timelineAsset = playableDirector.playableAsset as TimelineAsset;
foreach(var track in timelineAsset.GetOutputTracks())
{
var animTrack = track as AnimationTrack;
if (animTrack != null)
{
foreach (var clips in animTrack.GetClips())
{
var animAsset = clips.asset as AnimationPlayableAsset;
if (animAsset)
{
AnimationClip clip = animAsset.clip;
...
}
}
}
}
If you want the keyframes from a generic playable animation, that is stored in TimelineClip.curves.