Plugin: Accessing rest dots
How do I access rests dots in a plugin to change their colour? I can change the colour of the rests themselves but, even though there are dotted rests in my score, I can't seem to get a handle on the dots.
This console.log line never triggers:
Comments
They're not available :'(
While dots internally can be accessed for a ChordRest, for some reason the Plugin API defined them directly and solely on a Note: https://github.com/musescore/MuseScore/blob/3.x/mscore/plugin/api/eleme…
In reply to They're not available :'(… by jeetee
Thanks. I'll use 2 rests instead of a dotted rest.
You can assess this by the duration:
Remark: "dotted" elements have always a length >= 1.5* the "non-dotted" element length.
This code also deals where one have to achieve a length between in [1,1.5[ of the the "non-dotted" element.
In reply to You can assess this by the… by parkingb
Good guessing. Not sure how it holds up if inside a tuplet?
But it doesn't help at all in getting the dot element to be able to change it's color property ;-)
In reply to Good guessing. Not sure how… by jeetee
Actually, it does because the duration of an element within a tuplet is not affected by the tuplet. It is the duration "as-if-there-were-no-tupelt" (should retest it to be sure at 100%).
In reply to You can assess this by the… by parkingb
If I can't get a JavaScript object to access the rest dot then I don't see any way of changing the dot's properties, e.g. colour. Am I missing something?
(I can do this easily enough via my Excel plugout framework but that means working with the MSCX file rather than the MSCZ file which, in this case, is just not an efficient way to work.)
In reply to If I can't get a JavaScript… by yonah_ag
I'm now wondering whether the dot would be included in
selection.elements
if you select that chord as a range.In reply to I'm now wondering whether… by jeetee
Maybe, but this code already runs against the whole score which I guess is already a range.
https://github.com/yonah-ag/musescore-tidy-tab-score/blob/main/TidyTabS…
In reply to Maybe, but this code already… by yonah_ag
That's a private repo, so 404 for me.
My line of thinking was that if the dot is included in
selection.elements
then you could use the Selection API to range select your rest, which should also select the dot.In reply to That's a private repo, so… by jeetee
Oops! It's public now.
Selection.elements sounds like it would not be useable unless I actually selected a range. This plugin processes the whole score as it has no benefit in applying only to selections, but I'll check out your suggestion as a possible workaround.
In reply to Oops! It's public now… by yonah_ag
You can force a selection with the selectRange method. Sometimes with the API you don't have any other choices than making an explicit selection in order to access some elements or functions you would normally expect to be exposed by the API as object properties or object methods but that are not.
In reply to You can force a selection… by parkingb
Thanks, I'll have a go with that idea.