draft of implode / explode plugins

• Jul 1, 2011 - 16:47

These are kind of limited - perhaps too much so to be worth including in the distribution - but not entirely useless. If anyone sees ways of making them better before I submit them to the Plugin area on the site, have a ball!

Explode:
Manually copy/paste a series of chords containing "n" notes onto "n" adjacent staves, select them, then run plugin. Each staff will then contain just a single line from the chords, assigned top down. [Need to first manually copy/paste the series because plugin architecture only supports creating new chords in very simple cases, but adding/subtracting notes from existing chords is no problem.]

Implode:
Select a region in two or more staves, then run plugin. Notes from subsequent selected staves will be collected onto chords in top selected staff. Only works to the extent rhythms are identical. [Doesn't preserve ties, as "tied" property is read only.]

Attachment Size
plode.zip 2.36 KB

Comments

Just tried them and they work as advertised ! Very god job !

A possible improvement :

  • Check if the selection is ok, and if not warn the user. Something like QMessageBox.warning(0, title, text) shoud do it

In reply to by [DELETED] 5

Thanks! What specifically do you think I should be checking for? I guess for one thing, that there are at least two staves selected, or the operation would be meaningless. For implode, I could also warn if the staves don't match rhythmically. Right now, I just ignore any notes in the source staff that don't match the destination. For explode, it would be harder for me to even notice if anything was amiss in terms of the staves not matching, since they are processed one staff at a time in full. I'm guessing that somewhere, there's a situation where one might take advantage of this and deliberately not have the staves match exactly.

In reply to by [DELETED] 5

Checking that the selection was across at least two staves was as easy as it seemed it would be.

But this got me thinking about my slash notation styles plugin, and I decided to do some error checking there too. All I wanted was to be sure the selection exists. But I don't know if I'm doing something wrong, but I couldn't get this to work. All the selection-related properties and methods act as if something is selected even when something isn't, unless you've just opened the score and have never selected anything. But if you select a measure and then click outside it, thus unselecting the measure again, I can't see a way to tell the difference. After a goToSelectionStart() or goToSelectionEnd(), the staff property is set to what it would have been if the passage were still selected, and eos() returns false just as it does with something selected. So I can't find a way to detect the "nothing selected" condition.

Meaning, it turns out with nothing selected, the slash plugin actually acts on whatever *used* to be selected. Glad to have caught this, but wondering how to fix it.

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