aboutsummaryrefslogtreecommitdiff
path: root/Assets/Cinemachine/Timeline/CinemachineTrack.cs
diff options
context:
space:
mode:
authorTom Harley2018-09-03 23:34:21 +0100
committerTom Harley2018-09-03 23:36:01 +0100
commit5440734d820606b29a795c46172ade5d7eba8efb (patch)
tree85867f40afb02cfa2a5028b515ed0a195866b7e9 /Assets/Cinemachine/Timeline/CinemachineTrack.cs
downloadpowerless-5440734d820606b29a795c46172ade5d7eba8efb.tar.gz
powerless-5440734d820606b29a795c46172ade5d7eba8efb.zip

Initial commit

Diffstat (limited to 'Assets/Cinemachine/Timeline/CinemachineTrack.cs')
-rw-r--r--Assets/Cinemachine/Timeline/CinemachineTrack.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Assets/Cinemachine/Timeline/CinemachineTrack.cs b/Assets/Cinemachine/Timeline/CinemachineTrack.cs
new file mode 100644
index 0000000..44502cf
--- /dev/null
+++ b/Assets/Cinemachine/Timeline/CinemachineTrack.cs
@@ -0,0 +1,32 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+namespace Cinemachine.Timeline
+{
+ [Serializable]
+ [TrackClipType(typeof(CinemachineShot))]
+ [TrackMediaType(TimelineAsset.MediaType.Script)]
+ [TrackBindingType(typeof(CinemachineBrain))]
+ [TrackColor(0.53f, 0.0f, 0.08f)]
+ public class CinemachineTrack : TrackAsset
+ {
+ public override Playable CreateTrackMixer(
+ PlayableGraph graph, GameObject go, int inputCount)
+ {
+ // Hack to set the display name of the clip to match the vcam
+ foreach (var c in GetClips())
+ {
+ CinemachineShot shot = (CinemachineShot)c.asset;
+ CinemachineVirtualCameraBase vcam = shot.VirtualCamera.Resolve(graph.GetResolver());
+ if (vcam != null)
+ c.displayName = vcam.Name;
+ }
+
+ var mixer = ScriptPlayable<CinemachineMixer>.Create(graph);
+ mixer.SetInputCount(inputCount);
+ return mixer;
+ }
+ }
+}