Skip to content

Update staff_explode.lua #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/staff_explode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ function plugindef()
finaleplugin.Author = "Carl Vine"
finaleplugin.AuthorURL = "http://carlvine.com"
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
finaleplugin.Version = "v1.45"
finaleplugin.Date = "2022/05/16"
finaleplugin.Version = "v1.47"
finaleplugin.Date = "2022/07/11"
finaleplugin.Notes = [[
This script explodes a set of chords from layer one on one staff onto single lines on subsequent staves.
This script explodes a set of chords on one staff into single lines on subsequent staves.
The number of staves is determined by the largest number of notes in any chord.
It warns if pre-existing music in the destination will be erased.
It duplicates all markings from the original and resets the current clef on each destination staff.

This script allows for the following configuration:
This script doesn't respace the selected music after it completes.
If you want automatic respacing you must create a `configuration` file.
If it does not exist, create a subfolder called `script_settings` in the folder containing this script.
In that folder create a plain text file called `staff_explode.config.txt` containing the line:

```
fix_note_spacing = true -- to respace music automatically when the script finishes
fix_note_spacing = true -- respace music when the script finishes
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add back the comment here:

fix_note_spacing = false -- to skip respacing music when the script finishes

Also, add a blank line between the last line of text and the three tick marks. Sometimes the documentation generator gets confused if there isn't a blank line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lack of a blank line isn't causing an issue here. However, it's generally good practice to prevent ambiguous markdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A neater and more useful variation - no user settings or config files. Just a simple second menu option. If this is approved I'll duplicate the process with my other 3 EXPLODE scripts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank line is in the wrong place. It should be before the first triple tick and not the second.

]]
return "Staff Explode", "Staff Explode", "Staff Explode onto consecutive single staves"
Expand All @@ -23,8 +26,7 @@ end
local configuration = require("library.configuration")
local clef = require("library.clef")

local config = {fix_note_spacing = true}

local config = { fix_note_spacing = false }
configuration.get_parameters("staff_explode.config.txt", config)

function show_error(error_code)
Expand Down Expand Up @@ -144,16 +146,14 @@ function staff_explode()
finenv.UI():MenuCommand(finale.MENUCMD_NOTESPACING)
regions[1].StartSlot = start_slot
regions[1].EndSlot = start_slot
regions[1]:SetInDocument()
end
end

-- ALL DONE -- empty out the copied clip files
for slot = 2, max_note_count do
regions[slot]:ReleaseMusic()
end

finenv:Region():SetInDocument()
regions[1]:SetInDocument()
end

staff_explode()