Add minor UI improvements for timeline and curves editing

This commit is contained in:
Wojtek Figat
2021-09-20 16:54:11 +02:00
parent 38fad38b0c
commit f547e44d3d
4 changed files with 9 additions and 9 deletions

View File

@@ -480,6 +480,7 @@ namespace FlaxEditor.GUI
cm.AddButton(totalSelectionCount == 1 ? "Copy keyframe" : "Copy keyframes", () => _editor.CopyKeyframes(point));
}
cm.AddButton("Paste keyframes", () => KeyframesEditorUtils.Paste(_editor, point?.Time ?? _cmShowPos.X)).Enabled = KeyframesEditorUtils.CanPaste();
cm.AddSeparator();
cm.AddButton("Edit all keyframes", () => _editor.EditAllKeyframes(this, location));
cm.AddButton("Select all keyframes", _editor.SelectAll);
cm.AddButton("Copy all keyframes", () =>

View File

@@ -1407,13 +1407,14 @@ namespace FlaxEditor.GUI
}
// Adjust contents bounds to fill the curve area
if (EnablePanning != UseMode.Off)
if (EnablePanning != UseMode.Off || !ShowCollapsed)
{
bounds.Width = Mathf.Max(bounds.Width, 1.0f);
bounds.Height = Mathf.Max(bounds.Height, 1.0f);
bounds.Location = ApplyUseModeMask(EnablePanning, bounds.Location, _contents.Location);
bounds.Size = ApplyUseModeMask(EnablePanning, bounds.Size, _contents.Size);
_contents.Bounds = bounds;
if (!_contents._isMovingSelection)
_contents.Bounds = bounds;
}
else if (_contents.Bounds == Rectangle.Empty)
{
@@ -2124,7 +2125,7 @@ namespace FlaxEditor.GUI
}
// Adjust contents bounds to fill the curve area
if (EnablePanning != UseMode.Off)
if (EnablePanning != UseMode.Off || !ShowCollapsed)
{
bounds.Width = Mathf.Max(bounds.Width, 1.0f);
bounds.Height = Mathf.Max(bounds.Height, 1.0f);

View File

@@ -427,6 +427,7 @@ namespace FlaxEditor.GUI
cm.AddButton(totalSelectionCount == 1 ? "Copy keyframe" : "Copy keyframes", () => _editor.CopyKeyframes(point));
}
cm.AddButton("Paste keyframes", () => KeyframesEditorUtils.Paste(_editor, point?.Time ?? _cmShowPos.X)).Enabled = KeyframesEditorUtils.CanPaste();
cm.AddSeparator();
if (_editor.EnableKeyframesValueEdit)
cm.AddButton("Edit all keyframes", () => _editor.EditAllKeyframes(this, location));
cm.AddButton("Select all keyframes", _editor.SelectAll).Enabled = _editor._points.Count > 0;

View File

@@ -307,6 +307,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
ScrollBars = ScrollBars.None,
DefaultValue = 1.0f,
ShowStartEndLines = true,
ShowBackground = false,
};
Curve.Edited += OnCurveEdited;
Curve.EditingStart += OnCurveEditingStart;
@@ -489,13 +490,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve.KeyframesEditorContext = Timeline;
Curve.CustomViewPanning = Timeline.OnKeyframesViewPanning;
Curve.Bounds = new Rectangle(_audioMedia.X, Y + 1.0f, _audioMedia.Width, Height - 2.0f);
var expanded = IsExpanded;
if (expanded)
{
//Curve.ViewScale = new Vector2(1.0f, CurveEditor<float>.UnitsPerSecond / Curve.Height);
Curve.ViewScale = new Vector2(Timeline.Zoom, 0.4f);
Curve.ViewOffset = new Vector2(0.0f, 30.0f);
Curve.ViewScale = new Vector2(Timeline.Zoom, 0.7f);
Curve.ViewOffset = new Vector2(0.0f, 35.0f);
}
else
{
@@ -503,9 +502,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve.ViewOffset = Vector2.Zero;
}
Curve.ShowCollapsed = !expanded;
Curve.ShowBackground = expanded;
Curve.ShowAxes = expanded ? CurveEditorBase.UseMode.Horizontal : CurveEditorBase.UseMode.Off;
Curve.Visible = Visible;
Curve.UpdateKeyframes();
}