Can this be done in a plugin?
Here's a topic I started about colouring notes. I thought maybe someone can give me a quick answer whether this is possible or not in the old and/or in the new plugin framework.
What I want to do is select a bunch of noteheads in a score (click at first notehead, then ctrl+click at the rest), then run the plugin, which will colour the first note bright red (#ff0000), the next selected notehead a bit darker, next one yet a bit darker until the final one would be almost black (#080000 something).
For this the plugin needs to know the number of noteheads marked. And it needs the access to change the colour of the notehead.
Comments
This should be possible in the old and the new plugin Framework
For an example that needs to count the notes before (calculating how to) changing them, see the Crescendo or Diminuendo Note Velocities plugin , for example how to changes note colors, see the color notes plugin that comes with 1.x and the one that Comes with the nighly builds.
In reply to This should be possible in by Jojo-Schmitz
It may be better in the new / upcoming framework, but in the current one, it wouldn't be able to work exactly as described, because the notion of "selection" in the plugin framework is limited to contiguous regions - eg, that which would display with a blue rectangle. Discontiguous selections made via Ctrl+Click are not accessible.
In reply to It may be better in the new / by Marc Sabatella
Ah, yes, I missread the ctrl-cklick for a shift-click.
And I don't hink the new framwork is different in this respect.
In reply to Ah, yes, I missread the by Jojo-Schmitz
Then I must say I'm surprised how bad the frameworks work. I mean, I can ctrl+click a bunch of notes and run the MuseScore built-in functions to operate on them. Like colouring them. But the plugin framework doesn't reach the same selections as the built-in functions.
Do you mean to tell that the plugins can't see any other selections than those that are marked with a rectangle?
In reply to Not very good frameworks by jotti
Correct. The framework documentation is quite explicit about this. See http://musescore.org/en/plugin-development/cursor-object, the description of goToSelectionStart() / goToSelectionEnd(). The score access functionality is sequential only, so there's really no way the framework would be able to access discontiguous selections without some re-architecting.
And yes, this is indeed quite limiting.
Seems a good idea to think loud on this forum, before start banging head against a brick wall.
Since my idea is to colour different voices in fugues, I would depend on that each voice be written in its own voice in MuseScore. Here's one section from one DWC fugue.
I've clicked on first note of the theme, then shift+clicked on the last note to get the selection (blue note heads, voice 1). At the same time I got notes of another voice selected (green note heads, voice 2).
Now I want to run my plugin, which would only colour the blue notes. Will the plugin framework let me find the voice 1 notes, count them and colour them? Will the cross stave thing cause problems? Seems if I do a treble stave selection, all cross stave notes in bass stave will be selected.
In reply to I won't abandon this yet by jotti
I would say yes: both the old and the new plugin frameworks allow you to parse the selection shown in the image and separate the different voices.
Cross-staff should not be a problem, as it is mostly a visual thing: for instance, the B in the first (shown) measure DOES belong to voice 1 of bass staff, even if it is shown in the treble staff, as it becoming selected when you selected the bass staff demonstrates.
As for the plugin framework's inability to deal with Ctrl-click selections: yes, it is a limitation. The plugin framework still has significant limitations; it is mostly a matter of priorities: making the main programme stable and reliable is currently the top priority of the dev team.
Thanks,
M.
In reply to I would say yes: both the old by Miwarre
This is actually already done in this plugin http://musescore.org/en/project/colorvoices
In reply to This is actually already done by [DELETED] 5
And in the old and the new plugin framework...