Text placement and skipping of tied notes

• Sep 22, 2019 - 11:11

Dear all,
I wrote a little macro to display some fingerings as a text. The text should be displayed below the stave. However, I have two problems:
- For every text item, the box "Automatic placement" is ticked on. I want to tick it off in my macro and use more a fixed position of the text
- The text should not be displayed for tied notes, but I don't know how to do this in a macro

Your help is very much appreciated!
Thanks, Philipp

Attachment Size
FlötenGriffe.qml 7.79 KB

Comments

not sure about tied notes but there's a boolean attribute autoplace you can use like:

var text = newElement(Element.STAFF_TEXT);
text.text = 'your text here'
text.autoplace = false

I guess it must be true by default.

For detecting/skipping notes based on ties, starting with 3.3:
/// Backward tie for this Note.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Tie* tieBack READ tieBack)
/// Forward tie for this Note.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Tie* tieForward READ tieForward)
/// The first note of a series of ties to this note.
/// This will return the calling note if there is not tieBack.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Note* firstTiedNote READ firstTiedNote)
/// The last note of a series of ties to this note.
/// This will return the calling note if there is not tieForward.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Note* lastTiedNote READ lastTiedNote)

If the text should be displayed below the staff, setting its placement property may be better than disabling autoplacement for it:
text.placement = Placement.BELOW

Actually I would recommend to set placement property correctly even if disabling autoplacement for an element, this can potentially make calculating positions easier and is generally more likely to work better across different scores and MuseScore versions. Still that is not strictly necessary.

Do you still have an unanswered question? Please log in first to post your question.