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 Reset TCP height of selected tracks to default v1.0 (ReaTeam#137
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Tracks Properties/cfillion_Reset TCP height of selected tracks to default.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,31 @@ | ||
-- @description Reset TCP height of selected tracks to default | ||
-- @author cfillion | ||
-- @version 1.0 | ||
-- @link https://cfillion.ca | ||
-- @donation https://paypal.me/cfillion | ||
|
||
local UNDO_STATE_TRACKCFG = 1 | ||
local I_HEIGHTOVERRIDE = 'I_HEIGHTOVERRIDE' | ||
local SCRIPT_NAME = ({reaper.get_action_context()})[2]:match("([^/\\_]+)%.lua$") | ||
|
||
local didSomething = false | ||
|
||
for i=0,reaper.CountSelectedTracks(0)-1 do | ||
local track = reaper.GetSelectedTrack(0, i) | ||
|
||
if reaper.GetMediaTrackInfo_Value(track, I_HEIGHTOVERRIDE) > 0 then | ||
if not didSomething then | ||
reaper.Undo_BeginBlock() | ||
didSomething = true | ||
end | ||
|
||
reaper.SetMediaTrackInfo_Value(track, I_HEIGHTOVERRIDE, 0) | ||
end | ||
end | ||
|
||
if didSomething then | ||
reaper.Undo_EndBlock(SCRIPT_NAME, UNDO_STATE_TRACKCFG) | ||
reaper.TrackList_AdjustWindows(true) | ||
else | ||
reaper.defer(function() end) | ||
end |