Accessing Articulations and Layout breaks after creation
Hello,
I have some issues accessing to some informations after having created it within a plugin. Does anyone know how to retrieve an articulation in the score please ? I thought I could find them with the following code, but I had no success with it. The console show no result when it's applied to a nota with an accent.
var cursor = curScore.newCursor()
cursor.rewind(1)
var i=0
var segmentTemp=cursor.segment
for(i=0 ; i
Comments
Articulation is an element type. So you'd need to cycle though all elements of the score or selection and pick on their type.
Check the "walk.qml" plugin:
In reply to Articulation is an element… by Jojo-Schmitz
Hello ! Thank you for your answer. I know how to cycle through all the elements of the score with the cursor, but I am not able to find any Element.ARTICULATION or any Element.LAYOUT_BREAK, even with the "walk.qml" plugin.
As I have seen on the documentation, Articulations are considered as annotations of a segment and have as parent a chord element. But I wasn't able to find them this way either. Do you have an idea why please ?
In reply to Hello ! Thank you for your… by millermix
No, I don't, sorry
In reply to No, I don't, sorry by Jojo-Schmitz
Thank you for your time !
In reply to Hello ! Thank you for your… by millermix
I believe that articulations are not annotations on the segment but rather are children of chordrest elements directly. The exception is fermatas which are kind of a separate class. I'm not sure what that might mean as far as plugins go, but I wouldn't be trying to find them on the segment. if they are exposed at all, I'd expect it to be as a method on the chordrest.
In reply to Hello ! Thank you for your… by millermix
The
walk.qml
plugin only walks through "main" elements of the score like chords or rests. To search for annotations you should get the current segment and check its annotations list. Layout breaks are attached to a measure so you should use the measure.elements property, like this:Here's a slightly enhanced walk.qml which encorporates the information pointed at by dmitrio
In reply to Here's a slightly enhanced… by jeetee
Mind to PR this?
In reply to Mind to PR this? by Jojo-Schmitz
https://github.com/musescore/MuseScore/pull/9601
Feel free to add it into the 3.x pending PR too
In reply to https://github.com/musescore… by jeetee
Thanks, and done ;-)