forked from ReaTeam/ReaScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release Toggle visual spacer before or after selected tracks v1.0
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Tracks Properties/cfillion_Toggle visual spacer before or after selected tracks.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- @description Toggle visual spacer before or after selected tracks | ||
-- @author cfillion | ||
-- @version 1.0 | ||
-- @metapackage | ||
-- @provides | ||
-- [main] . > cfillion_Toggle visual spacer before selected tracks.lua | ||
-- [main] . > cfillion_Toggle visual spacer after selected tracks.lua | ||
-- @donation https://reapack.com/donate | ||
|
||
local UNDO_STATE_TRACKCFG <const> = 1 | ||
local SCRIPT_NAME <const> = select(2, reaper.get_action_context()):match("([^/\\_]+)%.lua$") | ||
local MODE_AFTER <const> = SCRIPT_NAME:match('after') | ||
|
||
reaper.PreventUIRefresh(1) | ||
reaper.Undo_BeginBlock() | ||
for i = 0, reaper.CountSelectedTracks(nil) - 1 do | ||
local track = reaper.GetSelectedTrack(nil, i) | ||
if MODE_AFTER then | ||
local id = reaper.GetMediaTrackInfo_Value(track, 'IP_TRACKNUMBER') | ||
track = reaper.GetTrack(nil, id) | ||
end | ||
if track then | ||
local spacer = reaper.GetMediaTrackInfo_Value(track, 'I_SPACER') | ||
reaper.SetMediaTrackInfo_Value(track, 'I_SPACER', spacer ~ 1) | ||
end | ||
end | ||
reaper.Undo_EndBlock(SCRIPT_NAME, UNDO_STATE_TRACKCFG) | ||
reaper.PreventUIRefresh(-1) |