Skip to content

Commit

Permalink
Don't allow placement of IConfigurableDrawables
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed May 14, 2024
1 parent a998ad2 commit cb15f96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osu.Game/Overlays/SkinEditor/SkinComponentToolbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private void reloadComponents()
fill.Clear();

var skinnableTypes = SerialisedDrawableInfo.GetAllAvailableDrawables(ruleset);

foreach (var type in skinnableTypes)
attemptAddComponent(type);
}
Expand All @@ -82,6 +83,10 @@ private void attemptAddComponent(Type type)
Expanding = contractOtherButtons,
});
}
catch (MissingMethodException)
{
// Some components may not have a primary constructure (ie. IConfigurableDrawables that aren't supposed to be placed by a user).
}
catch (DependencyNotRegisteredException)
{
// This loading code relies on try-catching any dependency injection errors to know which components are valid for the current target screen.
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Skinning/IConfigurableDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ public interface IConfigurableDrawable : ISerialisableDrawable
/// Will be called to restore a sane and known state.
/// </summary>
void ApplyDefaults();

bool ISerialisableDrawable.IsPlaceable => false;
}
}

0 comments on commit cb15f96

Please sign in to comment.