Old 02-03-2019, 07:57 AM   #1
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 412
Default Show tracks containing audio or midi items

Hi, I was wondering if anyone had already made a script to show only tracks containing audio or midi items
I have the lokasenna show scripts, but they rely on name, and I don't really want to have to name each audio and midi track, and adding a name to the default track would be inconvenient when naming tracks in a hurry.

Cheers
Travesty is offline   Reply With Quote
Old 02-03-2019, 10:31 AM   #2
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 3,361
Default

The Only show tracks with items inside time selection script might be interesting in this case (available via ReaPack by adding the Claudiohbsantos repository: https://reapack.com/repos)
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 02-03-2019, 11:32 AM   #3
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 1,631
Default

That one is buggy, I'm using mpl's script:
"Toggle show tracks if time selection crossing any of their items".

However, I'm planning to code something that will hide all tracks with no items.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 02-03-2019, 12:13 PM   #4
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Posts: 334
Default

Quote:
Originally Posted by _Stevie_ View Post
However, I'm planning to code something that will hide all tracks with no items.
Really looking forward to that. Would be extremely useful.
Klangfarben is offline   Reply With Quote
Old 02-03-2019, 12:33 PM   #5
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,281
Default

Code:
 for key in pairs(reaper) do _G[key]=reaper[key]  end
  -------------------------------------------------------
  function main_ShowTracksWithItems()
    local tcp_hide_ext_str = ''
    for i_tr = 1, CountTracks(0) do
      local tr = GetTrack(0,i_tr-1) 
      local show
      local is_visibleTCP = math.floor(GetMediaTrackInfo_Value( tr, 'B_SHOWINTCP' ))
      local is_visibleMCP = math.floor(GetMediaTrackInfo_Value( tr, 'B_SHOWINMIXER'))
      if CountTrackMediaItems( tr )== 0 then tcp_hide_ext_str = tcp_hide_ext_str..'\n'.. GetTrackGUID( tr )..' '..is_visibleTCP..' '..is_visibleMCP end
      
      if CountTrackMediaItems( tr )~= 0 then
        SetMediaTrackInfo_Value( tr, 'B_SHOWINMIXER', 1 )
        SetMediaTrackInfo_Value( tr, 'B_SHOWINTCP',   1 )  
       else
        SetMediaTrackInfo_Value( tr, 'B_SHOWINMIXER', 0 )
        SetMediaTrackInfo_Value( tr, 'B_SHOWINTCP',   0 )
      end
      SetProjExtState(0, 'MPL_TOGGLESHOWTRWITHITEMS2', 'timesel', tcp_hide_ext_str )    
    end
    
  end
  ------------------------------------------------------- 
  function main_RestoreTracks()
    local _, ext_s = GetProjExtState(0, 'MPL_TOGGLESHOWTRWITHITEMS2', 'timesel') 
    local t = {}
    for line in ext_s:gmatch('[^\r\n]+') do
      local t2 = {} for val in line:gmatch('[^%s]+') do t2[#t2+1] = val end
      if #t2 == 3 then t[t2[1]] = {tcp=tonumber(t2[2]),mcp = tonumber(t2[3])} end
    end
    for i_tr = 1, CountTracks(0) do
      local tr = GetTrack(0,i_tr-1)  
      local trGUID = GetTrackGUID( tr ) 
      if t[trGUID] then
        SetMediaTrackInfo_Value( tr, 'B_SHOWINMIXER', t[trGUID].mcp )
        SetMediaTrackInfo_Value( tr, 'B_SHOWINTCP',   t[trGUID].tcp ) 
       else
        SetMediaTrackInfo_Value( tr, 'B_SHOWINMIXER', 1 )
        SetMediaTrackInfo_Value( tr, 'B_SHOWINTCP',   1 ) 
      end
    end
  end
  -------------------------------------------------------
  local is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
  state = reaper.GetToggleCommandState( cmdID )
  if state == -1 then state = 0 end
  reaper.SetToggleCommandState( sectionID, cmdID, math.abs(1-state) )
  -------------------------------------------------------
  if state == 0 then 
    main_ShowTracksWithItems() 
   else
    main_RestoreTracks()
  end
  TrackList_AdjustWindows( false )
  UpdateArrange()
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 02-03-2019, 12:49 PM   #6
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 1,631
Default

mpl was faster
However, I finished mine as well. It's a bit different from mpl's:

- I don't use a toggle, since I use other scripts to show tracks (show all tracks, show folders, etc...)
- They only hide the tracks in the TCP
- additionally, there's a script that will ignore folder tracks and leave them alone (visible)

The 2 scripts are available via my ReaPack repo:
Hide tracks without items (TCP)
Hide tracks without items and ignore folder tracks (TCP)
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 02-04-2019, 04:44 PM   #7
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 412
Default

Wow, thanks guys. Is there a way to do the same, but discriminate between audio or midi items?

So one would be:

Show only tracks containing audio items

and the other:

Show only tracks containing midi items

Thanks
Travesty is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.