Fretboard plugin

• Sep 1, 2024 - 17:51

For some reason I can't join in on the existing topic. I had this plugin working in 4.3.x but updating to 4.4 this morning killed all the plugins I had added. Has any one figured out a work around?

Sean


Comments

I've tried and added 2 lines to the attached

But it fails with
2024-09-01T19:49:40.473 | ERROR | main_thread | ExtPluginRunner::run | "file:///C:/Users/Jojo/Documents/MuseScore4/Plugins/fretboard-plugin-master/MU4FretboardDockPanel.qml:1 module \"MuseScore.Dock\" is not installed\n"

Attachment Size
Fretboard.qml 5.18 KB

In reply to by moisesinzg

This is what the author wrote when porting the plugin to MS4.0 (dmitrio95 • Dec 19, 2022 - 20:00)

Update: MuseScore 4 support
I have just uploaded a version of the plugin that works with MuseScore 4. Unfortunately MuseScore 4 lacks some part of the API that was used by this plugin so I had to use work around this using APIs that are not meant to be public and stable. Therefore it may potentially stop working with future updates of MuseScore 4, but for now it is here, and seems to mostly work as expected.

https://musescore.org/en/node/295404

In reply to by graffesmusic

Some more info: (dmitrio95 • Dec 19, 2022 - 20:32)

The dock plugin type is indeed unsupported in MuseScore 4, but if it is really necessary (or just fun to do it), it can be worked around. I made a small test plugin to debug this (attached here: DockPlugin.qml), and also included this workaround to the Fretboard plugin, so you can also see it there.
The idea is, since the UI is written in QML and even appears to share the same QML engine with plugins, plugins can make use of large parts of the API available to the UI components. This API is apparently not meant to be public and stable, but it can be used to get something working.
With this engine we have the ui global property which points to the engine itself which has few important properties, like the pointer to the root item of the UI. By searching through the root item's children we can find the notation page which is the page when we want our dock plugin to appear. We can wrap then our widget into an item suitable for adding to the dock system and just append it to the panels list.
The curious part is getting our new panel to show. With MuseScore native panels this happens via the "dock-toggle" command which shows a dock panel given by its objectName. This command cannot be invoked directly from a plugin. However a plugin can invoke a command to show one of the existing dock panels, like palettes or piano keyboard. Therefore we can abuse this system by pretending our panel to be, say, a piano keyboard, telling MuseScore to show the piano keyboard and then renaming all the objects back. The plugin's dock panel would appear in the same place as the piano keyboard (or whichever panel your panel has pretended to be) — it may even appear to be floating if the user has previously undocked the original panel. Therefore with this method you do not have full control over the place where the plugin's panel would appear, but it does work and does add a plugin-originated panel to the MuseScore's dock widgets system. The new panel can then be docked, moved and closed just like any other dock panel.
Overall, it looks like the fact that the UI is mostly written in QML will give a lot of interesting and unexpected possibilities to plugins, despite they will require some effort to discover and will be not as stable as the public plugin API can afford.

https://musescore.org/en/node/338769

Good luck.

In reply to by graffesmusic

If you change
import MuseScore.Dock 1.0 as MUDock
to
import Muse.Dock 1.0 as MUDock
then we don't have this error anymore: MU4FretboardDockPanel.qml:1 module \"MuseScore.Dock\" is not installed\n
But instead:
ExtPluginRunner::run | Qml Object not MuseScore plugin: /home/charles/Documents/MuseScore4Development/Plugins/fretboard-plugin-master/MU4FretboardDockPanel.qml

See: src/framework/extensions/internal/legacy/extpluginrunner.cpp

IPluginApiV1* plugin = dynamic_cast(obj);
if (!plugin) {
LOGE() << "Qml Object not MuseScore plugin: " << qmlPath;
return make_ret(Err::ExtBadFormat);
}

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