@DavidGeoffroy Apologies for resurrecting this somewhat old thread but I am currently implementing my own Timeline-based system for authoring Abilities which includes many custom tracks and clips driving things like weapon trails, hitboxes, etc.
I have noticed that the default animationtrack has some… odd behavior when you’re trying to play a timeline by connecting it to your own graph at run-time. I believe what I want instead of the built-in AnimationTrack (which includes the AnimationMotionXToDeltaPlayable) is just a raw AnimationMixer for the track’s mixer and a set of animation clips.
I have implemented this and to some extent it is working (the animation plays when the appropriate output from the timeline is plugged into my graph).
However, I am not able to get the Timeline “framework” to create the correct kind of output for my custom track. This only matters when I am trying to preview the Timeline as the output type it is generating (which should be AnimationPlayableOutput is instead a ScriptPlayableOutput).
Any advice here would be greatly appreciated.
[TrackClipType(typeof(AnimationPlayableAsset), false)]
[TrackBindingType(typeof(Animator))]
public class LocalAnimationTrackAsset : TrackAsset {
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) {
return AnimationMixerPlayable.Create(graph, inputCount);
}
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver) {
var animator = director.GetGenericBinding(this) as Animator;
if (animator == null)
return;
foreach (var clip in m_Clips) {
var asset = clip.asset as AnimationPlayableAsset;
if (asset == null)
continue;
Debug.Log($"Added props from {asset.clip.name}");
driver.AddFromClip(asset.clip);
}
}
}
EDIT:
For anyone who might find this thread or post in the future here is how you specify the output for a custom AnimationTrack to get the OutputPlayable to be an AnimationPlayableOutput.
[TrackColor(.25f, .25f, .75f)]
[TrackBindingType(typeof(Animator))]
[TrackClipType(typeof(AnimationPlayableAsset), false)]
public class LocalAnimationTrackAsset : TrackAsset {
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) {
return AnimationMixerPlayable.Create(graph, inputCount);
}
public override IEnumerable<PlayableBinding> outputs {
get {
yield return AnimationPlayableBinding.Create("Animation Binding", this);
}
}
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver) {
var animator = director.GetGenericBinding(this) as Animator;
if (animator == null)
return;
foreach (var clip in m_Clips) {
var asset = clip.asset as AnimationPlayableAsset;
if (asset == null)
continue;
driver.AddFromClip(asset.clip);
}
}
}