The timeline editor for animation asset.
| 15 | /// </summary> |
| 16 | /// <seealso cref="FlaxEditor.GUI.Timeline.Timeline" /> |
| 17 | public sealed class AnimationTimeline : Timeline |
| 18 | { |
| 19 | private sealed class Proxy : ProxyBase<AnimationTimeline> |
| 20 | { |
| 21 | /// <inheritdoc /> |
| 22 | public Proxy(AnimationTimeline timeline) |
| 23 | : base(timeline) |
| 24 | { |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | private AnimationPreview _preview; |
| 29 | internal Guid _id; |
| 30 | |
| 31 | /// <summary> |
| 32 | /// Gets or sets the animated preview used for the animation playback. |
| 33 | /// </summary> |
| 34 | public AnimationPreview Preview |
| 35 | { |
| 36 | get => _preview; |
| 37 | set |
| 38 | { |
| 39 | if (_preview == value) |
| 40 | return; |
| 41 | _preview = value; |
| 42 | value?.PreviewActor.UpdateAnimation(); |
| 43 | UpdatePlaybackState(); |
| 44 | PreviewChanged?.Invoke(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /// <summary> |
| 49 | /// Occurs when the selected animated model preview gets changed. |
| 50 | /// </summary> |
| 51 | public event Action PreviewChanged; |
| 52 | |
| 53 | /// <summary> |
| 54 | /// Initializes a new instance of the <see cref="AnimationTimeline"/> class. |
| 55 | /// </summary> |
| 56 | /// <param name="undo">The undo/redo to use for the history actions recording. Optional, can be null to disable undo support.</param> |
| 57 | public AnimationTimeline(FlaxEditor.Undo undo) |
| 58 | : base(PlaybackButtons.Play | PlaybackButtons.Stop, undo, false, true) |
| 59 | { |
| 60 | PlaybackState = PlaybackStates.Seeking; |
| 61 | ShowPreviewValues = false; |
| 62 | PropertiesEditObject = new Proxy(this); |
| 63 | |
| 64 | // Setup track types |
| 65 | TrackArchetypes.Add(AnimationChannelTrack.GetArchetype()); |
| 66 | TrackArchetypes.Add(AnimationChannelDataTrack.GetArchetype()); |
| 67 | TrackArchetypes.Add(AnimationEventTrack.GetArchetype()); |
| 68 | TrackArchetypes.Add(NestedAnimationTrack.GetArchetype()); |
| 69 | } |
| 70 | |
| 71 | /// <summary> |
| 72 | /// Loads the timeline from the specified <see cref="FlaxEngine.Animation"/> asset. |
| 73 | /// </summary> |
| 74 | /// <param name="asset">The asset.</param> |
nothing calls this directly
no test coverage detected