Changing Time Signature causes existing measure rest to move
In this thread https://musescore.org/en/node/141421 we discussed time signatures causing rests to move around in the score. I have finally discovered how to reproduce this from scratch. I've attached my score and this is what I did:
1. new score - choose instruments
2. add 3 instruments (click OK) - it may work with 2 instruments I didn't test it.
3. I used 6/8 time signature but it works on others as well
4. Reopen instruments and hide 1 instrument
5. Insert a different time signature into a measure after 1
result is the rest in the measure with the time signature jumps to later in the score. If you click the last note/rest in the measure before the time change and press right arrow the screen will jump to the spot the rest moved to. adding a note (such as pressing 4 B at this time will cause the measure to display properly and the screen will return to that measure.
Attachment | Size |
---|---|
Moving rests.mscz | 9.02 KB |
Comments
It appears the issue is here:
https://musescore.org/en/node/186666
We are trying to center the rest between the time signature (in this case) and the end barline. We loop through the staves figuring out where the time signature ends (since it might have different positions or widths on different staves). Unfortunately, the time signature on the invisible staff has not been laid out yet, so its position is garbage. Well, it seems to be a meaningful number, it just isn't *right*.
Probably the fix is to skip invisible staves when doing this calculation. But I also wonder if maybe we shouldn't force a layout upon adding the time signature. I know there are some similar issues with key signatures on invisible staves affecting layout in bad ways - see https://github.com/musescore/MuseScore/pull/1878, a proposed partial fix for [#50216].
Further analysis would be prudent here. I do suspect skipping invisible staves in the loop mentioned above will be the best solution - and it does work to do "if (!visible(staffIdx)) continue" at the top of the loop, but we'd want to think through and be sure there are no bad side effects.
Workaround, BTW, is to show the staff then hide it again.
Well, for better or worse, here is a PR implementing the simple strategy of skipping invisible staves:
https://github.com/musescore/MuseScore/pull/3144
BTW, there is no actual corruption, it's a layout glitch only. And in addition to fixing itself if you temporarily display the invisible staff, it also fixes itself if you save then reload the score. So not quite as bad as it might first appear, but bad enough.
Fixed in branch 2.1, commit 841be13ca2
fix #183816: full measure rest displaced after time signature change
Fixed in branch 2.1, commit 721ed1b494
Merge pull request #3144 from MarcSabatella/183816-fmr-displaced
fix #183816: full measure rest displaced after timesig change with invisible staves
For the record, I cannot reproduce in master aea384533a
Automatically closed -- issue fixed for 2 weeks with no activity.