1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 19:53:23 +08:00

Make skin editor focus only one layer at a time

This commit is contained in:
Dean Herbert 2023-02-17 16:57:36 +09:00
parent 00fcee0c5a
commit 0a018514e1

View File

@ -258,8 +258,6 @@ namespace osu.Game.Overlays.SkinEditor
changeHandler?.Dispose(); changeHandler?.Dispose();
SelectedComponents.Clear();
// Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target. // Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target.
content?.Clear(); content?.Clear();
@ -268,29 +266,6 @@ namespace osu.Game.Overlays.SkinEditor
void loadBlueprintContainer() void loadBlueprintContainer()
{ {
Debug.Assert(content != null);
changeHandler = new SkinEditorChangeHandler(targetScreen);
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
content.Child = new SkinBlueprintContainer(targetScreen);
componentsSidebar.Children = new[]
{
new EditorSidebarSection("Current working layer")
{
Children = new Drawable[]
{
new SettingsDropdown<SkinComponentsContainerLookup?>
{
Items = availableTargets.Select(t => t.Lookup),
Current = selectedTarget,
}
}
},
};
selectedTarget.Default = getFirstTarget()?.Lookup; selectedTarget.Default = getFirstTarget()?.Lookup;
if (!availableTargets.Any(t => t.Lookup.Equals(selectedTarget.Value))) if (!availableTargets.Any(t => t.Lookup.Equals(selectedTarget.Value)))
@ -308,10 +283,40 @@ namespace osu.Game.Overlays.SkinEditor
if (target.NewValue == null) if (target.NewValue == null)
return; return;
Debug.Assert(content != null);
SelectedComponents.Clear();
var skinComponentsContainer = getTarget(target.NewValue);
if (skinComponentsContainer == null)
return;
changeHandler = new SkinEditorChangeHandler(skinComponentsContainer);
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
content.Child = new SkinBlueprintContainer(skinComponentsContainer);
componentsSidebar.Children = new[]
{
new EditorSidebarSection("Current working layer")
{
Children = new Drawable[]
{
new SettingsDropdown<SkinComponentsContainerLookup?>
{
Items = availableTargets.Select(t => t.Lookup),
Current = selectedTarget,
}
}
},
};
// If the new target has a ruleset, let's show ruleset-specific items at the top, and the rest below. // If the new target has a ruleset, let's show ruleset-specific items at the top, and the rest below.
if (target.NewValue.Ruleset != null) if (target.NewValue.Ruleset != null)
{ {
componentsSidebar.Add(new SkinComponentToolbox(getTarget(target.NewValue)) componentsSidebar.Add(new SkinComponentToolbox(skinComponentsContainer)
{ {
RequestPlacement = placeComponent RequestPlacement = placeComponent
}); });