using System.Collections.Generic;
namespace UnityEditor.Timeline
{
///
/// Interface to navigate through Timelines and SubTimelines for the Timeline window.
///
///
/// TimelineNavigator gives you access to the Timeline window breadcrumbs functionality. Use it to programmatically
/// dig into SubTimelines, navigate to parent Timelines or navigate Timeline Window breadcrumbs.
///
public sealed class TimelineNavigator
{
TimelineWindow.TimelineNavigatorImpl m_Impl;
internal TimelineNavigator(IWindowStateProvider windowState)
{
m_Impl = new TimelineWindow.TimelineNavigatorImpl(windowState);
}
///
/// Gets the SequenceContext associated with the Timeline currently shown in the Timeline window.
///
/// The SequenceContext associated with the Timeline currently shown in the Timeline window.
/// Equivalent to TimelineNavigator.GetBreadCrumbs().Last()
/// The Window associated to this instance has been destroyed.
public SequenceContext GetCurrentContext()
{
return m_Impl.GetCurrentContext();
}
///
/// Gets the parent SequenceContext for the Timeline currently shown in the Timeline window.
///
/// The parent SequenceContext for the Timeline currently shown in the Timeline window if there is one; an invalid SequenceContext otherwise.
/// The Window associated to this instance has been destroyed.
public SequenceContext GetParentContext()
{
return m_Impl.GetParentContext();
}
///
/// Gets the first SequenceContext in the breadcrumbs.
///
/// The first SequenceContext in the breadcrumbs.
/// Equivalent to TimelineNavigator.GetBreadCrumbs().First()
/// The Window associated to this instance has been destroyed.
public SequenceContext GetRootContext()
{
return m_Impl.GetRootContext();
}
///
/// Gets the collection of child contexts that can be navigated to from the current context.
///
/// The collection of child contexts that can be navigated to from the current context.
/// The Window associated to this instance has been destroyed.
public IEnumerable GetChildContexts()
{
return m_Impl.GetChildContexts();
}
///
/// Gets the collection of SequenceContexts associated with the breadcrumbs shown in the TimelineEditorWindow.
///
/// This operation can be expensive. Consider caching the results instead of calling the method multiple times.
/// The collection of SequenceContexts associated with the breadcrumbs shown in the TimelineEditorWindow, from the root context to the current context.
/// The Window associated to this instance has been destroyed.
public IEnumerable GetBreadcrumbs()
{
return m_Impl.GetBreadcrumbs();
}
///
/// Navigates to a new SequenceContext.
///
/// The context to navigate to.
///
/// The SequenceContext provided must be a valid navigation destination.
///
/// Valid navigation destinations:
/// * The parent context returned by .
/// * The root context returned by .
/// * Any SequenceContext returned by .
/// * Any SequenceContext returned by .
///
/// Note: This method cannot be used to change the root SequenceContext. To change the root SequenceContext, use .
///
///
/// The Window associated to this instance has been destroyed.
/// The context is not valid.
/// The context is not a valid navigation destination.
public void NavigateTo(SequenceContext context)
{
m_Impl.NavigateTo(context);
}
}
}