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

Add support for per-ruleset skin layouts #22673

Merged
merged 18 commits into from
Feb 20, 2023
Merged

Conversation

peppy
Copy link
Member

@peppy peppy commented Feb 17, 2023

This builds off @frenzibyte's original proposal (see #20694) and mostly implements things in a similar way.

Of note, each skin components container can now have both global and per-ruleset components defined. This is done by serialising a new SkinLayoutInfo type rather than a naked IEnumerable<SerialisableDrawableInfo>. Includes "migration" from previous skins via advanced try-catch checking.

This completes a good portion of #22388, but does not yet add updated defaults to, for instance, correct non-matching layouts in legacy skins (mania / taiko).

@peppy peppy force-pushed the skin-per-ruleset-layouts branch from 2e3bbd3 to a01c309 Compare February 17, 2023 10:27
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial read-through. Haven't done much testing yet.

osu.Game/Skinning/SkinComponentsContainerLookup.cs Outdated Show resolved Hide resolved
osu.Game/Skinning/SkinLayoutInfo.cs Outdated Show resolved Hide resolved
Comment on lines 131 to 134
// handle namespace changes...
// can be removed 2023-01-31
jsonContent = jsonContent.Replace(@"osu.Game.Screens.Play.SongProgress", @"osu.Game.Screens.Play.HUD.DefaultSongProgress");
jsonContent = jsonContent.Replace(@"osu.Game.Screens.Play.HUD.LegacyComboCounter", @"osu.Game.Skinning.LegacyComboCounter");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these while we're here? The deprecation date is up on these anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you touched on in your other comment, this deprecation notice relies on the user having edited skins since the change. I've been holding off removing these because I'm scared it will cause breakage.

As you say, it's probably best we force migration at some point so I'll remove the deprecation notice here and update the comments.

{
}

// if that fails, attempt to deserialise using the old naked list.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we putting a deprecation date on this pathway, or is it going to have to live forever? Right now it's on the read side, so to get rid of it we'd have to automigrate users' skins somehow I imagine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'll do this one day. I'll note this in the inline comments.

osu.Game/Skinning/SkinComponentsContainer.cs Show resolved Hide resolved
peppy and others added 8 commits February 20, 2023 19:47
- It is entirely derived from `SkinLayoutInfo.DrawableInfo`, which is
  the actual primary thing we want to serialise.
- It will never get read out from any serialised files anyway (corollary
  of the previous point - it is a get-only property derived from another).
- It is only used in tests.

All of the three reasons above make serialising the property out to skin
files nothing more than a waste of space.
@bdach
Copy link
Collaborator

bdach commented Feb 20, 2023

This seems pretty alright, and it doesn't seem to break under some light testing. I did apply a few fixups: one is just a slight comment reword (4372447), while the second is slightly more major but I'm pretty sure it shouldn't be controversial by any means - upon inspecting exported skin files, I noticed that SkinLayoutInfo.AllDrawables was being unnecessarily serialised out, so I [JsonIgnore]d it (86a7f4d).

To speed things up some I'll queue this up for merge now. Let's see where this goes next 👍

@bdach bdach enabled auto-merge February 20, 2023 19:50
@bdach bdach disabled auto-merge February 20, 2023 20:33
@bdach bdach merged commit 8818341 into ppy:master Feb 20, 2023
@peppy peppy deleted the skin-per-ruleset-layouts branch February 21, 2023 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants