Skip to content

Commit 53d3cc1

Browse files
chore: autopublish 2024-07-20T14:01:30Z
1 parent 76ca1df commit 53d3cc1

File tree

2 files changed

+115
-83
lines changed

2 files changed

+115
-83
lines changed

dist/cue_notes_overlay.lua

Lines changed: 114 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5607,8 +5607,8 @@ function plugindef()
56075607
finaleplugin.Author = "Carl Vine"
56085608
finaleplugin.AuthorURL = "https://carlvine.com/lua/"
56095609
finaleplugin.Copyright = "https://creativecommons.org/licenses/by/4.0/"
5610-
finaleplugin.Version = "0.28"
5611-
finaleplugin.Date = "2024/02/07"
5610+
finaleplugin.Version = "0.32"
5611+
finaleplugin.Date = "2024/07/12"
56125612
finaleplugin.MinJWLuaVersion = 0.70
56135613
finaleplugin.Notes = [[
56145614
This script takes music from a nominated layer in the selected staff
@@ -5618,46 +5618,45 @@ function plugindef()
56185618
If the destination measure is empty a whole-measure rest
56195619
will be created as a reminder that the cue isn't played.
56205620
5621-
Cue notes are often shown in a different octave to accommodate
5622-
the clef and transposition of the destination.
5623-
Use _Cue Octave Offset_ setting for this.
5621+
Use __Cue Octave Offset__ to change the register of a cue to
5622+
suit the clef and transposition of the destination.
56245623
Cues can interact visually with "played" material in countless ways
56255624
so settings probably need to change between scenarios.
56265625
56275626
The cue copy is reduced in size and muted, and can optionally duplicate
56285627
articulations, expressions, lyrics and smart shapes.
5629-
"Note-based" smart shapes are copied, typically slurs and glissandos,
5628+
__Note-based__ smart shapes are copied, typically slurs and glissandos,
56305629
because they actually "attach" to the cued notes.
56315630
5632-
This script stores cue names in a text expression category called _Cue Names_
5633-
which will be created automatically if needed.
5631+
This script stores cue names in a text expression category called
5632+
__Cue Names__ which will be created automatically if needed.
56345633
Once created you can adjust its text and position parameters
56355634
like any other expression category.
56365635
56375636
Rests in the cue will be offset by the value you have set
5638-
for layer 1 at _Document_ _Document Options_ _Layers_.
5639-
They will automatically offset in the same direction as
5637+
for layer 1 at _Document_ → _Document Options_ → _Layers_.
5638+
They will automatically be offset in the same direction as
56405639
the nominated cue stem direction.
56415640
56425641
> __Command Keys__
5643-
> In the _Destination Staff_ window, hit the tab key to move the cursor
5644-
> into a numeric field and these key commands become available:
5645-
5646-
> - __q__ - show these script notes
5647-
> - __w__ - flip [copy articulations]
5648-
> - __e__ - flip [copy expressions]
5649-
> - __r__ - flip [copy smartshapes]
5650-
> - __t__ - flip [copy lyrics]
5651-
> - __y__ - flip [mute cuenotes]
5652-
> - __a__ - check all options
5653-
> - __s__ - check no options
5654-
> - __d__ - select all staves
5655-
> - __f__ - select no staves
5656-
> - __g__ - select empty staves
5657-
> - __z (-)__ - octave -1
5658-
> - __x (+)__ - octave +1
5659-
> - __c__ - flip stem direction
5660-
> - __v__ - flip [destination stems opposite]
5642+
> In the __Destination Staff__ window, highlight one of the
5643+
> numeric fields and these key commands become available:
5644+
5645+
> - __q__: show script info
5646+
> - __w__: toggle [copy articulations]
5647+
> - __e__: toggle [copy expressions]
5648+
> - __r__: toggle [copy smartshapes]
5649+
> - __t__: toggle [copy lyrics]
5650+
> - __y__: toggle [mute cuenotes]
5651+
> - __a__: check all options
5652+
> - __s__: check no options
5653+
> - __d__: select all staves
5654+
> - __f__: select no staves
5655+
> - __g__: select empty staves
5656+
> - __z (-)__: octave -1
5657+
> - __x (+)__: octave +1
5658+
> - __c__: toggle stem direction
5659+
> - __v__: toggle [destination stems opposite]
56615660
]]
56625661
finaleplugin.RTFNotes = [[
56635662
{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 \fmodern Courier New;}}
@@ -5666,30 +5665,32 @@ function plugindef()
56665665
\fs18
56675666
{\info{\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
56685667
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 This script takes music from a nominated layer in the selected staff and creates a {\b Cue} version on one or more other staves. It is intended to create cue notes above or below existing \u8220"played\u8221" material in the destination. If the destination measure is empty a whole-measure rest will be created as a reminder that the cue isn\u8217't played.\par}
5669-
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 Cue notes are often shown in a different octave to accommodate the clef and transposition of the destination. Use {\i Cue Octave Offset} setting for this. Cues can interact visually with \u8220"played\u8221" material in countless ways so settings probably need to change between scenarios.\par}
5670-
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 The cue copy is reduced in size and muted, and can optionally duplicate articulations, expressions, lyrics and smart shapes. \u8220"Note-based\u8221" smart shapes are copied, typically slurs and glissandos, because they actually \u8220"attach\u8221" to the cued notes.\par}
5671-
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 This script stores cue names in a text expression category called {\i Cue Names} which will be created automatically if needed. Once created you can adjust its text and position parameters like any other expression category.\par}
5672-
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 Rests in the cue will be offset by the value you have set for layer 1 at {\i Document} \u8594? {\i Document Options} \u8594? {\i Layers}. They will automatically offset in the same direction as the nominated cue stem direction.\par}
5673-
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li720 \fi0 {\b Command Keys}\line In the {\i Destination Staff} window, hit the tab key to move the cursor\line into a numeric field and these key commands become available:\par}
5674-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b q} - show these script notes\par}
5675-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b w} - flip [copy articulations]\par}
5676-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b e} - flip [copy expressions]\par}
5677-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b r} - flip [copy smartshapes]\par}
5678-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b t} - flip [copy lyrics]\par}
5679-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b y} - flip [mute cuenotes]\line \par}
5680-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b a} - check all options\par}
5681-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b s} - check no options\par}
5682-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b d} - select all staves\par}
5683-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b f} - select no staves\par}
5684-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b g} - select empty staves\line \par}
5685-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b z (-)} - octave -1\par}
5686-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b x (+)} - octave +1\par}
5687-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b c} - flip stem direction\par}
5688-
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b v} - flip [destination stems opposite]\sa180\par}
5668+
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 Use {\b Cue Octave Offset} to change the register of a cue to suit the clef and transposition of the destination. Cues can interact visually with \u8220"played\u8221" material in countless ways so settings probably need to change between scenarios.\par}
5669+
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 The cue copy is reduced in size and muted, and can optionally duplicate articulations, expressions, lyrics and smart shapes. {\b Note-based} smart shapes are copied, typically slurs and glissandos, because they actually \u8220"attach\u8221" to the cued notes.\par}
5670+
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 This script stores cue names in a text expression category called {\b Cue Names} which will be created automatically if needed. Once created you can adjust its text and position parameters like any other expression category.\par}
5671+
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li0 \fi0 Rests in the cue will be offset by the value you have set for layer 1 at {\i Document} \u8594? {\i Document Options} \u8594? {\i Layers}. They will automatically be offset in the same direction as the nominated cue stem direction.\par}
5672+
{\pard \sl264 \slmult1 \ql \f0 \sa180 \li720 \fi0 {\b Command Keys}\line In the {\b Destination Staff} window, highlight one of the numeric fields and these key commands become available:\par}
5673+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b q}: show script info\par}
5674+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b w}: toggle [copy articulations]\par}
5675+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b e}: toggle [copy expressions]\par}
5676+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b r}: toggle [copy smartshapes]\par}
5677+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b t}: toggle [copy lyrics]\par}
5678+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b y}: toggle [mute cuenotes]\line \par}
5679+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b a}: check all options\par}
5680+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b s}: check no options\par}
5681+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b d}: select all staves\par}
5682+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b f}: select no staves\par}
5683+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b g}: select empty staves\line \par}
5684+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b z (-)}: octave -1\par}
5685+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b x (+)}: octave +1\par}
5686+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b c}: toggle stem direction\par}
5687+
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b v}: toggle [destination stems opposite]\sa180\par}
56895688
}
56905689
]]
56915690
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/cue_notes_overlay.hash"
5692-
return "Cue Notes Overlay...", "Cue Notes Overlay", "Copy as cue notes to another staff"
5691+
return "Cue Notes Overlay...",
5692+
"Cue Notes Overlay",
5693+
"Copy as cue notes to another staff"
56935694
end
56945695
local config = {
56955696
copy_articulations = false,
@@ -5707,14 +5708,36 @@ local config = {
57075708
cuename_item = 0,
57085709
overwrite_layer = 4,
57095710

5710-
shift_expression_down = -24 * 9,
5711-
shift_expression_left = -24,
5711+
shift_exp_up = 24,
5712+
shift_exp_down = -24 * 9,
5713+
shift_exp_left = -24,
57125714

57135715
cue_category_name = "Cue Names",
57145716
cue_font_smaller = 1,
57155717
window_pos_x = false,
57165718
window_pos_y = false,
57175719
}
5720+
local hotkey = {
5721+
show_info = "q",
5722+
copy_articulations = "w",
5723+
copy_expressions = "e",
5724+
copy_smartshapes = "r",
5725+
copy_lyrics = "t",
5726+
mute_cuenotes = "y",
5727+
5728+
set_all = "a",
5729+
clear_all = "s",
5730+
all_staves = "d",
5731+
no_staves = "f",
5732+
empty_staves = "g",
5733+
5734+
octave_dn1 = "z",
5735+
octave_dn2 = "-",
5736+
octave_up1 = "x",
5737+
octave_up2 = "+",
5738+
stem_direction = "c",
5739+
stems_oppose = "v",
5740+
}
57185741
local options = {
57195742
check = { "copy_articulations", "copy_expressions", "copy_smartshapes", "copy_lyrics", "mute_cuenotes" },
57205743
integer = { "cuenote_percent", "source_layer", "cuenote_layer" },
@@ -5774,11 +5797,10 @@ end
57745797
local function get_staff_name(staff_num)
57755798
local staff = finale.FCStaff()
57765799
staff:Load(staff_num)
5777-
local str = staff:CreateDisplayFullNameString()
5778-
local name = { full = str.LuaString }
5779-
str = staff:CreateDisplayAbbreviatedNameString()
5780-
name.abbrev = str.LuaString
5781-
return name
5800+
return {
5801+
full = staff:CreateDisplayFullNameString().LuaString,
5802+
abbrev = staff:CreateDisplayAbbreviatedNameString().LuaString
5803+
}
57825804
end
57835805
local function new_cue_name(source_staff)
57845806
local name = get_staff_name(source_staff)
@@ -5810,7 +5832,7 @@ local function choose_name_index(name_list, source_staff)
58105832
dialog:CreateStatic(0, 17):SetText("Select cue name:"):SetWidth(100)
58115833
make_info_button(dialog, 180, 17)
58125834
local staff_list = dialog:CreateListBox(0, 40):SetWidth(200)
5813-
:AddString("*** new name ***")
5835+
:AddString("*** new cue name ***")
58145836
for i, v in ipairs(name_list) do
58155837
staff_list:AddString(v[1])
58165838
if v[2] == config.cuename_item then staff_list:SetSelectedItem(i) end
@@ -5845,11 +5867,11 @@ local function create_new_expression(exp_name, category_number)
58455867
config.cuename_item = ted:GetItemNo()
58465868
end
58475869
local function choose_destination_staff(source_staff)
5848-
local source_name
58495870
local rgn = finale.FCMusicRegion()
58505871
rgn:SetCurrentSelection()
58515872
rgn:SetFullMeasureStack()
58525873

5874+
local source_name
58535875
local staff_list = {}
58545876
for staff_number in eachstaff(rgn) do
58555877
local name = get_staff_name(staff_number)
@@ -5925,21 +5947,21 @@ local function choose_destination_staff(source_staff)
59255947
or s:find("[^0-9]")
59265948
)
59275949
) then
5928-
if s:find("[q?]") then info_dialog()
5929-
elseif s:find("w") then flip_check("copy_articulations")
5930-
elseif s:find("e") then flip_check("copy_expressions")
5931-
elseif s:find("r") then flip_check("copy_smartshapes")
5932-
elseif s:find("t") then flip_check("copy_lyrics")
5933-
elseif s:find("y") then flip_check("mute_cuenotes")
5934-
elseif s:find("a") then set_check_state(1)
5935-
elseif s:find("s") then set_check_state(0)
5936-
elseif s:find("d") then set_list_state(1)
5937-
elseif s:find("f") then set_list_state(0)
5938-
elseif s:find("g") then set_list_state(-1)
5939-
elseif s:find("[-z_]") then octave_change(1)
5940-
elseif s:find("[+x=]") then octave_change(-1)
5941-
elseif s:find("c") then flip_direction()
5942-
elseif s:find("v") then flip_check("stems_oppose")
5950+
if s:find(hotkey.show_info) then info_dialog()
5951+
elseif s:find(hotkey.mute_cuenotes) then flip_check("mute_cuenotes")
5952+
elseif s:find(hotkey.set_all) then set_check_state(1)
5953+
elseif s:find(hotkey.clear_all) then set_check_state(0)
5954+
elseif s:find(hotkey.all_staves) then set_list_state(1)
5955+
elseif s:find(hotkey.no_staves) then set_list_state(0)
5956+
elseif s:find(hotkey.empty_staves) then set_list_state(-1)
5957+
elseif s:find(hotkey.octave_dn1) or s:find(hotkey.octave_dn2) then octave_change(1)
5958+
elseif s:find(hotkey.octave_up1) or s:find(hotkey.octave_up2) then octave_change(-1)
5959+
elseif s:find(hotkey.stem_direction) then flip_direction()
5960+
elseif s:find(hotkey.stems_oppose) then flip_check("stems_oppose")
5961+
else
5962+
for _, v in ipairs(options.check) do
5963+
if s:find(hotkey[v]) then flip_check(v) break end
5964+
end
59435965
end
59445966
ctl:SetText(saved[name]):SetKeyboardFocus()
59455967
elseif s ~= "" then
@@ -6040,12 +6062,11 @@ local function choose_overwrite_layer(staff_name, empty_layers)
60406062
dialog:CreateStatic(0, 55):SetText("Please confirm:"):SetWidth(100)
60416063
local list = dialog:CreateListBox(0, 75):SetWidth(wide):SetHeight(70)
60426064
for i = 1, layer.max_layers() do
6043-
local si = tostring(i)
60446065
if i == config.cuenote_layer then
6045-
list:AddString("overwrite CUENOTE layer " .. si)
6066+
list:AddString("overwrite CUENOTE layer " .. i)
60466067
else
60476068
msg = empty_layers[i] and "use empty layer " or "overwrite layer "
6048-
list:AddString(msg .. si)
6069+
list:AddString(msg .. i)
60496070
end
60506071
if i == config.overwrite_layer then list:SetSelectedItem(i - 1) end
60516072
end
@@ -6228,6 +6249,17 @@ local function new_expression_category(new_name)
62286249
local ok = new_category:SaveNewWithType(finale.DEFAULTCATID_TECHNIQUETEXT)
62296250
return ok, (ok and new_category:GetID() or 0)
62306251
end
6252+
local function find_first_non_rest(staff, measure)
6253+
local nel = finale.FCNoteEntryLayer(config.source_layer - 1, staff, measure, measure)
6254+
nel:Load()
6255+
for i = 0, (nel.Count - 1) do
6256+
local e = nel:GetItemAt(i)
6257+
if e ~= nil and e:IsNote() then
6258+
return e.MeasurePos
6259+
end
6260+
end
6261+
return 0
6262+
end
62316263
local function create_cue_notes()
62326264
configuration.get_user_settings(script_name, config, true)
62336265
local cue_names = { }
@@ -6285,22 +6317,22 @@ local function create_cue_notes()
62856317
return
62866318
end
62876319

