Add a default sprite representation to allow better placeholder display in skin editor toolbox

This commit is contained in:
Dean Herbert
2022-04-01 14:46:14 +09:00
parent 52eeaffce3
commit 2b7105ac4f

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osuTK;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -62,7 +63,13 @@ namespace osu.Game.Skinning
var texture = textures.Get(component.LookupName); var texture = textures.Get(component.LookupName);
if (texture == null) if (texture == null)
return null; {
return new SpriteIcon
{
Size = new Vector2(100),
Icon = FontAwesome.Solid.QuestionCircle
};
}
return new Sprite { Texture = texture }; return new Sprite { Texture = texture };
} }
@ -87,7 +94,8 @@ namespace osu.Game.Skinning
{ {
base.LoadComplete(); base.LoadComplete();
Items = Source.AvailableFiles; if (Source.AvailableFiles.Any())
Items = Source.AvailableFiles;
} }
} }
} }