Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure selection is preserved when moving selection between columns #29899

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Sep 17, 2024

Closes #29793.

I believe that the sequence of events that makes this happens is as follows:

  • User selects a range of objects. Some of those objects are off-screen, and thus would be presumed to be not alive - except the blueprint container forces them to remain alive, because they're part of the selection.

  • User moves the selection to another column, which is implemented by temporarily removing the objects from the playfield, changing their column, and re-adding them.

    This sort of pattern is supposed to kick off the HitObjectUsageTransferred flow in HitObjectUsageEventBuffer - and it does... for objects that are currently visible on screen and thus would be alive regardless of SetKeepAlive(). However, this does not hold for objects that are off-screen - nothing ensures they are kept alive again after re-adding, and thus they inadvertently become dead.

  • Thus, this doesn't kick off the BlueprintContainer flows associated with transferring objects to another column, and instead fires the removal flows, which ensure that the off-screen objects that were being moved are instead deselected.

I tried a few other options but found no better resolution than this - calling SetKeepAlive() directly would require making it public, which seems like a bad idea. There's really no good way to generically handle this either, because it is the ruleset that decides that its way of implementing this operation will be a removal and re-add of objects, so...

Closes ppy#29793.

I believe that the sequence of events that makes this happens is as
follows:

- User selects a range of objects. Some of those objects are off-screen,
  and thus would be presumed to be not alive - except the blueprint
  container forces them to remain alive, because they're part of the
  selection.

- User moves the selection to another column, which is implemented by
  temporarily removing the objects from the playfield, changing their
  column, and re-adding them.

  This sort of pattern is supposed to kick off the
  `HitObjectUsageTransferred` flow in `HitObjectUsageEventBuffer` - and
  it does... for objects that are *currently visible on screen* and thus
  would be alive regardless of `SetKeepAlive()`. However, this does not
  hold for objects that are off-screen - nothing ensures they are kept
  alive again after re-adding, and thus they inadvertently become dead.

- Thus, this doesn't kick off the `BlueprintContainer` flows associated
  with transferring objects to another column, and instead fires the
  removal flows, which ensure that the off-screen objects that were
  being moved are instead deselected.

I tried a few other options but found no better resolution than this -
calling `SetKeepAlive()` directly would require making it public, which
seems like a bad idea. There's really no good way to generically handle
this either, because it is the ruleset that decides that its way of
implementing this operation will be a removal and re-add of objects,
so...
Copy link
Sponsor Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not smoogi but seems fine.

@peppy peppy merged commit d9de2ad into ppy:master Sep 27, 2024
11 of 13 checks passed
@bdach bdach deleted the mania-selection-dropped branch September 27, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

selection in mania editor sometimes breaks
2 participants