1
1
function plugindef ()
2
- -- This function and the 'finaleplugin' namespace
3
- -- are both reserved for the plug-in definition.
4
- finaleplugin .Author = " Jacob Winkler"
5
- finaleplugin .Copyright = " 2022"
6
- finaleplugin .Version = " 1.0.1"
7
- finaleplugin .Date = " 2022-08-26"
8
- finaleplugin .RequireSelection = true
9
- finaleplugin .
AuthorEmail = " [email protected] "
10
- return " Ties: Remove Dangling" , " Ties: Remove Dangling" , " Removes dangling ties (ties that go nowhere)."
2
+ -- This function and the 'finaleplugin' namespace
3
+ -- are both reserved for the plug-in definition.
4
+ finaleplugin .Author = " Jacob Winkler"
5
+ finaleplugin .Copyright = " 2022"
6
+ finaleplugin .Version = " 1.1"
7
+ finaleplugin .Date = " 2022-09-04"
8
+ finaleplugin .
AuthorEmail = " [email protected] "
9
+ finaleplugin .AdditionalMenuOptions = [[
10
+ Ties: Replace Dangling w/Slurs
11
+ ]]
12
+ finaleplugin .AdditionalUndoText = [[
13
+ Ties: Replace Dangling w/Slurs
14
+ ]]
15
+ finaleplugin .AdditionalDescriptions = [[
16
+ Removes dangling ties and replaces them with slurs
17
+ ]]
18
+ finaleplugin .AdditionalPrefixes = [[
19
+ replace_with_slur = true
20
+ ]]
21
+ finaleplugin .Notes = [[
22
+ TIES: REMOVE DANGLING
23
+
24
+ This script will search for 'dangling ties' - ties that go to rests rather than other notes - and either remove them or replace them with slurs.
25
+ ]]
26
+ return " Ties: Remove Dangling" , " Ties: Remove Dangling" , " Removes dangling ties (ties that go nowhere)."
11
27
end
12
28
13
- local tie = require (" library.tie" )
29
+ replace_with_slur = replace_with_slur or false
30
+
31
+ local tie = require (" tie" )
32
+ local smartshape = require (" smartshape" )
14
33
15
34
local music_region = finale .FCMusicRegion ()
16
- music_region :SetCurrentSelection ()
35
+ music_region :SetFullDocument ()
17
36
18
37
for working_staff = music_region :GetStartStaff (), music_region :GetEndStaff () do
19
- for layer_num = 0 , 3 , 1 do
20
- local note_entry_layer = finale .FCNoteEntryLayer (layer_num , working_staff , music_region .StartMeasure , music_region .EndMeasure )
21
- note_entry_layer :Load ()
22
- for index = 0 , note_entry_layer .Count - 1 , 1 do
23
- local entry = note_entry_layer :GetRegionItemAt (index , music_region )
24
- if entry and entry :IsTied () then
25
- for note in each (entry ) do
26
- local tie_must_exist = true
27
- local tied_note = tie .calc_tied_to (note , tie_must_exist )
28
- if not tied_note then
29
- note .Tie = false
30
- end
31
- end
32
- end
38
+ for layer_num = 0 , 3 , 1 do
39
+ local note_entry_layer = finale .FCNoteEntryLayer (layer_num , working_staff , music_region .StartMeasure , music_region .EndMeasure )
40
+ note_entry_layer :Load ()
41
+ for index = 0 , note_entry_layer .Count - 1 , 1 do
42
+ local entry = note_entry_layer :GetRegionItemAt (index , music_region )
43
+ if entry and entry :IsTied () then
44
+ for note in each (entry ) do
45
+ local tie_must_exist = true
46
+ local tied_note = tie .calc_tied_to (note , tie_must_exist )
47
+ if not tied_note then
48
+ note .Tie = false
49
+ if replace_with_slur then
50
+ local next_entry = note_entry_layer :GetRegionItemAt (index + 1 , music_region )
51
+ if next_entry then
52
+ smartshape .add_entry_based_smartshape (entry , next_entry )
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ note_entry_layer :Save ()
33
60
end
34
- note_entry_layer :Save ()
35
- end
36
61
end
0 commit comments