TrackDrawer.cs
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace UnityEditor.Timeline
{
class TrackDrawer : GUIDrawer
{
internal WindowState sequencerState { get; set; }
public static TrackDrawer CreateInstance(TrackAsset trackAsset)
{
if (trackAsset == null)
return Activator.CreateInstance<TrackDrawer>();
TrackDrawer drawer;
try
{
drawer = (TrackDrawer)Activator.CreateInstance(TimelineHelpers.GetCustomDrawer(trackAsset.GetType()));
}
catch (Exception)
{
drawer = Activator.CreateInstance<TrackDrawer>();
}
drawer.track = trackAsset;
return drawer;
}
protected TrackAsset track { get; private set; }
public virtual bool DrawTrackHeaderButton(Rect rect, TrackAsset track, WindowState state)
{
return false;
}
public virtual bool DrawTrack(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
{
return false;
}
public virtual void DrawRecordingBackground(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
{
EditorGUI.DrawRect(trackRect, DirectorStyles.Instance.customSkin.colorTrackBackgroundRecording);
}
}
}