MuseScore Plugins_Plugin Manager Listings - Every QML file listed even if it cannot be executed as a plugin.

• Aug 14, 2018 - 16:04
Reported version
3.0
Type
Plugins
Frequency
Few
Severity
S5 - Suggestion
Status
closed
Regression
No
Workaround
No
Project

The MuseScore Plugins_Plugin Manager Listings show all QML files, but not all QML files are executable plugins. The problem occurs when a user creates a plugin with a main QML file, which then calls secondary QML files. Ideally MuseScore Plugins_Plugin Manager Listings should only show executable plugins and not secondary plugin QML files that cannot be executed directly from MuseScore Plugins_Plugin Manager.

Example 1 MuseScore Plugins_Plugin Manager Listing:
QuarterTonePlayback.qml (main executable)
SlashFlatButton.qml (not an executable plugin as called by QuarterTonePlayback.qml)
SlashSharpButton.qml (not an executable plugin as called by QuarterTonePlayback.qml)

Example 2 MuseScore Plugins_Plugin Manager Listing:
TuningCents.qml (main executable)
Blackkey.qml (not an executable plugin as called by TuningCents.qml)
Keyboard.qml (not an executable plugin as called by TuningCents.qml)
Notekey.qml (not an executable plugin as called by TuningCents.qml)
Whitekey.qml (not an executable plugin as called by TuningCents.qml)

In order to list only executable plugins, MuseScore would likely have to look at the first line in a QML plugin file for an indication that the QML file is the valid executable plugin file. If the line does not exist in the QML file, the QML file would not be listed in the MuseScore Plugins_Plugin Manager Listing.


Comments

In reply to by [DELETED] 4915236

Since the Plugin manager relies on the .qml suffix to find plugins, I think the best solution is to move the non-plugins to a sub-directory (maybe call it addons?) and edit the plugins that used these so they will look in */addons for these files. I'm not familiar with the language, but there must be an easy way to look in a sub-directory for a file.

I see, this, a MuseScore object? That's all I see of meta-information in operative plugins.

MuseScore {
version: "3.0"
description: "This plugin adjusts the timing of an appoggiatura."
menuPath: "Plugins.Appoggiatura"

Yes, MuseScore plugins are those QML files where root object is MuseScore. In any QML files you still can use other QML components, including those you defined manually in other .qml files, this patch changes nothing in that regard. The change is that Plugin Manager won't anymore display QML files other than those that can be loaded by MuseScore as plugins (that is, they must define MuseScore as a root object and contain no syntax or other errors preventing QML engine from loading the file).

This was a problem with e.g. the QuarterTonePlayback plugin, which has 3 .qml files, but only one that is to be loaded into the Plugin Manager. Same for the TuningCents plugin, but see the initial report

> Does one use include, import, or require to import non-plugin root js files into plugins?

For QML files no imports are required, it is enough to put the files in the same directory and use the components defined there just by their names. Imports may be required for importing pure JavaScript (.js) files or if you decide to group .qml files into modules within separate directories (which shouldn't probably be necessary for most plugins).

The best reference on how to use this feature is probably Qt documentation itself:
https://doc.qt.io/qt-5/qtqml-documents-definetypes.html
https://doc.qt.io/qt-5/qtqml-javascript-resources.html

Great, just what I needed, thanks (although the management of shared code between different plugin versions is another ball of wax). By the way, all my new stuff, including use of the onRun fix, works perfectly in a Mac build from "master" a short while ago. I look forward to tonight's nightly.

you are aware that 'nightlies' are not really that anymore (and since quite long), but get created immediatly after a PR gets merged?
So the 'nightly' containing that change is available already...

That's also why they are called Development Builds nowadays.

Status closed active

No fixed as far as the plugin manager is concerned.
This my file b.qml:

import QtQuick 2.0
import MuseScore 3.0

Rectangle {
onDeleted: {
console.log("hello world")
Qt.quit()
}
}

It still gets listed in the plugin manager:
Screen Shot 2019-11-22 at 6.06.46 PM.png

Status active needs info
Frequency Few

Seems that bool collectPluginMetaInformation(PluginDescription* d) is OK with reading no (or empty) version and description?

No, if I create a qml file in one of the directories MuseScore checks for plugins, with the content of your example about, it does not get listed as an available plugin.
Not sure how you managed to get it there? Also using MuseScore 3.3.2?

Status needs info active

Just tried on another computer and could not reproduce.
I will try again monday. But I suspect that I was under 3.

Fix version
3.3.0