accidentalType boolean
I tried to check if a note had an accidental by checking the type with: if (curScore.selection.elements[0].accidentalType=="NONE")
and it does not seem to work but accidentalType==0
works. Why is that? If that's the case, shouldn't there be a list of corresponding numbers in the API: https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/names…
Comments
"NONE" is a string, you'd need AccidentalType.NONE (and accidentalType is not a boolean but an enum)
In reply to "NONE" is a string, you'd… by Jojo-Schmitz
As part of an
if
statement?if (curScore.selection.elements[0].accidentalType.NONE)
does not work. I'm using strings for element types inif
statements.In reply to As part of an if statement?… by jonarnold
I meant
if (curScore.selection.elements[0].accidentalType == AccidentalType.NONE)
In reply to I meant if (curScore… by Jojo-Schmitz
Ah thanks. So the accidental type is not really a string? I'm trying to understand why we have to do what you suggest with that value but
if (elementsList[i].name != "Accidental")
works.In reply to I meant if (curScore… by Jojo-Schmitz
Also, that code results in ReferenceError: AccidentalType is not defined
In reply to Also, that code results in… by jonarnold
Dunno, but
if (cursor.element.type === Element.REST)
is valid code, so I don't see howif (curScore.selection.elements[0].accidentalType === AccidentalType.NONE)
is notIn reply to Dunno, but if (cursor… by Jojo-Schmitz
Right. So should I file an issue?
In reply to Right. So should I file an… by jonarnold
Hmm, maybe. Maybe that in
enum AccidentalType : unsigned char {
that: unsigned char
is the problemIt is tricky. The enumeration name is not "AccidentalType" but "Accidental".
var sel=curScore.selection.elements;
var el=sel[0];
In reply to It is tricky. The… by parkingb
Wow, that's not at all clear in the documentation. Especially when the property reads from accidentalType.
In reply to Wow, that's not at all clear… by jonarnold
Indeed, very confusing
In reply to Indeed, very confusing by Jojo-Schmitz
Caused by this comment: https://github.com/musescore/MuseScore/blob/3.x/mscore/plugin/api/qmlpl…
In reply to Caused by this comment:… by jeetee
Mak s sense, but renders the documentation useless
In reply to Mak s sense, but renders the… by Jojo-Schmitz
PR it ;-)
10500 is just around the corner :D