How to add symbol to score?
Please, how is it possible to add symbol to score via plugin?
I tried following, but it is not working.
What I am doing wrong please?
Thank You.
var sym = newElement(Element.SYMBOL); sym.symbol = "noteheadSlashDiamondWhite"; cursor.add(sym);
Comments
maybe you can try
sym.symbol = "<sym>noteheadSlashDiamondWhite</sym>";
In reply to maybe you can try sym.symbol… by Jojo-Schmitz
Thanks, but it still doesnt work.
Here is comlete snippet.
I'm not sure you can add symbols that way.
You can add staff text however, and set the text property to the symbol you want enclosed in sym tags
In reply to I'm not sure you can add… by jeetee
Thanks, it seems to be usable workround at the moment.
Does it mean, it is not possible to create symbols via plugin?
Here are few examples (made in Musescore, not by plugin).
First symbol is assigned to staff (this can be probably hacked by staff text).
Scond is assigned to note. Can be this done somehow?
Thanx.
In reply to Thanks, it seems to be… by sammik
The issue seems to be that you are trying to add a symbol to a rest while a cursor assumes that symbols should be added only to notes. So if you position a cursor to a note before adding the symbol then your code should work fine. In UI you can add a symbol to a rest so this is apparently something that was missed when adding that functionality to a cursor, but otherwise creating symbols is possible with plugins.
In reply to The issue seems to be that… by dmitrio95
So this code change:
should fix this, shoudn't it?
See https://github.com/musescore/MuseScore/pull/7868 (for 3.x, check the artifacts to test)
and https://github.com/musescore/MuseScore/pull/7869 (for master)
Edit: both have been merged, so should be found in the development builds at https://musescore.org/en/download#Development-builds shortly
In reply to So this code change: diff -… by Jojo-Schmitz
Yes, this should indeed fix this case
In reply to Yes, this should indeed fix… by dmitrio95
Thanks, for this.
But UI allows to add symbols to segment too (if it is not a bug), like staff text.
So, in case, it is not a bug, may be, question, if it wouldn't be better to cursor add it to segment.
And note.add(symbol) would add it to note (it does, in fact).
In reply to Thanks, for this. But UI… by sammik
A staff text is not a segment. You can add staff text, and you can add symbols to staff text, usi the syntax described furter up, that is what the UI does too, under the covers.
In reply to a staff text is not a segment by Jojo-Schmitz
Sorry for my english. I didnt meant "staff text is segment", but "like staff text is addet to segment".