// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
using System.IO;
using FlaxEditor.Utilities;
using FlaxEngine;
namespace FlaxEditor.GUI.Timeline.Tracks
{
///
/// The timeline track for animating objects.
///
///
public sealed class ScriptTrack : ObjectTrack
{
///
/// Gets the archetype.
///
/// The archetype.
public static TrackArchetype GetArchetype()
{
return new TrackArchetype
{
TypeId = 8,
Name = "Script",
DisableSpawnViaGUI = true,
Create = options => new ScriptTrack(ref options),
Load = LoadTrack,
Save = SaveTrack,
};
}
private static void LoadTrack(int version, Track track, BinaryReader stream)
{
var e = (ScriptTrack)track;
e.ScriptID = stream.ReadGuid();
}
private static void SaveTrack(Track track, BinaryWriter stream)
{
var e = (ScriptTrack)track;
stream.WriteGuid(ref e.ScriptID);
}
///
/// The object ID.
///
public Guid ScriptID;
///
/// Gets the object instance (it might be missing).
///
public Script Script
{
get => FlaxEngine.Object.TryFind