2022-01-12 10:06:03 +03:00
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace UnityEditor.Timeline
|
|
|
|
{
|
|
|
|
enum TimelineModeGUIState
|
|
|
|
{
|
|
|
|
Disabled,
|
|
|
|
Hidden,
|
|
|
|
Enabled
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class TimelineMode
|
|
|
|
{
|
|
|
|
public struct HeaderState
|
|
|
|
{
|
|
|
|
public TimelineModeGUIState breadCrumb;
|
|
|
|
public TimelineModeGUIState sequenceSelector;
|
|
|
|
public TimelineModeGUIState options;
|
|
|
|
}
|
|
|
|
|
|
|
|
public struct TrackOptionsState
|
|
|
|
{
|
|
|
|
public TimelineModeGUIState newButton;
|
|
|
|
public TimelineModeGUIState editAsAssetButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
public HeaderState headerState { get; protected set; }
|
|
|
|
public TrackOptionsState trackOptionsState { get; protected set; }
|
|
|
|
public TimelineModes mode { get; protected set; }
|
|
|
|
|
|
|
|
public abstract bool ShouldShowPlayRange(WindowState state);
|
|
|
|
public abstract bool ShouldShowTimeCursor(WindowState state);
|
|
|
|
|
|
|
|
public virtual bool ShouldShowTrackBindings(WindowState state)
|
|
|
|
{
|
|
|
|
return ShouldShowTimeCursor(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual bool ShouldShowTimeArea(WindowState state)
|
|
|
|
{
|
|
|
|
return !state.IsEditingAnEmptyTimeline();
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract TimelineModeGUIState TrackState(WindowState state);
|
|
|
|
public abstract TimelineModeGUIState ToolbarState(WindowState state);
|
|
|
|
|
|
|
|
public virtual TimelineModeGUIState PreviewState(WindowState state)
|
|
|
|
{
|
2022-01-12 10:39:15 +03:00
|
|
|
return state.ignorePreview ? TimelineModeGUIState.Disabled : TimelineModeGUIState.Enabled;
|
2022-01-12 10:06:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public virtual TimelineModeGUIState EditModeButtonsState(WindowState state)
|
|
|
|
{
|
|
|
|
return TimelineModeGUIState.Enabled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Different mode for Timeline
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
[Flags]
|
2022-01-12 10:39:15 +03:00
|
|
|
public enum TimelineModes
|
2022-01-12 10:06:03 +03:00
|
|
|
{
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// A playable director with a valid timeline is selected in editor.
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
Active = 1,
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// The timeline is not editable. (the TimelineAsset file is either readonly on disk or locked by source control).
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
ReadOnly = 2,
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// The timeline cannot be played or previewed.
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
Inactive = 4,
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Disabled Timeline.
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
Disabled = 8,
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Timeline in AssetEditing mode.
|
|
|
|
/// This mode is enabled when a timeline asset is selected in the project window.
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
AssetEdition = 16,
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// The timeline can be edited (either through playable director or selected timeline asset in project window).
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
Default = Active | AssetEdition
|
|
|
|
}
|
|
|
|
}
|