-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patharticulation_reset_positioning.lua
39 lines (35 loc) · 2.06 KB
/
articulation_reset_positioning.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function plugindef()
finaleplugin.Author = "Robert Patterson"
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
finaleplugin.Version = "1.1.1"
finaleplugin.Date = "September 22, 2024"
finaleplugin.CategoryTags = "Articulation"
finaleplugin.MinFinaleVersionRaw = 0x1a000000
finaleplugin.MinJWLuaVersion = 0.58
finaleplugin.RequireSelection = true
finaleplugin.Notes = [[
This script resets all selected articulations to their default positions. Due to complications arising from
how Finale stored articulation positions before Finale 26, it requires Finale 26 or higher. Due to issues around
maintaining the context for automatic stacking, it must be run under RGP Lua. JW Lua does not have the necessary
logic to manage the stacking context.
]]
return "Reset Articulation Positions", "Reset Articulation Positions", "Resets the position of all selected articulations."
end
local articulation = require("library.articulation")
-- Before Finale 26, the automatic positioning of articulations was calculated by Finale and stored as the default offset
-- values of the assignment. Starting with Finale 26, the automatic positioning of articulations is inherent in the
-- coded behavior of Finale. The assignment only contains offsets from the default position. Therefore, resetting
-- articulations positions in earlier versions would require reverse-engineering all the automatic positioning
-- options. But resetting articulations to default in Finale 26 and higher is a simple matter of zeroing out
-- the horizontal and/or vertical offsets. However, some additional logic is required to maintain stacking flags,
-- so this script should only be run under RGP Lua, never JW Lua.
function articulation_reset_positioning()
for note_entry in eachentry(finenv.Region()) do
local articulations = note_entry:CreateArticulations()
for artic_assign in each(articulations) do
articulation.reset_to_default(artic_assign)
artic_assign:Save()
end
end
end
articulation_reset_positioning()