Fixes for timeline editing

This commit is contained in:
Wojtek Figat
2021-09-02 16:43:56 +02:00
parent 7ed3c61b53
commit 6dcc9f85c6
2 changed files with 8 additions and 4 deletions

View File

@@ -580,7 +580,7 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public override void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end)
{
if (_points.Count == 0)
if (SelectionCount == 0)
return;
location = _contents.PointFromParent(control, location);
if (start)

View File

@@ -78,7 +78,7 @@ namespace FlaxEditor.GUI
internal Vector2 _mousePos = Vector2.Minimum;
private Vector2 _movingViewLastPos;
internal bool _isMovingSelection;
internal bool _movedKeyframes;
private bool _movedKeyframes;
private float _movingSelectionStart;
private float[] _movingSelectionOffsets;
private Vector2 _cmShowPos;
@@ -1328,6 +1328,8 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end)
{
if (SelectionCount == 0)
return;
location = _contents.PointFromParent(control, location);
if (start)
_contents.OnMoveStart(location);
@@ -1340,7 +1342,7 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public void OnKeyframesCopy(IKeyframesEditor editor, float? timeOffset, StringBuilder data)
{
if (SelectionCount == 0)
if (SelectionCount == 0 || DefaultValue == null)
return;
var offset = timeOffset ?? 0.0f;
data.AppendLine(KeyframesEditorUtils.CopyPrefix);
@@ -1358,6 +1360,8 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public void OnKeyframesPaste(IKeyframesEditor editor, float? timeOffset, string[] datas, ref int index)
{
if (DefaultValue == null)
return;
if (index == -1)
{
if (editor == this)
@@ -1369,7 +1373,7 @@ namespace FlaxEditor.GUI
return;
var data = datas[index];
var offset = timeOffset ?? 0.0f;
var eps = FPS.HasValue ? 1.0f / FPS.Value : Mathf.Epsilon;
var eps = FPS.HasValue ? 0.5f / FPS.Value : Mathf.Epsilon;
try
{
var lines = data.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);