From 1d383024e226f72001902bb3c5587e472aedec9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 May 2021 13:51:29 +0900 Subject: [PATCH 1/3] Improve the visual appearance of skin editor blueprints --- osu.Game/Skinning/Editor/SkinBlueprint.cs | 67 ++++++++++++++++++++--- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index b8dfdbad0a..23411f2b3d 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -2,14 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Edit; using osuTK; +using osuTK.Graphics; namespace osu.Game.Skinning.Editor { @@ -17,14 +19,19 @@ namespace osu.Game.Skinning.Editor { private Container box; + private Container outlineBox; + private Drawable drawable => (Drawable)Item; /// /// Whether the blueprint should be shown even when the is not alive. /// - protected virtual bool AlwaysShowWhenSelected => false; + protected virtual bool AlwaysShowWhenSelected => true; - protected override bool ShouldBeAlive => (drawable.IsAlive && Item.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected); + protected override bool ShouldBeAlive => drawable.IsAlive && Item.IsPresent; + + [Resolved] + private OsuColour colours { get; set; } public SkinBlueprint(ISkinnableComponent component) : base(component) @@ -32,26 +39,68 @@ namespace osu.Game.Skinning.Editor } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { InternalChildren = new Drawable[] { box = new Container { - Colour = colours.Yellow, Children = new Drawable[] { - new Box + outlineBox = new Container { RelativeSizeAxes = Axes.Both, - Alpha = 0.2f, - AlwaysPresent = true, + Masking = true, + BorderThickness = 3, + BorderColour = Color4.White, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0f, + AlwaysPresent = true, + }, + } }, - } + new OsuSpriteText + { + Text = Item.GetType().Name, + Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold), + Anchor = Anchor.BottomRight, + Origin = Anchor.TopRight, + } + }, }, }; } + protected override void LoadComplete() + { + base.LoadComplete(); + + updateSelectedState(); + box.FadeInFromZero(200, Easing.OutQuint); + } + + protected override void OnSelected() + { + // base logic hides selected blueprints when not selected, but timeline doesn't do that. + updateSelectedState(); + } + + protected override void OnDeselected() + { + // base logic hides selected blueprints when not selected, but timeline doesn't do that. + updateSelectedState(); + } + + private void updateSelectedState() + { + outlineBox.FadeColour(colours.Pink.Opacity(IsSelected ? 1 : 0.5f), 200, Easing.OutQuint); + outlineBox.Child.FadeTo(IsSelected ? 0.2f : 0, 200, Easing.OutQuint); + } + private Quad drawableQuad; public override Quad ScreenSpaceDrawQuad => drawableQuad; From 7bac81f39487c446d515e5454f49b402680e38ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 May 2021 19:37:00 +0900 Subject: [PATCH 2/3] Fix incorrect inline comments Co-authored-by: Salman Ahmed --- osu.Game/Skinning/Editor/SkinBlueprint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index 23411f2b3d..58fa255508 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -85,13 +85,13 @@ namespace osu.Game.Skinning.Editor protected override void OnSelected() { - // base logic hides selected blueprints when not selected, but timeline doesn't do that. + // base logic hides selected blueprints when not selected, but skin blueprints don't do that. updateSelectedState(); } protected override void OnDeselected() { - // base logic hides selected blueprints when not selected, but timeline doesn't do that. + // base logic hides selected blueprints when not selected, but skin blueprints don't do that. updateSelectedState(); } From 6c12cae105a98f0d313d16f00b2cdfa9c4960bfb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 22:25:11 +0900 Subject: [PATCH 3/3] Remove unnecessary property --- osu.Game/Skinning/Editor/SkinBlueprint.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index f7509d7b8f..7a5547296b 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -23,11 +23,6 @@ namespace osu.Game.Skinning.Editor private Drawable drawable => (Drawable)Item; - /// - /// Whether the blueprint should be shown even when the is not alive. - /// - protected virtual bool AlwaysShowWhenSelected => true; - protected override bool ShouldBeAlive => drawable.IsAlive && Item.IsPresent; [Resolved]