Accessing MeasureNumber element by plugin?
Is it possible to programmatically access arbitrary MeasureNumber elements within a score? (the elements you select when you click the measure numbers on the page – so you could adjust the visibility, offset, etc. of each)
I don't seem to get these when I iterate over Measure::elements, Segment::annotations, Segment::elementAt, etc. or with Cursor.
Currently, I have the user manually select a measure number before running the plugin, then execute cmd("select-similar")
and iterate over the current selection – but this seems unideal.
If this isn't possible, I might be willing to write a PR to add it to the plugin API, if anyone could point me in the right direction in the source code!
Comments
I do not think those are exposed, as they are on-the-fly generated element (like courtesy key signatures).
In reply to I do not think those are… by jeetee
I thought as much. I'm thinking it would be helpful to expose these elements through the API. They (courtesy key signatures, measure numbers, etc.) do appear in the Debugger as child elements of each Measure.
It seems inconsistent that you can access these elements through the API if they are manually selected, but not otherwise.
In reply to I thought as much. I'm… by RunasSudo
Inconsistent as in: the selection API was added way later than the other properties and you're assuming more than an afterthought was spend on creating/maintaining the API
Whelp, I jumped and put in a PR: https://github.com/musescore/MuseScore/pull/10358