1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 05:12:55 +08:00

Merge branch 'master' into skin-editor-borrowed-dependencies

This commit is contained in:
Dean Herbert 2022-03-17 15:09:04 +09:00
commit 1d83b36cfc
4 changed files with 22 additions and 28 deletions

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
@ -50,8 +49,8 @@ namespace osu.Game.Skinning.Editor
private Container content; private Container content;
private EditorSidebarSection settingsToolbox;
private EditorSidebar componentsSidebar; private EditorSidebar componentsSidebar;
private EditorSidebar settingsSidebar;
public SkinEditor() public SkinEditor()
{ {
@ -153,17 +152,7 @@ namespace osu.Game.Skinning.Editor
Depth = float.MaxValue, Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new EditorSidebar settingsSidebar = new EditorSidebar(),
{
Children = new[]
{
settingsToolbox = new SkinSettingsToolbox
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
}
},
} }
} }
} }
@ -261,14 +250,10 @@ namespace osu.Game.Skinning.Editor
private void populateSettings() private void populateSettings()
{ {
settingsToolbox.Clear(); settingsSidebar.Clear();
var first = SelectedComponents.OfType<Drawable>().FirstOrDefault(); foreach (var component in SelectedComponents.OfType<Drawable>())
settingsSidebar.Add(new SkinSettingsToolbox(component));
if (first != null)
{
settingsToolbox.Children = first.CreateSettingsControls().ToArray();
}
} }
private IEnumerable<ISkinnableTarget> availableTargets => targetScreen.ChildrenOfType<ISkinnableTarget>(); private IEnumerable<ISkinnableTarget> availableTargets => targetScreen.ChildrenOfType<ISkinnableTarget>();

View File

@ -199,6 +199,12 @@ namespace osu.Game.Skinning.Editor
Items = createAnchorItems((d, o) => ((Drawable)d).Origin == o, applyOrigins).ToArray() Items = createAnchorItems((d, o) => ((Drawable)d).Origin == o, applyOrigins).ToArray()
}; };
yield return new OsuMenuItem("Reset position", MenuItemType.Standard, () =>
{
foreach (var blueprint in SelectedBlueprints)
((Drawable)blueprint.Item).Position = Vector2.Zero;
});
foreach (var item in base.GetContextMenuItemsForSelection(selection)) foreach (var item in base.GetContextMenuItemsForSelection(selection))
yield return item; yield return item;

View File

@ -1,8 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osuTK; using osuTK;
@ -12,8 +14,8 @@ namespace osu.Game.Skinning.Editor
{ {
protected override Container<Drawable> Content { get; } protected override Container<Drawable> Content { get; }
public SkinSettingsToolbox() public SkinSettingsToolbox(Drawable component)
: base("Settings") : base($"Settings ({component.GetType().Name})")
{ {
base.Content.Add(Content = new FillFlowContainer base.Content.Add(Content = new FillFlowContainer
{ {
@ -21,6 +23,7 @@ namespace osu.Game.Skinning.Editor
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(10), Spacing = new Vector2(10),
Children = component.CreateSettingsControls().ToArray()
}); });
} }
} }

View File

@ -166,15 +166,15 @@ namespace osu.Game.Utils
foreach (var apiMod in proposedMods) foreach (var apiMod in proposedMods)
{ {
try var mod = apiMod.ToMod(ruleset);
{
// will throw if invalid if (mod is UnknownMod)
valid.Add(apiMod.ToMod(ruleset));
}
catch
{ {
proposedWereValid = false; proposedWereValid = false;
continue;
} }
valid.Add(mod);
} }
return proposedWereValid; return proposedWereValid;