From 8237932d2d093abee234f99c17f8edc99262065c Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Sun, 6 Jan 2019 01:14:33 -0500 Subject: [PATCH] Release Reset TCP height of selected tracks to default v1.0 (#137) --- ...P height of selected tracks to default.lua | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Tracks Properties/cfillion_Reset TCP height of selected tracks to default.lua diff --git a/Tracks Properties/cfillion_Reset TCP height of selected tracks to default.lua b/Tracks Properties/cfillion_Reset TCP height of selected tracks to default.lua new file mode 100644 index 000000000..8d73d010d --- /dev/null +++ b/Tracks Properties/cfillion_Reset TCP height of selected tracks to default.lua @@ -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