示例#1
0
        public void RegisterSignalReceiver(PlayableGraph graph)
        {
            var outputCount = graph.GetOutputCount();

            for (int i = 0; i < outputCount; i++)
            {
                var output = graph.GetOutput(i);

                output.AddNotificationReceiver(signalReceiver);
            }
        }
示例#2
0
        public static bool TryFindTimelinePlayable(PlayableGraph graph, out Playable timelinePlayable)
        {
            timelinePlayable = Playable.Null;

            if (!graph.IsValid())
            {
                Debug.LogError("Cant find TimelinePlayable: PlayableGraph is not valid");
                return(false);
            }

            bool TraverseSearchTimelinePlayable(Playable pl, ref Playable timeline)
            {
                if (timeline.IsValid())
                {
                    return(true);
                }
                if (pl.IsValid() && pl.GetPlayableType() == typeof(TimelinePlayable))
                {
                    timeline = pl;
                    return(true);
                }

                for (var k = 0; k < pl.GetInputCount(); k++)
                {
                    var input = pl.GetInput(k);
                    if (TraverseSearchTimelinePlayable(input, ref timeline))
                    {
                        break;
                    }
                }

                return(timeline.IsValid());
            }

            for (var i = 0; i < graph.GetOutputCount(); i++)
            {
                var rootOutput = graph.GetRootPlayable(i);
                if (TraverseSearchTimelinePlayable(rootOutput, ref timelinePlayable))
                {
                    break;
                }
            }

            return(timelinePlayable.IsValid());
        }
    protected override void Populate()
    {
        if (!m_PlayableGraph.IsValid())
        {
            return;
        }

        int outputs = m_PlayableGraph.GetOutputCount();

        for (int i = 0; i < outputs; i++)
        {
            var output = m_PlayableGraph.GetOutput(i);
            if (output.IsOutputValid())
            {
                AddNodeHierarchy(CreateNodeFromPlayableOutput(output));
            }
        }
    }