Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of editor tables #28613

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.625.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.627.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
189 changes: 0 additions & 189 deletions osu.Game/Screens/Edit/EditorTable.cs

This file was deleted.

19 changes: 19 additions & 0 deletions osu.Game/Screens/Edit/TableHeaderText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;

namespace osu.Game.Screens.Edit
{
public partial class TableHeaderText : OsuSpriteText
{
public TableHeaderText(LocalisableString text)
{
Text = text.ToUpper();
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold);
}
}
}
38 changes: 2 additions & 36 deletions osu.Game/Screens/Edit/Timing/ControlPointList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
Expand All @@ -21,12 +19,8 @@ namespace osu.Game.Screens.Edit.Timing
public partial class ControlPointList : CompositeDrawable
{
private OsuButton deleteButton = null!;
private ControlPointTable table = null!;
private OsuScrollContainer scroll = null!;
private RoundedButton addButton = null!;

private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();

[Resolved]
private EditorClock clock { get; set; } = null!;

Expand All @@ -36,9 +30,6 @@ public partial class ControlPointList : CompositeDrawable
[Resolved]
private Bindable<ControlPointGroup?> selectedGroup { get; set; } = null!;

[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }

[BackgroundDependencyLoader]
private void load(OverlayColourProvider colours)
{
Expand All @@ -47,21 +38,10 @@ private void load(OverlayColourProvider colours)
const float margins = 10;
InternalChildren = new Drawable[]
{
new Box
new ControlPointTable
{
Colour = colours.Background4,
RelativeSizeAxes = Axes.Both,
},
new Box
{
Colour = colours.Background3,
RelativeSizeAxes = Axes.Y,
Width = ControlPointTable.TIMING_COLUMN_WIDTH + margins,
},
scroll = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = table = new ControlPointTable(),
Groups = { BindTarget = Beatmap.ControlPointInfo.Groups, },
},
new FillFlowContainer
{
Expand Down Expand Up @@ -105,20 +85,6 @@ protected override void LoadComplete()
? "+ Clone to current time"
: "+ Add at current time";
}, true);

controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((_, _) =>
{
// This callback can happen many times in a change operation. It gets expensive.
// We really should be handling the `CollectionChanged` event properly.
Scheduler.AddOnce(() =>
{
table.ControlGroups = controlPointGroups;
changeHandler?.SaveState();
});
}, true);

table.OnRowSelected += drawable => scroll.ScrollIntoView(drawable);
}

protected override bool OnClick(ClickEvent e)
Expand Down
Loading
Loading