CreatePlayableGraph() private method

private CreatePlayableGraph ( PlayableGraph graph, GameObject go, UnityEngine.Timeline.IntervalTree tree, Playable timelinePlayable ) : Playable
graph PlayableGraph
go GameObject
tree UnityEngine.Timeline.IntervalTree
timelinePlayable Playable
return Playable
Example #1
0
        Playable CreateTrackPlayable(PlayableGraph graph, Playable timelinePlayable, TrackAsset track, GameObject go, bool createOutputs)
        {
            if (!track.IsCompilable()) // where parents are not compilable (group tracks)
            {
                return(timelinePlayable);
            }

            Playable playable;

            if (m_PlayableCache.TryGetValue(track, out playable))
            {
                return(playable);
            }

            if (track.name == "root")
            {
                return(timelinePlayable);
            }

            TrackAsset parentActor    = track.parent as TrackAsset;
            var        parentPlayable = parentActor != null?CreateTrackPlayable(graph, timelinePlayable, parentActor, go, createOutputs) : timelinePlayable;

            var  actorPlayable = track.CreatePlayableGraph(graph, go, m_IntervalTree, timelinePlayable);
            bool connected     = false;

            if (!actorPlayable.IsValid())
            {
                // if a track says it's compilable, but returns Playable.Null, that can screw up the whole graph.
                throw new InvalidOperationException(track.name + "(" + track.GetType() + ") did not produce a valid playable.");
            }


            // Special case for animation tracks
            if (parentPlayable.IsValid() && actorPlayable.IsValid())
            {
                int port = parentPlayable.GetInputCount();
                parentPlayable.SetInputCount(port + 1);
                connected = graph.Connect(actorPlayable, 0, parentPlayable, port);
                parentPlayable.SetInputWeight(port, 1.0f);
            }

            if (createOutputs && connected)
            {
                CreateTrackOutput(graph, track, go, parentPlayable, parentPlayable.GetInputCount() - 1);
            }

            CacheTrack(track, actorPlayable, connected ? (parentPlayable.GetInputCount() - 1) : -1, parentPlayable);
            return(actorPlayable);
        }
 private static Playable CreatePlayableGraph(PlayableGraph graph, TrackAsset asset, GameObject go, IntervalTree <RuntimeElement> tree, Playable timelinePlayable)
 {
     return(asset.CreatePlayableGraph(graph, go, tree, timelinePlayable));
 }