Bad layout in part with empty key signature segment
Ubuntu Studio 14.04, GIT commit: 2670860
1) load attached score
2) generate parts
3) view parts
Result: for most of the parts, the first notes on the second system are too close to the initial clef. Debugger shows an empty key signature segment between clef and notes, I guess that's throwing off the layout. Nor sure how it got there or what other problems might result.
Comments
I can reproduce this in a score created from scratch.
1) load attached score
2) generate parts
3) view flute part
4) add line break after first measure
Result: note overlaps clef
The same thing is happening here: there is an empty key signature segment at the beginning of the measure. As far as I can tell, that happens any time there is an explicit line break in the score and one of the other parts has a key signature but this one doesn't (eg, it's a score involving transposing instruments, and at least one of the intruments ends up in the key of C).
It sort of feels like maybe we shouldn't generate the empty key signature segment at all, but maybe that's necessary for the linking to work, so I won't mess with that. If someone else (eg, Werner) wants to, have a ball. But I will fix the layout.
https://github.com/musescore/MuseScore/pull/1215
I am reasonably confident of this fix, but so close to beta, I'd love it to get a little extra review. i do think this is important to include in the beta if at all possible, since the results can be pretty bad otherwise = lots of systems potentially starting out like this:
Of course, it's still the case that if it makes to not generate the empty key signature segments in the first place, that is fine by me. I still think it seems best to include my code (or the equivalent) anyhow just to be safe - if empty segments occur after the clef for any other reason.
Fixed in 9820623494
and in 9b27bef ?
with c9c9076 that seems to work well ;)
Found another case where this can happen:
1) new score for flute & drumset
2) add line break after ms 4
3) add key sig change before ms 5
4) remove flute staff
Result: same as before. Removing the flute staff gets rid of the only key signature in the segment but leaves the empty segment behind. I see the code in segment.cpp that *appears* to be responsible:
https://github.com/musescore/MuseScore/blob/master/libmscore/segment.cp…
Setting "empty" to false here appears to be a holdover from a copy & paste or something, since this is done explicitly everywhere in the add() method but doesn't seem to make sense here. Unfortunately, removing this line doesn't seem to fix the problem; not sure why.
Even assuming we find and fix the problem leading to the empty keysig segment, it still seems it would be a good idea to fix the layout routines as I originally proposed - to ignore irrelevant segments before the first note - so we aren't bit by other empty segment issues in the future.
BTW, the results actually differ depending on whether the content of the measure is a regular chord / rest, a full measure rest, or an mmrest. Regular chord rests are handled by the code in my former PR https://github.com/musescore/MuseScore/pull/1215. But the centering of full measure rests and mmrests is handled by code later in measure.cpp.
https://github.com/musescore/MuseScore/pull/1285
This PR was merged a couple of days ago
Automatically closed -- issue fixed for 2 weeks with no activity.