MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

[MU4 Task] Redesign/implement/actualize Plugin API

Open cbjeukendrup opened this issue 3 years ago • 23 comments

Task description The Plugin API may need actualization to fit well into MU4, regarding both the new UI and the new technical architecture.

cbjeukendrup avatar Aug 15 '21 15:08 cbjeukendrup

@cbjeukendrup - can you flesh this out / assign it / target it, etc?

If it's no longer relevant, then close it instead.

Tantacrul avatar Apr 30 '22 18:04 Tantacrul

We will definitely have to do work on the plugins API. Especially functions like creating a new score will not work, because of the new architecture with multiple instances etc.

But, it is a question how much work we need to do. We will have to investigate which functionality is currently broken and to decide whether we will fix it, replace it, or remove it.

cbjeukendrup avatar Apr 30 '22 20:04 cbjeukendrup

OK, well I've assigned it to you / targeted it at Beta then.

Tantacrul avatar Apr 30 '22 21:04 Tantacrul

@Eism Assigning you too, since you've done some work on plugins before, so you might have an opinion about this.

cbjeukendrup avatar Apr 30 '22 21:04 cbjeukendrup

Hey, I have a few questions regarding plugin support in MU4 if you don't mind:

  • Are there plans to let plugins create GUIs in MU4 i.e. add UI elements to a panel?

I see that all of the example plugins in the repository don't create UIs, and the previous MU3 plugins that did were removed in this commit.

  • Could you let me know where to find the output of console.log() calls in MU4? I tried running mscore -d in the command line, and to find a window in the app with the output, to no avail.

  • Regarding the comment above that "creating new score will not work": are there plans to add that functionality back i.e. let plugins create new scores in MU4?

Thank you!

gregsadetsky avatar Jun 15 '22 18:06 gregsadetsky

Hi Greg, as with many things in MS4, we've encountered technical issues that we'd prefer to solve 'properly' in later releases of 4.x.

One of those is a more permissive and robust system for allowing people to create third party plugins. This is why we didn't port over the plugin creator from MS3 because it needs significant change in order to work. This is just a non-technical overview of our decision-making. We want people to be able to create more powerful plugins in future but won't get around to it until we've released a few (smaller) versions of 4.x.

Perhaps others here can be more technically useful to you!

Tantacrul avatar Jun 15 '22 18:06 Tantacrul

We plan to build a system to make plugin creation much more powerful in a later release. It is one of our highest priorities.

For the moment, only the plugins packaged with MuseScore 4.0 will work for users.

I'm moving this to 4.x and closing. We'll reopen once 4.0 is released. Thanks!

Tantacrul avatar Sep 01 '22 13:09 Tantacrul

Hi, You said >For the moment, only the plugins packaged with MuseScore 4.0 will work for users. Shouldn't we block all non-native plugins in the Plugin panel rather than give the impression that we could run them while in fact they don't work, or even crash MS4?

lgvr123 avatar Sep 11 '22 14:09 lgvr123

Hey @Tantacrul would it be possible to re-open this since MU4 came out? Thank you!

gregsadetsky avatar Dec 20 '22 18:12 gregsadetsky

How to take part to this ? I've listed over the last months some issues with the 3.6 API that could be addressed during this redesign phase:

Need/Issue Discussion Issue ref
Clef element details are not available Bossa Nova setting/plugin?
Sibling elements in other parts/excerpts are not exposed Get cursor to score from parts
Fret diagrams dots and bars are not available Retrieving Fret diagrams details
Getting the "parent" score for curScore when curScore is an excerpt of this "parent" score How to get a "full score" object when curScore is one of the score excerpts ?
Dots not exposed for rests Plugin: Accessing rest dots
Key signature details not available How to add a KeySignature ? #100501
Changing bar to a StartRepeat bar doesn't work correclty Changing a barline type via code
Impossible to access text frames How can I access other text on the page (besides lyrics)?, … #337263
Expose All Staff Properties Any way to retrieve staff characteristics? #311093
More methods for QProcess class #275294
Creation of folders within the FileIO objects #334952
Creation of folders with the PluginAPI.writeScore method #334953

(from the API improvments forum thread)

lgvr123 avatar Dec 21 '22 12:12 lgvr123

Without the Macro functionality we had in 3.x version, even the integration with Reaper is not any longer possible. This is blocking issue. We're in december 2022 now and I hope an update of Musescore to a 4.1 will be released soon containing this feature. Meanwhile I have to reinstall the 3.6 and get rid of the 4.0. It's pity, but that feature is more important than the great voicing (for my use).

tormyvancool avatar Dec 29 '22 13:12 tormyvancool

Without the Macro functionality we had in 3.x version, even the integration with Reaper is not any longer possible. This is blocking issue. We're in december 2022 now and I hope an update of Musescore to a 4.1 will be released soon containing this feature. Meanwhile I have to reinstall the 3.6 and get rid of the 4.0. It's pity, but that feature is more important than the great voicing (for my use).

