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

Fix juice stream placement blueprint being initially visually offset #31453

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Jan 8, 2025

Admittedly, I don't completely understand all of the pieces here, because code quality of this placement blueprint code is ALL-CAPS ATROCIOUS, but I believe the failure mode to be something along the lines of:

  • User activates juice stream tool, blueprint gets created in initial state. It reads in a mouse position far outside of the playfield, and sets internal positioning appropriately.
  • When the user moves the mouse into the bounds of the playfield, some positions update (the ones inside UpdateTimeAndPosition(), but the fruit markers are for nested objects, and updateHitObjectFromPath() is responsible for updating those... however, it only fires if the editablePath.PathId changes, which it won't here, because there is only one path vertex until the user commits the starting point of the juice stream and it's always at (0,0).
  • Therefore the position of the starting fruit marker remains bogus until left click, at which point the path changes and everything returns to relative sanity.

The part in #30411 that regresses the above scenario is the "blueprint is always created even if not visible / cursor is outside playfield" part.

This PR essentially relies on inlining the broken method and only guarding the relevant part of processing behind the path version check (which is actually updating the path). Everything else that can touch positions of nesteds (like default application, and the drawable piece updates) is allowed to happen unconditionally.

@peppy
Copy link
Member

peppy commented Jan 9, 2025

Hmm, I do think I prefer the patch version.. feels like it's going to be easier to work with if we need to make further changes to the class (because at least it's very explicit about what does/doesn't need to happen).

Copy link
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.

As commented, probably go with the "more complex" version.

- Closes ppy#31423.
- Regressed in ppy#30411.

Admittedly, I don't completely understand all of the pieces here,
because code quality of this placement blueprint code is ALL-CAPS
ATROCIOUS, but I believe the failure mode to be something along the
lines of:

- User activates juice stream tool, blueprint gets created in initial
  state. It reads in a mouse position far outside of the playfield, and
  sets internal positioning appropriately.
- When the user moves the mouse into the bounds of the playfield, some
  positions update (the ones inside `UpdateTimeAndPosition()`, but the
  fruit markers are for *nested* objects, and
  `updateHitObjectFromPath()` is responsible for updating those...
  however, it only fires if the `editablePath.PathId` changes, which it
  won't here, because there is only one path vertex until the user
  commits the starting point of the juice stream and it's always at
  (0,0).
- Therefore the position of the starting fruit marker remains bogus
  until left click, at which point the path changes and everything
  returns to *relative* sanity.

The solution essentially relies on inlining the broken method and only
guarding the relevant part of processing behind the path version check
(which is actually updating the path). Everything else that can touch
positions of nesteds (like default application, and the drawable piece
updates) is allowed to happen unconditionally.
@bdach bdach force-pushed the fix-juice-stream-placement-offset branch from 2de2c56 to 18f1d62 Compare January 9, 2025 08:42
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Jan 9, 2025
@bdach
Copy link
Collaborator Author

bdach commented Jan 9, 2025

Sure, have switched to it.

@peppy peppy merged commit 2133ac6 into ppy:master Jan 9, 2025
10 checks passed
@bdach bdach deleted the fix-juice-stream-placement-offset branch January 10, 2025 07:56
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.

catch editor JuiceStream start fruit offset to the right after switching from another placement tool
2 participants