Looking at staff properties changes clef of instruments with multiple staves
Reported version
3.0
Priority
P1 - High
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
came up in https://musescore.org/en/node/278224
New score, bass clef
rightclick into staff, staff properties
OK (without chaning anything
--> bass clef turned into treble clef
Comments
del. my comment (crash not reproducible after a factory reset).
Loading the piano seems to not load the clefs properly, I think. This in turn activates this line of code which decides that one staff of piano must be treble. I added
<clef staff="1">F</clef>
to 02-Bass_Clef.mscx in the instrument tag and the bug went away. However, when I add a piano and take away the treble clef staff and repeat the above steps, the issue is still there. I haven't been able to replicate it with any individual staff instruments (e.g. cello).the bass clef template issue would be very easy to fix then, I could just add it to https://github.com/musescore/MuseScore/pull/4249, as that deals with template, just let me know.
Edit: actually it should be just
<clef>F</clef>
, thatstaff="1"
doesn't survive a save . And the same trick indeed doesn't work for the grand staff template, there it rets removes, as being the default anywayIt would fix the template, but the issue would still exist for piano in general--and possibly any other multi staff instruments (are there any others?)
yes, several more, organ for examlpe
The real fix might be, in case of an empty clef (
if (_clefType.empty())
), to look at/for the default clef?Just checked. It affects all multi-stave instruments. Also, pipe organ that has the octave lower F clef will change to a regular F clef if the treble clef is missing.
But only if the top staff gets deleted, right?
Nope. Take pipe organ, remove the middle bass clef, follow the above steps on the bass clef down an octave. It switches to a regular one.
I looked a bit further. Here is what happens:
1. The template has no clefs loaded. So, it uses the default of stave 1 == treble. The original cause of the issue.
2. Any other instrument loads all the clefs even if not all the staves are loaded. Therefore there is a mismatch between cleftype and staffidx. This causes all the other issues (I think)
but it involves deleting a staff
I had the idea of only updating the clef if the instrument changed. However, it seems the Instrument == operator will always return false if you open and close the staff properties. (See https://github.com/musescore/MuseScore/blob/master/mscore/editstaff.cpp… ) It returns false on the comparison of channels--code here. Regardless, I've seemed to circumvent the issue by doing a more manual comparison.
https://github.com/musescore/MuseScore/pull/4257
should we additionally fix that bass clef template?
This also handles the bass clef template. I don't see the clef listed in other templates, either. But, this should work as long as the instrument isn't changing. If it does, then it should react the same way as before (correctly this time).
Fixed in branch master, commit 429868ea25
Fix #278230: Looking at staff properties changes clef of instruments with multiple staves
Only check clef change if instrument changes.
Fixed in branch master, commit 116866dab7
Merge pull request #4257 from JoshuaBonn1/278230-changing-clef
Fix #278230: Looking at staff properties changes clef of instruments …
The bug still existed if you opened staff properties and changed the part name.
https://github.com/musescore/MuseScore/pull/4310
Fixed in branch master, commit 80333371f6
Fix #278230 (again): Looking at staff properties changes clef of instruments with multiple staves
Bug still existed if part name was changed.
It exclusively should change when the instrument changes.
Fixed in branch master, commit 7e4ede3baf
Merge pull request #4310 from JoshuaBonn1/278230-changing-clef
Fix #278230 (again): Looking at staff properties changes clef of inst…
Automatically closed -- issue fixed for 2 weeks with no activity.