Add the option to deselect all whereve there is a select all, Refactor much of the codebase to use keybinds from InputOptions.

This commit is contained in:
Menotdan
2023-12-08 20:16:07 -05:00
parent bcce52ca22
commit 13cc45c3d7
13 changed files with 179 additions and 65 deletions

View File

@@ -433,6 +433,7 @@ namespace FlaxEditor.GUI
if (_editor.EnableKeyframesValueEdit)
cm.AddButton("Edit all keyframes", () => _editor.EditAllKeyframes(this, location));
cm.AddButton("Select all keyframes", _editor.SelectAll).Enabled = _editor._points.Count > 0;
cm.AddButton("Deselect all keyframes", _editor.DeselectAll).Enabled = _editor._points.Count > 0;
cm.AddButton("Copy all keyframes", () =>
{
_editor.SelectAll();
@@ -1210,15 +1211,28 @@ namespace FlaxEditor.GUI
}
}
private void BulkSelectUpdate(bool select = true)
{
for (int i = 0; i < _points.Count; i++)
{
_points[i].IsSelected = select;
}
}
/// <summary>
/// Selects all keyframes.
/// </summary>
public void SelectAll()
{
for (int i = 0; i < _points.Count; i++)
{
_points[i].IsSelected = true;
}
BulkSelectUpdate(true);
}
/// <summary>
/// Deselects all keyframes.
/// </summary>
public void DeselectAll()
{
BulkSelectUpdate(false);
}
/// <inheritdoc />
@@ -1275,6 +1289,11 @@ namespace FlaxEditor.GUI
SelectAll();
return true;
}
else if (options.DeselectAll.Process(this))
{
DeselectAll();
return true;
}
else if (options.Delete.Process(this))
{
RemoveKeyframes();