Coloring slurs from within a plugin
Hello,
i am working on a plugin to simplify exercising for a choir.
Simplified description:
In the plugin, the following choices can be made:
The exercise "Part" can be chosen by radiobutton.
The "Channel" (if more then one) can be chosen by radiobutton.
For the above choices the plugin now solely amplify volumes. Also colours (purple) the relevant notes(coloring includes stems, hooks, beams, dots, ties and gracenotes). All other channels/notes/etc are de-amplified and greyed out.
My question:
I want to colour the relevant Slurs as well, but i can't figure out how to do that.
I think it's not possible but if there is some workaround i like to hear about it !
background info:
This example code works:
[START CODE EXAMPLE]
colorElement( cursor.element.notes[k].tieForward , color_wanted) <<<<<<< (this works)
.....
.....
cursor.next()
// colorelement colors the element and puts in front with .z
[END CODE EXAMPLE]
but something similar with a Slur does not work
appriciate your help in this!
Harrie.
Comments
MuseScore gives less controls over slurs than ties, but you can try searching through a selection:
In reply to MuseScore gives less… by XiaoMigros
Thank you for your answer.
This didn't work either. When replacing the word "SLUR" with "REST" your method works(coloring rests). So essentially it should be correct.
Again, thank you for your suggestion!
Harrie.
In reply to Thank you for your answer… by hpcs444@gmail.com
It works fine for me...
In reply to It works fine for me... by XiaoMigros
In that case, i'l have to re-examine!
thank you!
In reply to In that case, i'l have to re… by hpcs444@gmail.com
the plugin counts on the fact that you are able to somehow select the slur first, either through select all, or through a specific selection range, so make sure to choose one of the options!
In reply to the plugin counts on the… by XiaoMigros
You're right,
that is exactly what i didn't do!
In reply to You're right, that is… by hpcs444@gmail.com
Hi,
i tried your solution, my problem is solved (a workaround):
I could programmatically (by your method) select all slurs, but i could not find how the slur was "attached" to a specific note, channel or voice.
I tried all kind of searches on elements but got "undefined", "cannot read property of null..","cannot read property of undefined" et cetera et cetera.
I could find the Part/Staff it was attached to:
if the name was "Slur"(or something else) then i found the part/staff with
curScore.selection.elements[i].staff.part.startTrack
et cetera
but that was as far as i could get the information.
So i decided to make the selected slurs invisible, Slurs have in my case no effect on playback, and the scores are solely used for practice, and not while singing in the choir itself.
Thank you for your help!
Harrie.
In reply to Hi, i tried your solution,… by hpcs444@gmail.com
A bit late in the day but I'm also having 'fun' with slurs in MS3 plugins. I think that you can access the slur's track property, which may be sufficient for identifying the correct slurs to colour.
In reply to A bit late in the day but I… by yonah_ag
That did the trick!
thank you!