using System.Collections.Generic;
using UnityEngine.Sequences.Timeline;
namespace UnityEditor.Sequences
{
internal partial class SequenceNode
{
///
/// Returns true if the TimelineSequence has at least one related scene ().
///
///
internal bool HasScenes() => GetRelatedScenes().Count > 0;
///
/// Gets all the scenes needed to have the scene context for this clip complete. This includes all upstream,
/// downstream scenes and the scenes of the clip itself.
///
/// A collection of Scene paths.
/// The returned paths are ordered from upstream to downstream.
public IReadOnlyCollection GetRelatedScenes()
{
List paths = new List();
// Get ascendant scenes
if (m_Parent != null)
paths.AddRange(m_Parent.GetAscendantScenes());
// Add local scenes
paths.AddRange(m_Timeline.GetScenes());
// Append descendant scenes
foreach (var child in m_Children)
paths.AddRange(child.GetDescendantScenes());
return paths;
}
///
/// Iterates through all clip parents and gets the Scene paths found in their respective timeline.
/// It also includes the Scene paths from the given clip.
///
///
///
IReadOnlyCollection GetAscendantScenes()
{
List paths = new List();
if (m_Parent != null)
paths.AddRange(m_Parent.GetAscendantScenes());
paths.AddRange(m_Timeline.GetScenes());
return paths;
}
///
/// Iterates through all clip children and gets the Scene paths found in their respective timeline.
/// It also includes the Scene paths from the given clip.
///
///
///
IReadOnlyCollection GetDescendantScenes()
{
List paths = new List();
paths.AddRange(m_Timeline.GetScenes());
foreach (var child in m_Children)
paths.AddRange(child.GetDescendantScenes());
return paths;
}
}
}