You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
51 lines
1.9 KiB
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Timeline;
|
|
using UnityEngine.Video;
|
|
|
|
namespace uc.Timeline
|
|
{
|
|
[Serializable]
|
|
[TrackClipType(typeof(MoviePlayerClip))]
|
|
//[TrackMediaType(TimelineAsset.MediaType.Script)]
|
|
[TrackBindingType(typeof(MoviePlayerBase))]
|
|
[TrackColor(0.53f, 0.0f, 0.08f)]
|
|
//[SupportsChildTracks(typeof(MoviePlayerTrack), 1)]
|
|
public class MoviePlayerTrack : TrackAsset
|
|
{
|
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
|
{
|
|
//Debug.Log("MoviePlayerTrack.CreateTrackMixer");
|
|
// Hack to set the display name of the clip to match the vcam
|
|
foreach (var c in GetClips())
|
|
{
|
|
MoviePlayerClip shot = (MoviePlayerClip)c.asset;
|
|
//CinemachineVirtualCameraBase vcam = shot.VirtualCamera.Resolve(graph.GetResolver());
|
|
if(shot.movie != null)
|
|
c.displayName = shot.movie.VideoAsset.fullPath;
|
|
}
|
|
|
|
var mixer = ScriptPlayable<MoviePlayerMixer>.Create(graph);
|
|
mixer.SetInputCount(inputCount);
|
|
return mixer;
|
|
}
|
|
|
|
#if UNITY_2018_1_OR_NEWER
|
|
internal protected new Playable CreatePlayable(PlayableGraph graph, GameObject go, TimelineClip clip)
|
|
#else
|
|
protected override Playable CreatePlayable(PlayableGraph graph, GameObject go, TimelineClip clip)
|
|
#endif
|
|
{
|
|
//Debug.Log("MoviePlayerTrack.CreatePlayable");
|
|
PlayableDirector d = go.GetComponent<PlayableDirector>();
|
|
if (d != null)
|
|
{
|
|
MoviePlayerBase movie = d.GetGenericBinding(this) as MoviePlayerBase;
|
|
if (movie != null && clip.asset is MoviePlayerClip)
|
|
(clip.asset as MoviePlayerClip).movie = movie;
|
|
}
|
|
return base.CreatePlayable(graph, go, clip);
|
|
}
|
|
}
|
|
}
|
|
|