diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
index 2817e26abd..26b18828d3 100644
--- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
+++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
@@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Edit
///
public bool AutomaticBankAssignment { get; set; }
+ ///
+ /// Whether the sample addition bank should be taken from the previous hit objects.
+ ///
+ public bool AutomaticAdditionBankAssignment { get; set; }
+
///
/// The that is being placed.
///
@@ -157,26 +162,26 @@ namespace osu.Game.Rulesets.Edit
}
var lastHitObject = getPreviousHitObject();
+ var lastHitNormal = lastHitObject?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
- if (AutomaticBankAssignment)
+ if (AutomaticAdditionBankAssignment)
{
- // Create samples based on the sample settings of the previous hit object
- if (lastHitObject != null)
- {
- for (int i = 0; i < HitObject.Samples.Count; i++)
- HitObject.Samples[i] = lastHitObject.CreateHitSampleInfo(HitObject.Samples[i].Name);
- }
+ // Inherit the addition bank from the previous hit object
+ // If there is no previous addition, inherit from the normal sample
+ var lastAddition = lastHitObject?.Samples?.FirstOrDefault(o => o.Name != HitSampleInfo.HIT_NORMAL) ?? lastHitNormal;
+
+ if (lastAddition != null)
+ HitObject.Samples = HitObject.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? s.With(newBank: lastAddition.Bank) : s).ToList();
}
- else
- {
- var lastHitNormal = lastHitObject?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
- if (lastHitNormal != null)
- {
- // Only inherit the volume from the previous hit object
- for (int i = 0; i < HitObject.Samples.Count; i++)
- HitObject.Samples[i] = HitObject.Samples[i].With(newVolume: lastHitNormal.Volume);
- }
+ if (lastHitNormal != null)
+ {
+ if (AutomaticBankAssignment)
+ // Inherit the bank from the previous hit object
+ HitObject.Samples = HitObject.Samples.Select(s => s.Name == HitSampleInfo.HIT_NORMAL ? s.With(newBank: lastHitNormal.Bank) : s).ToList();
+
+ // Inherit the volume from the previous hit object
+ HitObject.Samples = HitObject.Samples.Select(s => s.With(newVolume: lastHitNormal.Volume)).ToList();
}
if (HitObject is IHasRepeats hasRepeats)
diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs
index 671180348d..fc81bc5706 100644
--- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs
@@ -89,6 +89,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
foreach (var kvp in SelectionHandler.SelectionBankStates)
kvp.Value.BindValueChanged(_ => updatePlacementSamples());
+
+ foreach (var kvp in SelectionHandler.SelectionAdditionBankStates)
+ kvp.Value.BindValueChanged(_ => updatePlacementSamples());
}
protected override void TransferBlueprintFor(HitObject hitObject, DrawableHitObject drawableObject)
@@ -177,6 +180,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
foreach (var kvp in SelectionHandler.SelectionBankStates)
bankChanged(kvp.Key, kvp.Value.Value);
+
+ foreach (var kvp in SelectionHandler.SelectionAdditionBankStates)
+ additionBankChanged(kvp.Key, kvp.Value.Value);
}
private void sampleChanged(string sampleName, TernaryState state)
@@ -208,7 +214,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (bankName == EditorSelectionHandler.HIT_BANK_AUTO)
CurrentPlacement.AutomaticBankAssignment = state == TernaryState.True;
else if (state == TernaryState.True)
- CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.With(newBank: bankName)).ToList();
+ CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.Name == HitSampleInfo.HIT_NORMAL ? s.With(newBank: bankName) : s).ToList();
+ }
+
+ private void additionBankChanged(string bankName, TernaryState state)
+ {
+ if (CurrentPlacement == null) return;
+
+ if (bankName == EditorSelectionHandler.HIT_BANK_AUTO)
+ CurrentPlacement.AutomaticAdditionBankAssignment = state == TernaryState.True;
+ else if (state == TernaryState.True)
+ CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? s.With(newBank: bankName) : s).ToList();
}
public readonly Bindable NewCombo = new Bindable { Description = "New Combo" };