-
-
Notifications
You must be signed in to change notification settings - Fork 91
BPM event refactor #579
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
BPM event refactor #579
Conversation
* songBpmTime is now nullable. If time conversion fails, it is set to null. Casting it to float when it's null will raise an exception. This is intentional; it means there is a serious bug and we should know about it. * SongBpmTime cannot be set anymore. This was only used in one place, and you should set JsonTime instead. * BPM time conversion logic is moved to from BPMChangeGridContainer to BaseDifficulty. BPM events must be bootstrapped after loading for this to function. All object songBpmTimes should be recomputed after doing this. * SetTimes in BaseObject has been simplified since songBpmTime was getting recalculated anyway.
* When saving BPM regions, properly round calculated sample indexes, and ensure continuity by setting start sample index to previous end sample index. * When converting BPM regions into events, round the BPM value of resulting events if the unrounding was (likely) caused by numerical error. Together these should (mostly) eliminate accumulating errors on load/save cycles, which is important for v4 maps, since they do not store the actual BPM events.
* FindLastBpmEvent should have been exclusive, not inclusive. This is because BPM events use this function to update their own songBpmTime, and if it's inclusive they will recalculate based on themselves. * BPM events need to be refreshed before any other objects, since the result of their refresh is used in the refresh of others. * ATSC time update on BPM tweak should occur after objects have been refreshed.
turns out inclusive search WAS useful for some things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although PR is big enough for me to want a second look from Bullet before merging
Assets/__Scripts/MapEditor/Grid/Collections/BeatmapObjectContainerCollection.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing.
Also cannot load into the editor on some maps. (e.g. key 44178)
creating an object with this constructor would have left songBpmTime as null
tests should be passing now |
BPM event refactor:
This fixes wrong saving of BPM info files (BPMInfo.dat/AudioData.dat) when saving diffs from the song edit screen. It should also make it impossible for such a bug to go unnoticed in the future.
I haven't found any new bugs stemming from this refactor, but more testing is of course welcome.
mitigate accumulating numerical errors on BPM region load/save:
Together these should (mostly) eliminate accumulating errors on load/save cycles, which is important for v4 maps, since they do not store the actual BPM events.