Skip to content

Commit

Permalink
Merge pull request #21773 from miiizen/note-dot-invisible
Browse files Browse the repository at this point in the history
Prevent assertion error on invisible dots
  • Loading branch information
mike-spa committed Mar 11, 2024
2 parents 2b9c4e1 + 4257e23 commit f49428c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,10 @@ void ChordLayout::placeDots(const std::vector<Chord*>& chords, const std::vector
std::unordered_map<int, Note*> alreadyAdded;
bool finished = false;
for (Note* otherNote : bottomUpNotes) {
// Make sure invisible dots have no effect on visible dots, but are still layed out sensibly
if (otherNote->visible() != note->visible()) {
continue;
}
int dotMove = otherNote->dotPosition() == DirectionV::UP ? -1 : 1;
int otherDotLoc = otherNote->line() + dotMove;
bool added = alreadyAdded.count(otherDotLoc);
Expand All @@ -2374,6 +2378,9 @@ void ChordLayout::placeDots(const std::vector<Chord*>& chords, const std::vector
if (!finished) {
alreadyAdded.clear();
for (Note* otherNote : topDownNotes) {
if (otherNote->visible() != note->visible()) {
continue;
}
int dotMove = otherNote->dotPosition() == DirectionV::DOWN ? 1 : -1;
int otherDotLoc = otherNote->line() + dotMove;
bool added = alreadyAdded.count(otherDotLoc);
Expand All @@ -2397,7 +2404,6 @@ void ChordLayout::placeDots(const std::vector<Chord*>& chords, const std::vector
IF_ASSERT_FAILED(finished) {
// this should never happen
// the note is on a line and topDownNotes and bottomUpNotes are all of the lined notes
LOGI() << "tick: " << note->tick().toString();
note->setDotRelativeLine(0);
}
} else {
Expand Down Expand Up @@ -2862,7 +2868,7 @@ void ChordLayout::getNoteListForDots(Chord* c, std::vector<Note*>& topDownNotes,
std::vector<int>& anchoredDots)
{
Measure* measure = c->measure();
bool hasVoices = measure->hasVoices(c->vStaffIdx(), c->tick(), c->ticks());
bool hasVoices = measure->hasVoices(c->vStaffIdx(), c->tick(), c->ticks(), true);
bool hasUpperCrossNotes = false;
bool hasLowerCrossNotes = false;
staff_idx_t partTopStaff = c->part()->startTrack() / VOICES;
Expand Down
Binary file modified vtest/scores/chord-layout-dots.mscz
Binary file not shown.

0 comments on commit f49428c

Please sign in to comment.