well the "integration with reaper"* you are refering to was just a plugin to export midi, you can do that manually at musescore 4, so you still can use musescore 4 with MIDI Transfer.

as I am here, Thanks for remaking the plugins system!

  • = the "integration with reaper" shouldnt be discussed here, as is not the place, it is a REAPER script I made (MIDI Transfer), and I am sorry musescore devs this have leaked here.

daniellumertz avatar Dec 29 '22 18:12 daniellumertz

Without the Macro functionality we had in 3.x version, even the integration with Reaper is not any longer possible. This is blocking issue. We're in december 2022 now and I hope an update of Musescore to a 4.1 will be released soon containing this feature. Meanwhile I have to reinstall the 3.6 and get rid of the 4.0. It's pity, but that feature is more important than the great voicing (for my use).

well the "integration with reaper"* you are refering to was just a plugin to export midi, you can do that manually at musescore 4, so you still can use musescore 4 with MIDI Transfer.

as I am here, Thanks for remaking the plugins system!

  • = the "integration with reaper" shouldnt be discussed here, as is not the place, it is a REAPER script I made (MIDI Transfer), and I am sorry musescore devs this have leaked here.

The goal is to automate as much as possible the export rather than to perform a lot of "clicks". just one click and you get what you need. I stil prefer the 3.0 for that.

It's NOT a Reaper's script. It's a script was running on Musescore. And as user of both, I need this feature. Hence I'm here since it was removed from Musescore. Not an evolution but and involution, for the time being. I do hope the future will bring something more interesting about this feature.

tormyvancool avatar Dec 29 '22 21:12 tormyvancool

@tormyvancool In principle, plugins mostly still work in MS4, it's only not "supported" at the moment. So (if you haven't done so already), you could just try it out, by putting the plugin in the folder specified in Preferences > Folders > Plugins. You might find that it just works.

However, the future of plugins is bright: I've heard of plans to implement a completely new, way more powerful plugin system. We'll see...

cbjeukendrup avatar Dec 29 '22 21:12 cbjeukendrup

@tormyvancool In principle, plugins mostly still work in MS4, it's only not "supported" at the moment. So (if you haven't done so already), you could just try it out, by putting the plugin in the folder specified in Preferences > Folders > Plugins. You might find that it just works.

However, the future of plugins is bright: I've heard of plans to implement a completely new, way more powerful plugin system. We'll see...

To implement it I did use the macro and saved it. I will try to find everything and to try to move it for the time being. I can't wait for the new system of course <3

tormyvancool avatar Dec 29 '22 21:12 tormyvancool

@cbjeukendrup I'm far to share your optimism about the compatibility of the 3.6 plugins with MU4.0. I've tried to migrate most of my plugins to MU4.0 and few are working (see my guidelines). Actually, all the plugins using readScore, writeScore are not working, The ones that are "dock"-type plugins are not working either, or using some deep score manipulation methods, ...

lgvr123 avatar Dec 29 '22 22:12 lgvr123

Hm... you may be right. Manipulation within the current score should work mostly fine, but more advanced things like opening other files, or writing files, and indeed dock plugins, is broken at the moment. Anyway, as said, the plugin API was one of those things that were just too big to tackle with MS 4.0.0, but it will surely get the love it deserves at a later moment.

cbjeukendrup avatar Dec 30 '22 00:12 cbjeukendrup

Hm... you may be right. Manipulation within the current score should work mostly fine, but more advanced things like opening other files, or writing files, and indeed dock plugins, is broken at the moment. Anyway, as said, the plugin API was one of those things that were just too big to tackle with MS 4.0.0, but it will surely get the love it deserves at a later moment.

All what I need is, for the time being, to write this code in order to make it work under the 4.0 https://youtu.be/Bb4wldM0rmo?t=362 ... hoping that in the 4.1 there will be an easier way :-)

because however, creating a plugin following the examples of the other ones already present, it doesn't show up. nor into the indicated folder, nor in the one under Musescore main folder

I did create a folder called "export_midi"

Inside it 2 files: export_midi.qml midi_export.png

the code

` import QtQuick 2.2 import MuseScore 3.0

MuseScore { version: "2.0" title: "MIDI Exporter" description: "Export MIDI for REAPER" categoryCode: "composing-arranging-tools" thumbnailName: "midi_export.png"

  MessageDialog {
        id: versionError
        visible: false
        title: "Unsupported MuseScore Version"
        text: "This plugin needs MuseScore v3.0.5 or higher"
        onAccepted: { Qt.quit() }
  }

onRun{
	var s = curScore;
	var p = curScore path;
        p = p.slice(0, -5);
        p = p.replace(/\//gi,"\\");
        writeScore(s, p, 'mid');
		
        curScore.endCmd();

        quit();
}

} `

