1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 03:43:22 +08:00
osu-lazer/osu.Game/Screens/Edit/Compose/Components
Bartłomiej Dach 4c59ec1d94
Fix incorrect ternary state computation for bank toggles
Closes https://github.com/ppy/osu/issues/28741.

Regressed in a7b066f3ee.

The intent of the original change there was to ensure that addition
banks being set will put the ternary state toggles in indeterminate
state (to at least provide a visual indication that the selection does
not use a single bank). This would previously not be the case due to
the use of `.All()` in the original condition (a single object/node
was considered to have a bank enabled if and only if *all* samples
within it used it). However the attempt to fix that via switching
to `Any()` was not correct.

The logic used in the offending commit operates on extracted `Samples`
and `NodeSamples` from the selection, and would consider the ternary
toggle:

- fully off if none of the samples/node samples contained a sample with
  the given bank,
- indeterminate if the some of the samples/node samples contained a
  sample with the given bank,
- fully on if at least one sample from every samples/node samples
  contained a sample with the given bank.

This is a *two-tiered* process, as in first a *binary* on/off state is
extracted from each object's samples/node samples, and *then* a ternary
state is extracted from all objects/nodes. This is insufficient to
express the *desired* behaviour, which is that the toggle should be:

- fully off if *none of the individual samples in the selection* use
  the given bank,
- indeterminate if *at least one individual sample in the selection*
  uses the given bank,
- fully on if *all individual samples in the selection* use the given
  bank.

The second wording is flattened, and no longer tries to consider "nodes"
or "objects", it just looks at all of the samples in the selection
without concern as to whether they're from separate objects/nodes
or not.

To explain why this discrepancy caused the bug, consider a single object
with a `soft` normal bank and `drum` addition bank. Selecting the object
would cause a ternary button state update; as per the incorrect logic,
there were two samples on the object and each had its own separate
banks, so two ternary toggles would have their state set to `True`
(rather than the correct `Indeterminate`), thus triggering a bindable
feedback loop that would cause one of these banks to win and actually
overwrite the other.

Note that the addition indeterminate state computation *still* needs
to do the two-tiered process, because there it actually makes sense (for
a selection to have an addition fully on rather than indeterminate,
*every* object/node *must* contain that addition).
2024-07-05 09:27:21 +02:00
..
Timeline Fix nullability 2024-07-03 15:31:46 +09:00
BeatDivisorControl.cs Adjust calls to GetContainingInputManager() 2024-06-18 07:41:19 +02:00
BeatDivisorPresetCollection.cs Use new LINQ Order() instead of OrderBy() when possible 2024-02-08 18:01:00 +01:00
BeatDivisorType.cs Remove redundant nullable suppression directives 2023-06-07 08:20:41 +03:00
BeatSnapGrid.cs Add beat snap grid to osu!taiko editor 2023-10-17 16:59:56 +09:00
BlueprintContainer.cs Check if blueprint is in SelectionBlueprints before changing its depth 2024-04-02 07:45:27 -03:00
CircularDistanceSnapGrid.cs Update usage of CircularProgress.Current 2024-03-06 12:13:10 +08:00
CircularPositionSnapGrid.cs clean up to match logic in CircularDistanceSnapGrid 2024-06-05 18:56:18 +02:00
ComposeBlueprintContainer.cs Merge branch 'master' into timeline-drag-selection-crash 2024-06-20 15:16:10 +09:00
DistanceSnapGrid.cs Privatise setter 2023-06-16 16:24:07 +02:00
DragBox.cs Update R# + fix inspections 2024-02-02 21:00:28 +09:00
EditorBlueprintContainer.cs Rectify selection keep-alive logic 2023-11-20 21:57:14 +09:00
EditorInspector.cs Show distance in pixels to previous/next object in osu! hitobject inspector 2024-06-27 14:46:57 +02:00
EditorSelectionHandler.cs Fix incorrect ternary state computation for bank toggles 2024-07-05 09:27:21 +02:00
HitObjectInspector.cs Show distance in pixels to previous/next object in osu! hitobject inspector 2024-06-27 14:46:57 +02:00
HitObjectOrderedSelectionContainer.cs Manual fixes to reduce warnings to zero 2023-06-24 01:52:53 +09:00
LinedPositionSnapGrid.cs fix nitpick 2024-05-24 18:11:28 +02:00
MoveSelectionEvent.cs Automated pass 2023-06-24 01:00:03 +09:00
PositionSnapGrid.cs Remove Masking from PositionSnapGrid 2024-02-01 16:57:45 +01:00
RectangularPositionSnapGrid.cs Added bindables and binding with BindTo 2024-01-01 15:13:11 +01:00
ScrollingDragBox.cs Partial everything 2022-11-27 00:00:27 +09:00
SelectionBox.cs Update HasFlag usages 2024-07-03 00:19:04 +09:00
SelectionBoxButton.cs Add a visual effect when keyboard shortcuts are used to trigger selection box buttons 2023-06-27 17:01:13 +09:00
SelectionBoxControl.cs Add a visual effect when keyboard shortcuts are used to trigger selection box buttons 2023-06-27 17:01:13 +09:00
SelectionBoxDragHandle.cs Partial everything 2022-11-27 00:00:27 +09:00
SelectionBoxDragHandleContainer.cs Update HasFlag usages 2024-07-03 00:19:04 +09:00
SelectionBoxRotationHandle.cs Update HasFlag usages 2024-07-03 00:19:04 +09:00
SelectionBoxScaleHandle.cs Update HasFlag usages 2024-07-03 00:19:04 +09:00
SelectionHandler.cs Merge branch 'master' into edit-nodesample 2024-06-06 13:42:25 +02:00
SelectionRotationHandler.cs Fix crashes when opening scale/rotation popovers during selection box operations 2024-06-25 15:20:59 +02:00
SelectionScaleHandler.cs Fix crashes when opening scale/rotation popovers during selection box operations 2024-06-25 15:20:59 +02:00
TriangularPositionSnapGrid.cs Use math instead of hardcoded constant values 2024-06-20 17:27:15 +02:00