Plugin get reference on Glyphs

• 18. Okt 2023 - 17:00

Is there a way using the MuseScore Plugin API to get references to individual glyphs to get their bounding boxes? For example, get the bounding box of individual sharps/flats in a key-signature, digits in a time-signature or tuplet or of the individual eighth rests in a 128th rest.
Also I noticed that the issue described here https://musescore.org/en/node/293837 still persists as of now in MuseScore 3.6.2 Plugin-API.
I need those information to create data for Optical Music Recognition directly from any musicxml via plugin.

Will MuseScore 4 plugin API allow for this?


Comments

Antwort auf von Jojo-Schmitz

with a plugin like this:

import QtQuick 2.0
import MuseScore 3.0
import FileIO 3.0

MuseScore {
version: "3.0"
description: "Tokenize a score for OMR"
menuPath: "Plugins.Tokenizer"

onRun: {
if (!curScore)
Qt.quit();
var cursor = curScore.newCursor();
cursor.rewind(Cursor.SCORE_START);

//loop over measures
var measureIdx = 0;
while(cursor.measure) {
  console.log("----- Measure "+measureIdx+" -----");
  console.log(cursor.measure.parent);


  cursor.nextMeasure()
  measureIdx++;
}
Qt.quit();

}
}

I get different system objects for example dispite several measures being in same system

Debug: ----- Measure 0 -----
Debug: Ms::PluginAPI::Element(0xeefa040)
Debug: ----- Measure 1 -----
Debug: Ms::PluginAPI::Element(0xeefa490)
Debug: ----- Measure 2 -----
Debug: Ms::PluginAPI::Element(0xeefb450)
Debug: ----- Measure 3 -----
Debug: Ms::PluginAPI::Element(0xeefaa00)
...

checking these objects for equality (sys1 == sys2) will also always return false

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