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.1 "
7
- finaleplugin .Date = " 2022-09-04 "
8
- finaleplugin .
AuthorEmail = " [email protected] "
9
- finaleplugin .AdditionalMenuOptions = [[
2
+ -- This function and the 'finaleplugin' namespace
3
+ -- are both reserved for the plug-in definition.
4
+ finaleplugin .Author = " Jacob Winkler"
5
+ finaleplugin .Copyright = " 2024 "
6
+ finaleplugin .Version = " 1.2& "
7
+ finaleplugin .Date = " 2024-02-06 "
8
+ finaleplugin .
AuthorEmail = " [email protected] "
9
+ finaleplugin .AdditionalMenuOptions = [[
10
10
Ties: Replace Dangling w/Slurs
11
11
]]
12
- finaleplugin .AdditionalUndoText = [[
12
+ finaleplugin .AdditionalUndoText = [[
13
13
Ties: Replace Dangling w/Slurs
14
14
]]
15
- finaleplugin .AdditionalDescriptions = [[
15
+ finaleplugin .AdditionalDescriptions = [[
16
16
Removes dangling ties and replaces them with slurs
17
17
]]
18
- finaleplugin .AdditionalPrefixes = [[
18
+ finaleplugin .AdditionalPrefixes = [[
19
19
replace_with_slur = true
20
20
]]
21
- finaleplugin .Notes = [[
21
+ finaleplugin .Notes = [[
22
22
TIES: REMOVE DANGLING
23
23
24
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
25
]]
26
- return " Ties: Remove Dangling" , " Ties: Remove Dangling" , " Removes dangling ties (ties that go nowhere)."
26
+ return " Ties: Remove Dangling" , " Ties: Remove Dangling" , " Removes dangling ties (ties that go nowhere)."
27
27
end
28
28
29
29
replace_with_slur = replace_with_slur or false
@@ -32,30 +32,46 @@ local tie = require("library.tie")
32
32
local smartshape = require (" library.smartshape" )
33
33
34
34
local music_region = finale .FCMusicRegion ()
35
- music_region :SetFullDocument ()
35
+ music_region :SetCurrentSelection ()
36
+
37
+ if music_region :IsEmpty () then
38
+ local str1 = finale .FCString ()
39
+ local str2 = finale .FCString ()
40
+ str1 .LuaString = " Process whole document?"
41
+ str2 .LuaString = " No Selection."
42
+ local ui = finenv .UI ()
43
+ local result = ui :AlertYesNo (str1 .LuaString , str2 .LuaString )
44
+ if result == 2 then
45
+ music_region :SetFullDocument ()
46
+ else
47
+ goto bypass
48
+ end
49
+ end
36
50
37
51
for working_staff = music_region :GetStartStaff (), music_region :GetEndStaff () do
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
52
+ for layer_num = 0 , 3 , 1 do
53
+ local note_entry_layer = finale .FCNoteEntryLayer (layer_num , working_staff , music_region .StartMeasure , music_region .EndMeasure )
54
+ note_entry_layer :Load ()
55
+ for index = 0 , note_entry_layer .Count - 1 , 1 do
56
+ local entry = note_entry_layer :GetRegionItemAt (index , music_region )
57
+ if entry and entry :IsTied () then
58
+ for note in each (entry ) do
59
+ local tie_must_exist = true
60
+ local tied_note = tie .calc_tied_to (note , tie_must_exist )
61
+ if not tied_note then
62
+ note .Tie = false
63
+ if replace_with_slur then
64
+ local next_entry = note_entry_layer :GetRegionItemAt (index + 1 , music_region )
65
+ if next_entry then
66
+ smartshape .add_entry_based_smartshape (entry , next_entry )
67
+ end
57
68
end
69
+ end
58
70
end
59
- note_entry_layer : Save ()
71
+ end
60
72
end
61
- end
73
+ note_entry_layer :Save ()
74
+ end
75
+ end
76
+
77
+ :: bypass::
0 commit comments