Hide when empty: Instrument does not work (acts same as Auto)

• Nov 30, 2018 - 00:05
Reported version
P0 - Critical
S3 - Major

The new Instrument setting for "Hide when empty" in Staff Properties is not doing what it was designed to do. The idea was that when using Hide empty staves, you might want have the whole grand staff either present or not, rather than having the top staff of the piano part hidden but the bottom not. This isn't working - the top staff does get hidden if empty and "Hide empty staves" is enabled. For instance:

1) load attached file
2) Format / Style
3) Enable Hide empty staves

Result: top staff of piano disappears on second system even though bottom staff is still present (as it should be). Both staves of the piano part have been set to "Instrument" under "Hide when empty".

Attachment Size
hide-instrument.mscz 8.67 KB


Status duplicate active

When instrument in selected, the staff should only be hidden when all staves in the instrument are empty, So on a piano with the right hand empty and notes in the left hand, both staves should be visible, so while this might be related, it's not the same issue and needs to be looked at separately.

Also, Marc posted both issues, he usually knows what he's doing.

I'm sorry that action was indeed too fast. I just tested the example and had a quick look at the code. The affected function is exactly the same as for the linked issue which was the reason I didn't dig further. (I missed that Marc was the author here, otherwise I would have directly looked more carefully.
So after a deeper look I couldn't even find a implementation for the behavior Marc described. The property Instrument can be set and is available but is never used. I found Marcs PR from 3 years ago but Werner directly removed this feature weeks later...
Still, thus it is the same function that is affected here, it is best to fix it all together.

Interesting, it's been missing all this time? I don't recall it having been particularly difficult to implement that option, so I would imagine it would be simple enough to add it back. but I don't know about the other issue, which is of course far more serious. If they can be fixed together, great.

Oh, now here's something crazy. Looking at that PR, I had completely forgotten I added code so the presence of staff text would cause a staff to not be considered empty for the purpose of hide empty staves. That much still works, and it works even if the text is invisible.

That means this "not empty" element I keep thinking would be nice to add, to make it easier to prevent a staff from being hidden - it's been there in plain sight. What if just added a new item to the Text palette - an invisible text that says "not empty"? I just tried it by customizing a palette and it works as expected (assuming you add it to the first measure of the system, due to the other bug mentioned.