import MuseScore 3.0 MuseScore { menuPath: "Plugins.musicaFicta" description: "Place editorial musica ficta above staff." version: "1.3" onRun: { //Assume user has selected a single accidental in the score and that accidental has been unaltered //This will not currently work correctly if the accidental has been moved or resized already var ficta = curScore.selection.elements[0]; var targetLine = -4; // -4 is two ledger lines above staff var origLine = ficta.parent.line; var targetOffsetY = (targetLine-origLine)/2; // calculate the difference & convert to staff spaces // calculate horizontal center, accounting for resizing the accidental to small var smallNoteRatio = curScore.style.value("smallNoteMag"); var accidentalPosX = ficta.posX*smallNoteRatio; var accidentalWidth = ficta.bbox.width*smallNoteRatio; var noteWidth = ficta.parent.bbox.width; var targetOffsetX = (noteWidth-accidentalWidth)/2-accidentalPosX; //apply properties ficta.small = 1; ficta.offsetX = targetOffsetX; ficta.offsetY = targetOffsetY; Qt.quit(); } }