Skip to content

Instantly share code, notes, and snippets.

@X-Raym
Created November 17, 2017 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save X-Raym/4eb872787709f963cfdbc8ed202d9cec to your computer and use it in GitHub Desktop.
Save X-Raym/4eb872787709f963cfdbc8ed202d9cec to your computer and use it in GitHub Desktop.
-- REGION MATRIX -------------------------------------------------------------
function CleanRegionMatrix()
local i = 0
repeat
local iRetval, bIsrgn, iPos, iRgnend, sName, iIndex, iColor = reaper.EnumProjectMarkers3(0,i)
if iRetval >= 1 then
if bIsrgn then
reaper.ShowConsoleMsg("Region index" .. tostring(iIndex) .. "\n" )
for z = 0, count_tracks - 1 do
track = reaper.EnumRegionRenderMatrix( 0, iIndex, z ) -- 0 Because unsetting shift the index
if track then
retval, track_name = reaper.GetTrackName(track, "")
reaper.ShowConsoleMsg(tostring(track_name) .. "\n" )
reaper.ShowConsoleMsg(tostring(track) .. "\n" )
reaper.SetRegionRenderMatrix( 0, iIndex, track, -1 )
else
break
end
end
end
i = i + 1
end
until iRetval == 0
end
--------------------------------------------------------- END OF UTILITIES
-- INIT -------------------------------------------------------------
count_tracks = reaper.CountTracks(0)
if count_tracks > 0 then
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock() -- Begining of the undo block.
reaper.ClearConsole()
CleanRegionMatrix()
reaper.Undo_EndBlock( "Clean render region matrix" , -1)
reaper.PreventUIRefresh(-1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment