Skip to content

Commit

Permalink
Release Select all items in track that have exactly the same video pr…
Browse files Browse the repository at this point in the history
…ocessors as the selected item (unselect original item) v1.00 (#1366)
  • Loading branch information
amagalma authored Apr 26, 2024
1 parent f630577 commit 52f5f1d
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- @description Select all items in track that have exactly the same video processors as the selected item (unselect original item)
-- @author amagalma
-- @version 1.00
-- @donation https://www.paypal.me/amagalma
-- @about Same action as the similarly named, but unselects the originally selected item


local item_cnt = reaper.CountSelectedMediaItems( 0 )
if item_cnt ~= 1 then
reaper.MB( "Please, choose just one item.", "Can't continue..", 0 )
return
end


local function GetVideoFX( item )
if not reaper.GetActiveTake( item ) then return 0, "" end
local _, chunk = reaper.GetItemStateChunk( item, "", false )
local video_fx, v = {}, 0
for code in chunk:gmatch("<VIDEO_EFFECT.-CODEPARM .->") do
v = v + 1
video_fx[v] = code
end
return v, table.concat(video_fx, "\n")
end


local item = reaper.GetSelectedMediaItem( 0, 0 )
local fx_num, code = GetVideoFX( item )

if fx_num == 0 or code == "" then
reaper.MB( "This item has no video processors.", "Can't continue..", 0 )
return
end


reaper.PreventUIRefresh( 1 )

local track = reaper.GetMediaItemTrack( item )

for i = 0, reaper.CountTrackMediaItems( track )-1 do
local tr_item = reaper.GetTrackMediaItem( track, i )
if tr_item ~= item then
local _, tr_code = GetVideoFX( tr_item )
reaper.SetMediaItemSelected( tr_item, tr_code == code )
end
end

reaper.SetMediaItemSelected( item, false )

reaper.PreventUIRefresh( -1 )
reaper.UpdateArrange()
reaper.Undo_OnStateChange( "Select items with same video processors (unselect original)" )

0 comments on commit 52f5f1d

Please sign in to comment.