tormyvancool avatar Dec 30 '22 09:12 tormyvancool

All what I need is, for the time being, to write this code in order to make it work under the 4.0 https://youtu.be/Bb4wldM0rmo?t=362 ... hoping that in the 4.1 there will be an easier way :-)

Little chance that you can have it working with MU4.0 as writeScore is broken under MU4.0

lgvr123 avatar Dec 30 '22 11:12 lgvr123

All what I need is, for the time being, to write this code in order to make it work under the 4.0 https://youtu.be/Bb4wldM0rmo?t=362 ... hoping that in the 4.1 there will be an easier way :-)

Little chance that you can have it working with MU4.0 as writeScore is broken under MU4.0

Even by omitting that line (I tried it), the plugin doesn't pop-up

tormyvancool avatar Dec 30 '22 12:12 tormyvancool

@tormyvancool let's maybe open a separated question MuseScore plugin's forum for this.

lgvr123 avatar Dec 30 '22 12:12 lgvr123

All what I need is, for the time being, to write this code in order to make it work under the 4.0 https://youtu.be/Bb4wldM0rmo?t=362 ... hoping that in the 4.1 there will be an easier way :-)

Little chance that you can have it working with MU4.0 as writeScore is broken under MU4.0

Perfect I opened it :-) https://musescore.org/en/node/340725

tormyvancool avatar Dec 30 '22 12:12 tormyvancool

Hey guys..did you think of making support for python plugins? Something like blender has implemented. The nice thing about python is that it has an interpreter where you can test your code live and it has a lot of libraries (even AI) not to mention that it is very popular. Also C/C++ and python are very friendly because python is written in C. If this is out of scope or not possible at the moment would you consider making mscz/mscx as a documented standard so external manipulation would be done more easily? Thanks

schef avatar Jan 11 '23 08:01 schef

Hi @schef,

The plugin functionality is provided by the 3rd party framework Musescore is built on, called QT, which supports a version of JavaScript called qml for its plugins. It's unlikely that Python or other languages will be supported because they're not supported by QT.

I am not associated with the musescore project in any way, so don't take this as official word on the direction of the project by any means, but since no-one else has responded to you I think it's worth setting your expectations that this probably isn't going to happen, and why.

ephemer avatar Jan 19 '23 12:01 ephemer

Hi.. I am aware of the current QT/QML GUI architecture as I am a programmer myself (Python/C++). I'm following this project for some years now and i use it myself as I also have Master's Degree in Music. This is why I'm so interested in seeing this happen. :) I would also like to contribute if this is something the DEV team would consider going into.

On Thu, Jan 19, 2023 at 1:24 PM Geordie J @.***> wrote:

Hi @schef https://github.com/schef,

The plugin functionality is provided by the 3rd party framework Musescore is built on, called QT, which supports a version of JavaScript called qml for its plugins. It's unlikely that Python or other languages will be supported because they're not supported by QT.

I am not associated with the musescore project in any way, so don't take this as official word on the direction of the project by any means, but since no-one else has responded to you I think it's worth setting your expectations that this probably isn't going to happen, and why.

— Reply to this email directly, view it on GitHub https://github.com/musescore/MuseScore/issues/8859#issuecomment-1396899438, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF5KTTGMPAP4OJ2BWGJTYDWTEXBPANCNFSM5CGJIY4A . You are receiving this because you were mentioned.Message ID: @.***>

schef avatar Jan 19 '23 13:01 schef

Hey. Right now, the dev team are completely swamped. We do have a planning session coming very soon, where we'll discuss how we want to enable plugin creation but it won't be something we can immediately hop on. Apologies for this. Just a lot of work in front of us right now. We'll be opening up to the community about our internal plans once we get them all agreed on.

Tantacrul avatar Jan 19 '23 16:01 Tantacrul

Thanks for the feedback.

how we want to enable plugin creation

Plugin creation is a key feature of MuseScore. I hope your plans will not go to reduced plugin creation capabilities.

lgvr123 avatar Feb 13 '23 10:02 lgvr123

It has already been said that our plans will go to completely re-built but 100x more powerful plugin creation capabilities.

cbjeukendrup avatar Feb 13 '23 11:02 cbjeukendrup

Just a breadcrumb for eventually revisiting the Python/QT discussion...

https://doc.qt.io/qtforpython/

MNeill73 avatar Apr 06 '23 02:04 MNeill73

Yes, you can use Qt in Python. But what we need (beside that) is the opposite: running Python plugins in a C++ app. That requires building in a full Python interpreter, which is not realistic and annoying for most of users because it makes MuseScore use more disk space while most users won't ever use plugins.

cbjeukendrup avatar Apr 06 '23 06:04 cbjeukendrup