Howto add a part/staff from a musescore 3.3 plugin
Can anybody explain me how to insert/append a new staff/part from a Musescore 3.3 plugin?
I'm currently working on a plugin that generates chord notes from chord text in a dedicated (new) staff. When playing, this staff will direct the connected arranger of my keyboard to play a multi-fingered chord.
I tried to insert a new staff/part from Musescore 3.3 plugin in various ways, but the only thing I succeed in is crashing Musescore.
Comments
Have you figured it out? I am trying to do the same thing
In reply to Have you figured it out? I… by sotniarchos1
No succes until now.
In reply to No succes until now. by wk275
I don't know if it's doable or not, but you will find that the subset of objects, constructs, and facilities available to plugins is not at all comprehensive; each structure or function to be made available to QML has to be added to the core code explicitly at some time.
In reply to I don't know if it's doable… by [DELETED] 1831606
Do you mean that it is not 'available' yet.
In reply to Do you mean that it is not … by wk275
I don't know because I haven't looked into it, but I would not be at all surprised. Look at every single plugin which exists and see if any creates staves. On the other hand, I seem to remember that the old "half-time" plugin (that's an MS3 facility now, much better) created "parts" with its output. See if you can find a copy of it (and that isn't to say that whatever it does will work in ms3).
In reply to I don't know because I haven… by [DELETED] 1831606
Already checked all plugins, but did not found any that add a staff.
In reply to Already checked all plugins,… by wk275
Checked also half-time plugin.
It does not add a staff but rather opens a new score. See statement below.
var score = newScore("HalfTime", "piano", 32); // 32 measure limit
In reply to Checked also half-time… by wk275
Great (?), thanks for doing that research. I suspect it's not possible, or there would be plugins using it left and right.
Very sad. I have had (almost) the same idea. In MuseScore 1.x there was curScore.appendPart() method. I don't see it now. Look here: https://musescore.org/en/project/add-staff.
In reply to Very sad. I have had (almost… by gideonrv
An API for adding or removing parts is indeed missing from the current version of plugins API. But I had plans to implement some reasonable API for managing instruments so I hope to be able to add it to some of the next versions of MuseScore. Maybe someone else could also implement it earlier, pull requests for this are always welcome!