diff --git a/Source/Editor/GUI/Timeline/Media.cs b/Source/Editor/GUI/Timeline/Media.cs index 7a958c220..5fd390817 100644 --- a/Source/Editor/GUI/Timeline/Media.cs +++ b/Source/Editor/GUI/Timeline/Media.cs @@ -61,7 +61,11 @@ namespace FlaxEditor.GUI.Timeline public int DurationFrames { get => Media.DurationFrames; - set => Media.DurationFrames = value; + set + { + if (Media.CanResize) + Media.DurationFrames = value; + } } /// @@ -71,7 +75,11 @@ namespace FlaxEditor.GUI.Timeline public float Duration { get => Media.Duration; - set => Media.Duration = value; + set + { + if (Media.CanResize) + Media.Duration = value; + } } private bool UseFrames => Media.Timeline.TimeShowMode == Timeline.TimeShowModes.Frames; @@ -204,6 +212,11 @@ namespace FlaxEditor.GUI.Timeline /// public bool CanDelete; + /// + /// Gets a value indicating whether this media can be resized (duration changed). + /// + public bool CanResize; + /// /// Initializes a new instance of the class. /// @@ -341,7 +354,7 @@ namespace FlaxEditor.GUI.Timeline { Render2D.DrawLine(bounds.UpperLeft, bounds.BottomLeft, moveColor, moveThickness); } - else if (IsMouseOver && MoveLeftEdgeRect.Contains(ref _mouseLocation)) + else if (IsMouseOver && CanResize && MoveLeftEdgeRect.Contains(ref _mouseLocation)) { Render2D.DrawLine(bounds.UpperLeft, bounds.BottomLeft, Color.Yellow); } @@ -349,7 +362,7 @@ namespace FlaxEditor.GUI.Timeline { Render2D.DrawLine(bounds.UpperRight, bounds.BottomRight, moveColor, moveThickness); } - else if (IsMouseOver && MoveRightEdgeRect.Contains(ref _mouseLocation)) + else if (IsMouseOver && CanResize && MoveRightEdgeRect.Contains(ref _mouseLocation)) { Render2D.DrawLine(bounds.UpperRight, bounds.BottomRight, Color.Yellow); } @@ -369,8 +382,8 @@ namespace FlaxEditor.GUI.Timeline _startMoveLocation = Root.MousePosition; _startMoveStartFrame = StartFrame; _startMoveDuration = DurationFrames; - _startMoveLeftEdge = MoveLeftEdgeRect.Contains(ref location); - _startMoveRightEdge = MoveRightEdgeRect.Contains(ref location); + _startMoveLeftEdge = MoveLeftEdgeRect.Contains(ref location) && CanResize; + _startMoveRightEdge = MoveRightEdgeRect.Contains(ref location) && CanResize; StartMouseCapture(true);