Skip to content

Can't insert clefs in percussion stave after changing to pitched instrument #28126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
Reedbeta opened this issue May 23, 2025 · 3 comments
Open
4 tasks done
Assignees
Labels
P2 Priority: Medium percussion Pertaining to percussion instruments (notation or playback) UX/interaction

Comments

@Reedbeta
Copy link
Contributor

Issue type

UX/Interaction bug (incorrect behaviour)

Description with steps to reproduce

In percussion staves we cannot change the clef. However, after inserting a later instrument change to a pitched instrument (e.g. glockenspiel), we should be able to insert clefs as usual in the section after the instrument change. Currently, MuseScore forbids this. Also, if the clef created by the instrument change itself is accidentally removed, we cannot add it back.

Steps to reproduce:

  1. Create a new score with a Mixed Percussion staff.
  2. At some point after the beginning of the score, insert a Change Instrument text and choose Glockenspiel.
  3. Attempt to drag a clef from the palette to a point on the score after the instrument change.
    Expected result: the clef is added to the score
    Actual result: the clef disappears

Supporting files, videos and screenshots

musescore.clef.on.percussion.staff.mp4

What is the latest version of MuseScore Studio where this issue is present?

4.5.2, also present in master

Regression

I was unable to check

Operating system

Windows 10

Additional context

No response

Checklist

  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
@Reedbeta
Copy link
Contributor Author

Likely related to #14714, perhaps also #26362.

I've traced the issue to this bit of code in Score::undoChangeClef:

StaffType* staffType = staff->staffType(e->tick());
StaffGroup staffGroup = staffType->group();
if (ClefInfo::staffGroup(ct) != staffGroup && !forInstrumentChange) {
continue;
}

which checks if the StaffGroup of the clef matches that of the staff. The trouble is, the staff is still StaffGroup::PERCUSSION after the instrument change, and so any pitched clef will fail this check. It seems like the instrument change should also update the staff type.

I'm looking into this as a potential fix, but I'm not very familiar with these data structures, so any suggestions welcome.

@Reedbeta
Copy link
Contributor Author

A workaround for this is to change the percussion "staff type" to "standard" in the layout panel. Then it seems like clefs behave as expected, in both the unpitched and pitched sections of the staff - i.e., I cannot insert a pitched clef in the unpitched sections, but I can in the pitched sections.

@its-not-nice
Copy link
Contributor

See also #24629

@bkunda bkunda added the percussion Pertaining to percussion instruments (notation or playback) label May 27, 2025
@bkunda bkunda moved this to Next one or two releases in MuseScore Studio Backlog May 27, 2025
@bkunda bkunda added the P2 Priority: Medium label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority: Medium percussion Pertaining to percussion instruments (notation or playback) UX/interaction
Projects
Status: Next one or two releases
Development

No branches or pull requests

5 participants