Show instrument name on lower staff when upper staff of multi-staff instrument is empty and hidden

• Aug 15, 2016 - 15:14
P1 - High
S5 - Suggestion

If you have hide empty staves set including first page, and at the beginning of your score you have a piano part with the upper staff empty but notes in the lower staff, then that lower piano staff has no instrument name, and no abbreviated instrument name subsequently, until there are notes in the upper staff, at which point the instrument name/abbreviations appear.

A work around is to put in the Piano/Pno. as staff text on the displayed but unlabeled lower piano staff and then drag that text to the proper place to the left of the lower staff where the label should be, easy enough, but I'm concerned that this may cause problems in later revisions.
Is there any other way to do it?

Ideally, I think, the feature in Musescore should be re-programmed with the logic:

IF hide empty staves = on
AND IF instrument = piano
AND IF upper piano staff empty
AND IF lower piano staff not empty
THEN display instrument name or abbreviation on piano lower staff

(The same could be done for other multi-stave keyboard instruments.)


I *swear* there was an existing issue for this, but I can't find it. Maybe it was just a forum thread. My memory is that it was submiutted by chen lung.

Running into this while preparing an old score for publication. The situation in which I'm encountering the bug is not, I think, that uncommon, but the only workaround is to manually position restyled staff text at the beginning of each system (and then switch to the part and make each one invisible).

Status duplicate active
Priority P1 - High

This is not a duplicate. The other issue involves a specific corner case - changing order of staves after getting everything the way you want it. It’s minor and not necessarily a bug at all. Whereas the issue here is considerably more serious. Still just a “suggestion”, but one I think most would enthusiastically support.

Things disappear all the time - like if you delete something, press "V" to toggle visiblility, turn on Hide empty staves, etc. Right now, the official behavior is that only the topmost staff name of an instrument is used in naming the group. So it's completely correct according to that behavior that reordering the staves would cause staff names to appear or disappear accordingly. The question is, should we change the current behavior in terms of how staff name names are displayed? I think soi, but that's the other issue. This issue is about, should we employ some sort of magic on upon the rare operation of staff reordering to force the name to displayed after the reordering even though it wouldn't normally be given those settings when created from scratch. Like maybe, have the staff reordering code go in and delete the name from the former top staff and copy it to the new top staff. That would actually be the only way I can see to address this issue independently of the other. And I'm not convinced we should do anything of the sort. I think we should simply address the other and then this one becomes moot.

Right sorry, this issue is the real one, the other is the one I said was not. i was confused because you responded in this one. It’s currently by design (and hence not a bug), but it’s a design we all recognize could be improved.

FWIW, I don't have time to deal with this right now, but I suspect the problem is here:…

This is where we add the instrument names to the front of the system. As you can see, we're skipping any staff for which isTop() is false. That code is presumably intended to keep the staff name from being duplicated on both staves when both are shown. But it needs to be tightened up to make sure we don't just process the top staff of each instrument, but the top visible staff of each instrument. This code is skipping the top staff when invisible, but isn't also doing anything to make sure the next staff gets the name. It could set a flag to be remembered for the next iteration of the loop, or maybe we need an isTopVisible() function to check instead of the two separate checks for top & visible, because the bottom staff needs to return true when the top staff is not visible.

When working on this issue (I have a solution, just cleaning up the code), a question came up: When the top staff of e.g. a piano is invisible because it is empty, how about the brackets. Now they are invisible too but I expected there should be still a bracket at the single staff. Am I right there?

Has there been a solution to this yet? Currently working on a score that is experiencing the same issue (I think) for school. The organ part name is displayed only sometimes. I assuming this has something to do with some of my organ staves going invisible when they're empty.

Attachment Size
Screen Shot 2020-04-18 at 3.05.59 PM.png 165.37 KB
Status PR created fixed

Fixed in branch master, commit f30891cd74

_Fix #121416 - Show instrument name on lower staff when upper staff of multi-staff instrument is empty and hidden

Root cause is a nice catch-22 in collectSystems().
First setInstrumentNames() is called to create InstrumentName elements. To do so correctly,
it needs information on which staves are hidden but this is information becomes available
much later, after it is know which measures are a system because now we know which staves
are empty and can be hidden.
The InstrumentName elements are required because this affects the available space for

The choosen solution is to move the InstrumentName elements from the top staff to the
first visible staff of the part. Since this is known in a very late stage, checks of
whether a staff is visible or not had to be removed or replaced by a check whether the
part owning the staff is visible.
To support these checks, new method are added, firstSysStaffOfPart(), firstVisibleSysStaffOfPart(),
lastSysStaffOfPart() and lastVisibleSysStaffOfPart()._

Fix version