Old 05-13-2021, 11:25 AM   #1
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,227
Default scroll visible tracks vertically into view?

i have a bunch of custom actions and scripts to help navigate projects with a lot of tracks. i'm finding that i'm often hiding hundreds of tracks and culling my view down to just a few tracks for immediate editing.

the problem at hand is that, when i hide most of the tracks, the remaining few wind up wholly or partially off screen someplace. there is an action to scroll selected tracks into view. problem here is that these remaining tracks are not selected. there appears to be no action to scroll visible tracks into view. i suppose i could make a script that selects only the visible tracks and pair that with the 'scroll selected tracks' action into a new custom action. thought there might already be a way to do this, though, so i figured i should ask. is there? is there a better way to try to implement this?


edit:
this selects the visible tracks:
Code:
function main()

    reaper.Undo_BeginBlock()   -- Begining of the undo block. Leave it at the top of your main function.

        local TrxTotal = reaper.CountTracks( 0 )

        for i                = 0, TrxTotal - 1 do                -- loop through tracks

            local TrkCurr    = reaper.GetTrack( 0, i )           -- set variable for current track
            local Visible    = reaper.GetMediaTrackInfo_Value( TrkCurr, "B_SHOWINTCP" )

            if Visible       == 1 then
                reaper.SetMediaTrackInfo_Value( TrkCurr, "I_SELECTED", 1 )
            end
            
        end    

    reaper.Undo_EndBlock( "Loop through visible tracks to set selected", -1 )    -- End of the undo block. Leave it at the bottom of your main function.

end

reaper.PreventUIRefresh(1)                                                                      -- Prevent UI refreshing. Uncomment it only if the script works.

main()                                                                                          -- Execute your main function

reaper.TrackList_AdjustWindows(false)
reaper.PreventUIRefresh(-1)                                                                     -- Restore UI Refresh. Uncomment it only if the script works.
thanks,
babag

Last edited by babag; 05-13-2021 at 12:14 PM.
babag 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 08:14 AM.


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