MuseScore 2.0 (Beta1) Strange behavior when changing Clef and then Time signature.

• Aug 28, 2014 - 06:22
Type
Functional
Severity
S5 - Suggestion
Status
closed
Project

Steps to reproduce:

1. Change clef (first)
2. In Style>General uncheck Page>Cautionary Clefs (Página>Crear Claves de cortesía)
3. Then change Time signature in the same bar. MuseScore delete the Clef change and insert a Cautionary Clef that cannot hide.

At first bar of a staff

http://www.youtube.com/watch?v=0Z8Quu2P5NA

In the middle of a staff:

http://www.youtube.com/watch?v=5KgsoWBOQco

Is easy insert again the clef change, but that's not what you expect.

The file: 7 patrones comunes en contrapunto doble.mscz

Mac OSX 10.9


Comments

I also see much worse things happening - depending on the order in which you do things, adding the time signature may change the *initial* clef. For example:

1) use default score
2) drag bass clef to bar 5
3) drag 2/4 to bar 5

Result: the initial clef changes to bass also. Things are actually pretty messed up at this point, enough so that I'm marking the issue critical.

Luckily, my fix for #31576: Insert measure in front of score deletes key signature addresses "most" of this, I think (by sheer accident, but I'll take it :-). You still get a courtesy clef even though you didn't ask for one, but you can hide it normally. More investigation will be required once my PR for the other bug is merged, maybe this "accident" really is just that.

By reproducing the scenario (and only this one) in comment #1. So:

1) use default score
2) drag bass clef to bar 5
3) drag 2/4 to bar 5,

I can say that the issue appears on August 18.

- Correct with Nightly, August 18 (5be74db)
2clef.jpg

- Wrong with Nightly, August 18 (f4a34a2)

3Clef.jpg

Attachment Size
2clef.jpg 26.98 KB
3Clef.jpg 22.35 KB

Yes, that's exactly the change my PR addresses. The fix for #29806: insert measure in front of key sig creates measure with wrong key sig; clefs too went too far, also breaking the behavior when inserting a measure at the beginning of a score (key signature lost) and when inserting a measure right at a clef change. So my PR basically just reverts to the old behavior for those cases. And I guess it turns out that internally, changing time signature counts as inserting new measures (out with the old, in with the new), which is why that broke too. BTW, my fix also correctly handles the case if inserting a new measure at a point where *both* the clef and key signature change.

The really bad problems should be fixed now, as of https://github.com/musescore/MuseScore/commit/b01a557053baf0d4699b5f55c…. There may still courtesy signatures added that are not supposed to be there if you've unchecked the option to generate them, but it should now at least be possible to hide them individually. I'll look at that later if no one else does, but meanwhile, you might want to test some more and let me know what does or does not work.

It's mostly fixed indeed, but still some lingering effects, and another related problem that is worse:

1) new score
2) style / general / page
3) turn off generate courtesy clefs
4) add line break to bar 4
5) add clef change to bar 5 - note courtesy clef does not appear (good)
6) drag "common" time signature to bar 5

Result: courtesy clef appears at end of bar 4. However, press Ctrl+A and it goes away again.

Related problem:

1) follow all steps above, including the final Ctrl+A
2) save
3) reload

Result: the courtesy clef reappears, only to disappear again when you press Ctrl+A.

The problem stems from this code, which calculates whether a given clef is "courtesy" or not:

https://github.com/musescore/MuseScore/blob/master/libmscore/clef.cpp#L…

When this code is hit in bar 4 to decide if that clef is courtesy or not, measure 5 will not have necessarily have been laid out yet, so the clef at the beginning of the system may not have been generated. So the test may fail. By the time you do another layout (Ctrl+A), the clef on the next line is there, and all is well.

This code is delicate, I realize. I have tried the following right after the "if (clefSegNext) {" and it seems to work, but I'd love it if someone else took a look:

else if (meas->system() != measNext->system()) {
      // no clef in next measure,
      // but perhaps it has simply not been generated yet
      // this would be true if next measure is on another system
      // in which case, just use this as placeholder
      clefNext = this;
}

This code actually gets called several times during the course of layout, and the first few times, system assignment has not taken place yet, so this may or not produce the right answer. But this code is always hit one final time after the system has been decided upon.

Status (old) active patch (ready to commit)

Steps as listed in #6 no longer have problems, nut some problems still remain; for example:

1) new score
2) style / general / page
3) turn off generate courtesy clefs
4) add line break to bar 4
5) add clef change to bar 5 - note courtesy clef does not appear (good)
6) insert measure before measure 5 => courtesy clef appears at the end of the previous system.

PR with fix posted on github: https://github.com/musescore/MuseScore/pull/1274

M.