diff --git a/Source/Editor/GUI/Timeline/Media.cs b/Source/Editor/GUI/Timeline/Media.cs
index b826e5b6e..5b70312af 100644
--- a/Source/Editor/GUI/Timeline/Media.cs
+++ b/Source/Editor/GUI/Timeline/Media.cs
@@ -185,6 +185,11 @@ namespace FlaxEditor.GUI.Timeline
///
public bool CanSplit;
+ ///
+ /// Gets a value indicating whether this media can be removed.
+ ///
+ public bool CanDelete;
+
///
/// Initializes a new instance of the class.
///
@@ -200,6 +205,8 @@ namespace FlaxEditor.GUI.Timeline
/// The found control under the mouse cursor.
public virtual void OnTimelineShowContextMenu(ContextMenu.ContextMenu menu, Control controlUnderMouse)
{
+ if (CanDelete && Track.Media.Count > Track.MinMediaCount)
+ menu.AddButton("Delete media", Delete);
}
///
@@ -284,6 +291,14 @@ namespace FlaxEditor.GUI.Timeline
return clone;
}
+ ///
+ /// Deletes this media.
+ ///
+ public void Delete()
+ {
+ _timeline.Delete(this);
+ }
+
///
public override void GetDesireClientArea(out Rectangle rect)
{
diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs
index 570caed62..83af3c77e 100644
--- a/Source/Editor/GUI/Timeline/Timeline.cs
+++ b/Source/Editor/GUI/Timeline/Timeline.cs
@@ -1451,7 +1451,7 @@ namespace FlaxEditor.GUI.Timeline
}
///
- /// Deletes the tracks.
+ /// Deletes the track.
///
/// The track to delete (and its sub tracks).
/// True if use undo/redo action for track removing.
@@ -1459,8 +1459,6 @@ namespace FlaxEditor.GUI.Timeline
{
if (track == null)
throw new ArgumentNullException();
-
- // Delete tracks
var tracks = new List