6320+
local vert_shift = (config.stem_direction == 1) and config.shift_exp_down or config.shift_exp_up
6321+
local measure_pos = find_first_non_rest(start_staff, source_region.StartMeasure)
62886322
for _, one_staff in ipairs(destination_staves) do
62896323
if notelayer_copy(source_region, one_staff) then
62906324
local cue_name = mixin.FCMExpression()
62916325
cue_name:SetStaff(one_staff)
62926326
:SetVisible(true)
6293-
:SetMeasurePos(0)
6327+
:SetMeasurePos(measure_pos)
6328+
:SetLayerAssignment(config.cuenote_layer)
62946329
:SetScaleWithEntry(false)
62956330
:SetPartAssignment(true)
62966331
:SetScoreAssignment(true)
62976332
:SetID(config.cuename_item)
6298-
:SetHorizontalPos(config.shift_expression_left)
6333+
:SetHorizontalPos(config.shift_exp_left)
6334+
:SetVerticalPos(vert_shift)
62996335
:SaveNewToCell(finale.FCCell(source_region.StartMeasure, one_staff))
6300-
if config.stem_direction == 1 then
6301-
cue_name.VerticalPos = config.shift_expression_down
6302-
cue_name:Save()
6303-
end
63046336
end
63056337
end
63066338
refocus()

hash/cue_notes_overlay.hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
df27b5ef20a923d0b1d90b651b8267784e154065a92958be8f0303e65814399c5ac399641c38b9433da7a254daf9e1e1bcbac6587caa19e370d669204c8825cc cue_notes_overlay.lua
1+
5370f67bb22e8292851e687fe13ced4644826c2be9fdb73d3c06c1689a2548c69c6ec1d9b5ace7c5f94120521337caeaa8d6e0e65cd2aa8fdf3cdeed44a0681a cue_notes_overlay.lua

0 commit comments

Comments
 (0)