diff --git a/Source/Editor/GUI/Timeline/Media.cs b/Source/Editor/GUI/Timeline/Media.cs index 7183d330e..5f90b6799 100644 --- a/Source/Editor/GUI/Timeline/Media.cs +++ b/Source/Editor/GUI/Timeline/Media.cs @@ -45,15 +45,27 @@ namespace FlaxEditor.GUI.Timeline } /// - /// Gets or sets the total duration of the media event in the timeline sequence frames amount. + /// Gets or sets the total duration of the media event (in frames). /// - [EditorDisplay("General"), EditorOrder(-1000), Limit(1), Tooltip("Total duration of the media event in the timeline sequence frames amount.")] + [EditorDisplay("General"), EditorOrder(-1000), Limit(1), VisibleIf(nameof(UseFrames)), Tooltip("Total duration of the media event (in frames).")] public int DurationFrames { get => Media.DurationFrames; set => Media.DurationFrames = value; } + /// + /// Gets or sets the total duration of the timeline (in seconds). + /// + [EditorDisplay("General"), EditorOrder(-1000), Limit(0.0f, float.MaxValue, 0.001f), VisibleIf(nameof(UseFrames), true), Tooltip("Total duration of the timeline (in seconds).")] + public float Duration + { + get => Media.Duration; + set => Media.Duration = value; + } + + private bool UseFrames => Media.Timeline.TimeShowMode == Timeline.TimeShowModes.Frames; + /// /// Initializes a new instance of the class. /// diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs index 437f34bc1..3e3b303f4 100644 --- a/Source/Editor/GUI/Timeline/Timeline.cs +++ b/Source/Editor/GUI/Timeline/Timeline.cs @@ -141,15 +141,27 @@ namespace FlaxEditor.GUI.Timeline public TTimeline Timeline; /// - /// Gets or sets the total duration of the timeline in the frames amount. + /// Gets or sets the total duration of the timeline (in frames). /// - [EditorDisplay("General"), EditorOrder(10), Limit(1), Tooltip("Total duration of the timeline event the frames amount.")] + [EditorDisplay("General"), EditorOrder(10), Limit(1), VisibleIf(nameof(UseFrames)), Tooltip("Total duration of the timeline (in frames).")] public int DurationFrames { get => Timeline.DurationFrames; set => Timeline.DurationFrames = value; } + /// + /// Gets or sets the total duration of the timeline (in seconds). + /// + [EditorDisplay("General"), EditorOrder(10), Limit(0.0f, float.MaxValue, 0.001f), VisibleIf(nameof(UseFrames), true), Tooltip("Total duration of the timeline (in seconds).")] + public float Duration + { + get => Timeline.Duration; + set => Timeline.Duration = value; + } + + private bool UseFrames => Timeline.TimeShowMode == TimeShowModes.Frames; + /// /// Initializes a new instance of the class. ///