New to plugin development
I am looking for any advice or tips concerning writing plugins for Musescore. I've been using Musescore for a couple of years and am enthusiastic about the software. I have a couple of ideas for plugins that don't yet seem to have been developed. I've been a musician my entire life and I've been writing software my entire career (almost 30 years) but don't know anything about Javascript. I'm starting right in on reading everything in the Introduction section on plugin development and intend on following the Resource links listed there, but I was hoping maybe to get some direction about some simple coding exercises I could do before trying to develop a plugin. Would coding some things for the browser in JS be a good idea before jumping into plugins? Just not sure where to start. Any pointers will be appreciated.
Thanks
Comments
Best way to start would probably be to explain your plugin ideas. The plugin framework in MuseScore 1.3 is quite limited and a lot of things can't be done from a plugin. You don't really need to have a deep understanding of Javascript to create a plugin. Just take a look to the existing ones and you will get an idea of the complexity.
In reply to Best way to start would by [DELETED] 5
I've modified and renamed the plugin break to have a checkbox that indicates whether or not you wish to skip the first measure. The purpose is to not consider a Pick Up measure when doing the breaks every x measures. I have this working. What I haven't been able to discern is how to know if that first measure really is a Pick Up measure. It will work as is but it could be better if it checked for a PickUp measure. Also I just downloaded qtcreator. Is this where I should be designing my UI instead of poking XML code into the UI file?
Also, I looked at some of the objects. I couldn't find anyway to query a measure about its contents. Will I have to count the ticks in each measure somehow to determine if it has less ticks than the other measures? It looked as though the only time signature I could retrieve was at the score level. Is this correct?
Thanks, bones12
In reply to modifying plugin break by bones12
I don't know if it is possible to figure out if the first bar is a pickup or not, and I'm also not very good with the UI stuff - anything I ever did with UI I copied shamelessly from other plugins, figured out how to modify, then promptly forgot anything I learned. What I do know is that this is all stuff likely to change for 2.0, so I am not sure you really want to put that much effort into solving this. Especially since the break plugin is *already* perfectly capable of skipping a pickup measure - just make sure to select everything starting at the second measure before running the plugin! The plugin runs on a selection, and only defaults to the whole score if nothing is selected.
Actually, though, it probably *is* possible to figure out if the first bar is a pickup. Just start advancing the cursor from the beginning, checking every note to see if the measure number has changed (see Cursor object). If the measure number changes, then check the tick to see if it changed at the "right" number of beats for the time signature or not. So by all means, feel free to give that a shot, as a learning exercise if nothing else.
In reply to modifying plugin break by bones12
The "Break every X measures" plugin should work on a selection, so you can select the all the measures but the first one to ignore it.
That's being said, if it was just an exercice, Qt Creator is indeed the tool to modify UI files.
In reply to The "Break every X measures" by [DELETED] 5
Well, Duh!! Ok, so I modified this plugin unnecessarily, but i did learn a couple of things along the way. Thanks for responding in such a helpful manner.
For my first plugin I would like to modify an existing one to add a little functionality. The plugin I want to modify is break. When I'm using it I find it very handy but most times when I have a Pick Up measure I would like it to ignore the pickup measure for consideration and start at the second measure and break at every x measure thereafter. That way I can keep phrases together more easily.
I copied the break plugin and renamed it. I changed the JS code such that it will skip the first measure and continure starting with the second measure and break properly for the rest of the score. What I'm not getting right is the UI. I want to add a check box to indicate you would like to skip the pickup measure. I tried adding the checkbox code to the UI file. This I basically lifted out of the batch_export plugin.
I placed the following code in the JS file, inside the run function.
form.checkBox_withPU.enabled = true;
form.checkBox_withPU.checked = false;
I was getting an error at the time I invoked the new plugin. I have since got rid of the message by wrapping the pair, item /item around the checkbox code. That was a guess that worked. How am I supposed to go about designing the UI properly?
Also right now I'm just skipping the first measure but it would be nice if the first measure's status as a Pick Up measure could be retrieved. I haven't looked into that yet as I am stuck on the UI.
Thanks, bones12
In reply to new to plugin development by bones12
I'm not sure it is worthwile learning the GUI stuff, as it will go away in 2.0.