Plugins for 4.x
Porting 3.x plugins to Musescore 4
Plugin system change coming up in 4.x, it'd be wise to wait, see github issue.
Discuss with other dev in this forum thread, tips navigating github Mu4 repo
Some plugins have been ported to or created for Mu4:
- This list (Plugins in the repository marked as being available for 4.x)
- Batch Convert (not really working though, except for the UI)
Tips for adapting plugins for 4.x
Volatile: prone to become outdated as the plugin API changes
Last updated: 23rd Feb 2023
- Have your plugin and all its dependencies (if any) in its own subfolder (example),
- In the top folder, place your README.md file (if any)
- Consider adding a
.gitattributes
file in the top folder for preventing all the "non plugin files" to be incorporated in your releases - At the level of the code, add the new Mu4 properties conditionally, example:
id: some_id Component.onCompleted : { if (mscoreMajorVersion >= 4) { some_id.title = qsTr("Some Title") ; some_id.thumbnailName = "some_thumbnail.png"; some_id.categoryCode = "some_category"; } }
title
is definitely recommended and needed to have it show in the Plugin Manager.
thumbnailName
and categoryCode
(Mu4 knows about "composing-arranging-tools", "color-notes" and "playback" and would shows those translated) are nice to have.
5. If you add a logo, place it in the plugin subfolder.
6. Place your translations files (if any) in a "translations" folder placed the plugin subfolder.
7. Remove all Qt.quit();
else the plugin will crash MuseScore 4.0! See alternatives in this post.
If you don't intend to use the plugin with Mu3, you can replace the Qt.quit();
by quit();
however the latter is not supported by Mu3, so will throw an error, although that can apparently safely get ignored.
If you want to avoid that message and change the Mu3 version as little as possible, use this:
(typeof(quit) === 'undefined' ? Qt.quit : quit)();
Instead you could also use return;
, which should work in all MuseScore versions.
8. The APIs readScore()
and writeScore()
are not functional in Mu4.0.
9. If your plugin modifies a score, those modifications need to be enclosed by
curScore.startCmd(); ... curScore.endCmd();
This should be done for Mu3 too, but there is optional, for Mu4 it is mandatory though.
10. pluginType: "dock"
is not working.
11. The filePath
property isn't working. You could use Qt.resolvedUrl(".").replace("file://", "")
instead.
REMARKS:
- These tips are meant to have the plugins working for both MuseScore 3.x and 4.x
- Even if you follow those steps, the adapted plugins might not even showing up in Mu4's plugins list. If so check the logs for hints (on Windows: "%LOCALAPPDATA%\MuseScore\MuseScore4\logs\").
- The UI are not always rendering nicely. E.g. most labels are cropped after a few characters (MuseScore doesn't seems to respect the
Text.elide
default values)