1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 01:23:05 +08:00
osu-lazer/osu.Game/Screens/Edit
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
..
Components Merge pull request #28521 from bdach/tempo-adjust-editor 2024-07-04 16:42:55 +09:00
Compose Fix incorrect ternary state computation for bank toggles 2024-07-05 09:27:21 +02:00
Design Enable nullability for design screen 2023-01-14 02:24:48 +03:00
GameplayTest Implement quick exit hotkeys for editor test play 2024-07-02 14:34:36 +02:00
Setup Adjust calls to GetContainingInputManager() 2024-06-18 07:41:19 +02:00
Timing Fix scroll-into-view on control point table not working as it is supposed to 2024-06-27 09:46:35 +02:00
Verify Rewrite IssueTable to use virtualised list 2024-06-26 10:40:02 +02:00
BackgroundDimMenuItem.cs Use existing strings 2023-01-15 14:39:34 +03:00
BeatmapEditorChangeHandler.cs Change the way initial state saving works in EditorChangeHandler to be closer to first change 2023-02-07 16:22:51 +09:00
BindableBeatDivisor.cs Change name and description of force parameter in SetArbitraryDivisor 2024-01-25 05:12:54 -05:00
BottomBar.cs Reduce editor opacity of several editor components when hovering over composer 2024-06-17 12:14:28 +02:00
ClipboardContent.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
CreateNewDifficultyDialog.cs Localise create/save dialog 2023-01-15 01:50:47 +03:00
DeleteDifficultyConfirmationDialog.cs make ResetConfirmDialog properly utilise its parent's logic 2023-03-05 20:57:26 +01:00
Editor.cs Merge branch 'master' into navigate-to-timestamp 2024-07-03 20:42:32 +09:00
EditorBeatmap.cs Remove unused code 2024-07-02 12:21:24 +09:00
EditorBeatmapProcessor.cs Isolate bindable breaks list to EditorBeatmap 2024-07-02 11:31:55 +09:00
EditorBeatmapSkin.cs Enable NRT in EditorBeatmapSkin 2024-02-23 14:52:44 +01:00
EditorChangeHandler.cs Add RestoreState() to IEditorChangeHandler 2024-06-11 11:31:30 +02:00
EditorClipboard.cs Automated pass 2023-06-24 01:00:03 +09:00
EditorClock.cs Fix incorrect test assumption in TestSceneEditorClock 2023-10-06 16:43:28 +09:00
EditorLoader.cs Fix editor not updating ruleset when switching difficulty 2024-07-04 14:06:36 +03:00
EditorRoundedScreenSettings.cs Automated pass 2023-06-24 01:00:03 +09:00
EditorRoundedScreenSettingsSection.cs Partial everything 2022-11-27 00:00:27 +09:00
EditorScreen.cs Move workaround to subscreen 2024-05-24 10:35:33 +02:00
EditorScreenMode.cs Localise part of editor 2023-01-15 01:50:47 +03:00
EditorScreenWithTimeline.cs Reduce editor opacity of several editor components when hovering over composer 2024-06-17 12:14:28 +02:00
EditorSkinProvidingContainer.cs Partial everything 2022-11-27 00:00:27 +09:00
EditorState.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
HitAnimationsMenuItem.cs Automated pass 2023-06-24 01:00:03 +09:00
IEditorChangeHandler.cs Add RestoreState() to IEditorChangeHandler 2024-06-11 11:31:30 +02:00
LegacyEditorBeatmapPatcher.cs Add patcher support for breaks 2024-06-19 10:22:14 +02:00
ManualBreakPeriod.cs Make (Manual)BreakPeriod a class again 2024-06-19 14:53:09 +02:00
PromptForSaveDialog.cs Localise create/save dialog 2023-01-15 01:50:47 +03:00
ReloadEditorDialog.cs Attempt full editor reload on key count change 2024-06-11 11:31:49 +02:00
SaveRequiredPopupDialog.cs Fix editor not prompting before saving beatmap for export 2023-10-25 14:39:46 +09:00
TableHeaderText.cs Rewrite ControlPointTable to use virtualised list 2024-06-26 10:40:02 +02:00
TransactionalCommitComponent.cs Change the way initial state saving works in EditorChangeHandler to be closer to first change 2023-02-07 16:22:51 +09:00
WaveformOpacityMenuItem.cs Move timeline toggle controls to "view" menu 2024-06-17 10:16:40 +02:00