Skip to content

Commit 6f6f589

Browse files
committed
Update colornotes_hook.qml
version 1.1. - if only single note selected, select whole score - doesnt require score to run
1 parent 91d1660 commit 6f6f589

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

colornotes_hook.qml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ import QtQuick.Window 2.2
1414

1515

1616
MuseScore {
17-
version: "1.0"
17+
version: "1.1"
1818
description: qsTr("This plugin colors notes in the selection depending on their pitch in Hooktheory Hookpad style")
1919
menuPath: "Plugins.Color Notes - Hooktheory"
2020

21+
requiresScore: false
22+
23+
2124
readonly property var colors : [ // "#rrggbb" with rr, gg, and bb being the hex values for red, green, and blue, respectively
2225
"#ff0000", // I.
2326
"#ffb014", // II.
@@ -40,14 +43,17 @@ MuseScore {
4043
// or, if nothing is selected, in the entire score
4144

4245
function applyToNotesInSelection(func, restore) {
43-
var fullScore = !curScore.selection.elements.length
46+
if (!curScore)
47+
return
48+
49+
var fullScore = !(curScore.selection.elements.length > 1)
4450
if (fullScore) {
45-
cmd("select-all")
46-
curScore.startCmd()
51+
cmd("select-all")
52+
curScore.startCmd()
4753
}
4854
for (var i in curScore.selection.elements)
4955
if (curScore.selection.elements[i].pitch)
50-
func(curScore.selection.elements[i], restore)
56+
func(curScore.selection.elements[i], restore)
5157
if (fullScore) {
5258
curScore.endCmd()
5359
cmd("escape")

0 commit comments

Comments
 (0)