|
|
|
10-29-2015, 03:50 PM
|
#1
|
Human being with feelings
Join Date: Sep 2010
Posts: 281
|
How to delete all empty tracks?
How to delete all empty tracks (the ones which have no vsts on the chain and are totally empty)?
i found something but i dont know how i setup this?
https://stash.reaper.fm/v/25407/Delet...s.ReaperKeyMap
please help
|
|
|
10-29-2015, 04:47 PM
|
#2
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
The ReaperKeyMap file you found binds an action called "Xenakios/SWS: Select tracks with no items" from the SWS extension to a keyboard key. To use it, click on the "Import/Export" button in the Action List. It doesn't actually delete anything or check if there are any FX on the tracks, though.
Here's a short lua script I just wrote which deletes every empty (no items, no FXs, no envelopes) unarmed tracks found in the project:
Code:
-- delete_empty_tracks.lua v0.1 by Christian Fillion (cfillion)
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
local track_index, track_count = 0, reaper.CountTracks()
local bucket, bucket_index = {}, 0
while track_index < track_count do
local track = reaper.GetTrack(0, track_index)
local fx_count = reaper.TrackFX_GetCount(track)
local item_count = reaper.CountTrackMediaItems(track)
local env_count = reaper.CountTrackEnvelopes(track)
local depth = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
local is_armed = reaper.GetMediaTrackInfo_Value(track, "I_RECARM")
if fx_count + item_count + env_count + math.max(depth, 0) + is_armed == 0 then
bucket[bucket_index] = track
bucket_index = bucket_index + 1
end
track_index = track_index + 1
end
if bucket_index > 0 then
local dialog_btn = reaper.ShowMessageBox(
string.format("Delete %d empty tracks?", bucket_index),
"Confirmation", 1
)
if dialog_btn == 1 then
local track_index = 0
while track_index < bucket_index do
reaper.DeleteTrack(bucket[track_index])
track_index = track_index + 1
end
end
end
reaper.Undo_EndBlock("Delete Empty Tracks", 1)
reaper.PreventUIRefresh(-1)
https://raw.githubusercontent.com/cf...pty_tracks.lua
Save this this in a .lua file and import it in REAPER's Action List (click on the "Load" button right to "ReaScript"). You will see it appear in the list. Double-click on it to execute the script (you can also bind a keyboard shortcut to it if you want).
|
|
|
10-30-2015, 11:39 AM
|
#3
|
Human being with feelings
Join Date: Sep 2010
Posts: 281
|
Thanks, you have some skills. It works. this is very useful for large experiment projects with more than 150 tracks
fast cleanup.
one offtopic question:
why does this SWS command work anymore in the new reapers?
SWS/S&M: Close all floating FX windows
SWS/S&M: Close all floating FX windows, except focused one
when you have 10 vts open this is really helpful, so that you can minimize all VSTs just with one shortcut/button and you have a clean arranger windows view.... but it does not work anymore
why?
Last edited by acintya; 10-30-2015 at 11:51 AM.
|
|
|
10-30-2015, 12:14 PM
|
#4
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
They works for me here on REAPER v5.1pre1c with SWS v2.8.1, at least on OS X. If you think there's a bug, you should report it on their issue tracker or maybe here.
|
|
|
10-30-2015, 01:56 PM
|
#5
|
Human being with feelings
Join Date: Sep 2010
Posts: 281
|
Quote:
Originally Posted by cfillion
They works for me here on REAPER v5.1pre1c with SWS v2.8.1, at least on OS X. If you think there's a bug, you should report it on their issue tracker or maybe here.
|
hmmmm, thanks.. but it is not that. i figured out now whats the problem ---- it works in reaper 32bit but in reaper 64 you cannot close bridged floating windows (vsts)
any ideas?
|
|
|
12-17-2019, 06:02 PM
|
#6
|
Human being with feelings
Join Date: Jan 2017
Posts: 5
|
Quote:
Originally Posted by cfillion
Here's a short lua script I just wrote which deletes every empty (no items, no FXs, no envelopes) unarmed tracks found in the project:
|
Thanks for sharing this code! Super helpful for me
Made one addition to the .lua script that accounts for sends/receives, it was deleting buss tracks along with empty tracks before.
Here's the updated code:
Code:
-- delete_empty_tracks.lua v0.1 by Christian Fillion (cfillion)
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
local track_index, track_count = 0, reaper.CountTracks()
local bucket, bucket_index = {}, 0
while track_index < track_count do
local track = reaper.GetTrack(0, track_index)
local fx_count = reaper.TrackFX_GetCount(track)
local item_count = reaper.CountTrackMediaItems(track)
local env_count = reaper.CountTrackEnvelopes(track)
local depth = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
local is_armed = reaper.GetMediaTrackInfo_Value(track, "I_RECARM")
local sends = reaper.GetTrackNumSends(track, 0)
local receives = reaper.GetTrackNumSends(track, -1)
if fx_count + item_count + env_count + math.max(depth, 0) + is_armed + sends + receives == 0 then
bucket[bucket_index] = track
bucket_index = bucket_index + 1
end
track_index = track_index + 1
end
if bucket_index > 0 then
local dialog_btn = reaper.ShowMessageBox(
string.format("Delete %d empty tracks?", bucket_index),
"Confirmation", 1
)
if dialog_btn == 1 then
local track_index = 0
while track_index < bucket_index do
reaper.DeleteTrack(bucket[track_index])
track_index = track_index + 1
end
end
end
reaper.Undo_EndBlock("Delete Empty Tracks", 1)
reaper.PreventUIRefresh(-1)
__________________
~ one nation under Pug ~
Reaper Tutorials Youtube channel
|
|
|
02-07-2021, 12:13 PM
|
#7
|
Human being with feelings
Join Date: Nov 2018
Location: Montreal
Posts: 405
|
Quote:
Originally Posted by cfillion
The ReaperKeyMap file you found binds an action called "Xenakios/SWS: Select tracks with no items" from the SWS extension to a keyboard key. To use it, click on the "Import/Export" button in the Action List. It doesn't actually delete anything or check if there are any FX on the tracks, though.
Here's a short lua script I just wrote which deletes every empty (no items, no FXs, no envelopes) unarmed tracks found in the project:
Code:
-- delete_empty_tracks.lua v0.1 by Christian Fillion (cfillion)
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
local track_index, track_count = 0, reaper.CountTracks()
local bucket, bucket_index = {}, 0
while track_index < track_count do
local track = reaper.GetTrack(0, track_index)
local fx_count = reaper.TrackFX_GetCount(track)
local item_count = reaper.CountTrackMediaItems(track)
local env_count = reaper.CountTrackEnvelopes(track)
local depth = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
local is_armed = reaper.GetMediaTrackInfo_Value(track, "I_RECARM")
if fx_count + item_count + env_count + math.max(depth, 0) + is_armed == 0 then
bucket[bucket_index] = track
bucket_index = bucket_index + 1
end
track_index = track_index + 1
end
if bucket_index > 0 then
local dialog_btn = reaper.ShowMessageBox(
string.format("Delete %d empty tracks?", bucket_index),
"Confirmation", 1
)
if dialog_btn == 1 then
local track_index = 0
while track_index < bucket_index do
reaper.DeleteTrack(bucket[track_index])
track_index = track_index + 1
end
end
end
reaper.Undo_EndBlock("Delete Empty Tracks", 1)
reaper.PreventUIRefresh(-1)
https://raw.githubusercontent.com/cf...pty_tracks.lua
Save this this in a .lua file and import it in REAPER's Action List (click on the "Load" button right to "ReaScript"). You will see it appear in the list. Double-click on it to execute the script (you can also bind a keyboard shortcut to it if you want).
|
That's great! Is there a way to tweak it into bypassing the confirmation prompt?
Thanks,
|
|
|
02-07-2021, 12:40 PM
|
#8
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Quote:
Originally Posted by fbeauvaisc
That's great! Is there a way to tweak it into bypassing the confirmation prompt?
|
Code:
-- delete_empty_tracks_no_prompt.lua v0.1 by Christian Fillion (cfillion)
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
local track_index, track_count = 0, reaper.CountTracks()
local bucket, bucket_index = {}, 0
while track_index < track_count do
local track = reaper.GetTrack(0, track_index)
local fx_count = reaper.TrackFX_GetCount(track)
local item_count = reaper.CountTrackMediaItems(track)
local env_count = reaper.CountTrackEnvelopes(track)
local depth = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
local is_armed = reaper.GetMediaTrackInfo_Value(track, "I_RECARM")
if fx_count + item_count + env_count + math.max(depth, 0) + is_armed == 0 then
bucket[bucket_index] = track
bucket_index = bucket_index + 1
end
track_index = track_index + 1
end
if bucket_index > 0 then
local track_index = 0
while track_index < bucket_index do
reaper.DeleteTrack(bucket[track_index])
track_index = track_index + 1
end
end
reaper.Undo_EndBlock("Delete empty tracks", 1)
reaper.PreventUIRefresh(-1)
|
|
|
02-07-2021, 03:09 PM
|
#9
|
Human being with feelings
Join Date: Nov 2018
Location: Montreal
Posts: 405
|
That was fast. Works great thank you!
|
|
|
05-20-2023, 05:48 AM
|
#10
|
Human being with feelings
Join Date: Jun 2015
Location: Venezuela
Posts: 350
|
Quote:
Originally Posted by cfillion
Code:
-- delete_empty_tracks_no_prompt.lua v0.1 by Christian Fillion (cfillion)
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
local track_index, track_count = 0, reaper.CountTracks()
local bucket, bucket_index = {}, 0
while track_index < track_count do
local track = reaper.GetTrack(0, track_index)
local fx_count = reaper.TrackFX_GetCount(track)
local item_count = reaper.CountTrackMediaItems(track)
local env_count = reaper.CountTrackEnvelopes(track)
local depth = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
local is_armed = reaper.GetMediaTrackInfo_Value(track, "I_RECARM")
if fx_count + item_count + env_count + math.max(depth, 0) + is_armed == 0 then
bucket[bucket_index] = track
bucket_index = bucket_index + 1
end
track_index = track_index + 1
end
if bucket_index > 0 then
local track_index = 0
while track_index < bucket_index do
reaper.DeleteTrack(bucket[track_index])
track_index = track_index + 1
end
end
reaper.Undo_EndBlock("Delete empty tracks", 1)
reaper.PreventUIRefresh(-1)
|
This script is super useful, thank you!!
I think it should be included in Reapack.
There is one but this one does a better job
|
|
|
05-20-2023, 07:27 AM
|
#11
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Thanks, I've uploaded it to ReaPack as "Remove empty tracks".
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:12 AM.
|