[QML] Trouble accessing MS elements and properties
I don't seem to be able to access anything different than a chord (and notes).
Can someone post an example that goes through a score to access e.g. a dynamic marking?
{syntaxhighlighter brush:cpp}
if(cursor.element.type == Element.CHORD) //does work
//EVERYTHING ELSE, like:
if(cursor.element.type == Element.DYNAMIC)
//do not work
[...]
while (segment) {
var element = segment.elementAt(track);
if (element) {
var typeName = element.userName();
console.log(typeName);
/* this last instruction only gives these types of elements:
"Clef, Key Armature, Chord, Rest", and maybe something else;
but no .TEXT, for example. No .DYNAMIC., .SLUR., .SLUR_SEGMENT, etc.,
even though I have these elements in my score.
*/
{/syntaxhighlighter}
Comments
Many elements like staff text / lyrics / dynamics are attached to a segment as an annotation, rather than the base element of that segment.
See for example this plugin from the testsuite that walks (only) over annotations: https://github.com/musescore/MuseScore/blob/master/mtest/scripting/test…
In reply to Many elements like staff text by jeetee
Thank you.
Lack of plugin documentation makes me feel very lost.
I feel bad asking too many questions, but I hope after a while I'll get the hang of it.
I successfully got a Dynamic object, now I'm trying to read its range value.
{syntaxhighlighter brush:cpp}
if(range==Dynamic.STAFF)
...
{/syntaxhighlighter}
It says:
ReferenceError: Dynamic is not defined
But the (very skinny) manual says the enum is
enum (Dynamic.STAFF, .PART, .SYSTEM)
Also, how do I read its "intensity" value (if it's ever accessible)?
Edit:
I also don't seem able to access hairpins and lines in general.
In reply to I feel bad asking too many by 255
Quick summary of what was found during our IRC talk for future reference:
#118196: QML DynamicsRange exposure broken
#118201: QML Dynamic exposure incomplete