Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 04-10-2019, 05:54 PM   #1
Gass n Klang
Human being with feelings
 
Gass n Klang's Avatar
 
Join Date: Nov 2015
Location: Cologne
Posts: 1,640
Default Script request: separate actions for "show/hide children of selected tracks" (41665)

hey guys,
I'd love to have a separate "show" and "hide" action that I can use instead of "mixer: show/hide children of selected tracks" (ID 41665). It has to be this behaviour (collapsing and uncollapsing folders in mcp instead of hiding) for me to work. I'd be super happy if someone could write these few lines for me. I need these actions to get my cycle actions (if condition) work.
Gass n Klang is online now   Reply With Quote
Old 01-30-2022, 10:18 AM   #2
HurdyGuigui
Human being with feelings
 
Join Date: Nov 2014
Posts: 17
Default

+1
HurdyGuigui is offline   Reply With Quote
Old 01-30-2022, 11:27 AM   #3
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 2,199
Default

Quickly put this together, but I think it should work.

Code:
reaper.Undo_BeginBlock()
for i = 0, reaper.CountSelectedTracks(0) - 1 do
    local track = reaper.GetSelectedTrack(0, i)
    local _, chunk = reaper.GetTrackStateChunk(track, '', false)
    local is_child_collapsed = chunk:match('\nBUSCOMP %d (%d) %d') == '1'
    if not is_child_collapsed then
        chunk = chunk:gsub('(\nBUSCOMP %d) (%d) (%d)', '%1 1 %3')
        reaper.SetTrackStateChunk(track, chunk, false)
    end
end
reaper.TrackList_AdjustWindows(false)
reaper.Undo_EndBlock('Hide children of selected tracks in mixer', -1)
Code:
reaper.Undo_BeginBlock()
for i = 0, reaper.CountSelectedTracks(0) - 1 do
    local track = reaper.GetSelectedTrack(0, i)
    local _, chunk = reaper.GetTrackStateChunk(track, '', false)
    local is_child_collapsed = chunk:match('\nBUSCOMP %d (%d) %d') == '1'
    if is_child_collapsed then
        chunk = chunk:gsub('(\nBUSCOMP %d) (%d) (%d)', '%1 0 %3')
        reaper.SetTrackStateChunk(track, chunk, false)
    end
end
reaper.TrackList_AdjustWindows(false)
reaper.Undo_EndBlock('Show children of selected tracks in mixer', -1)
__________________
Featured scripts: REAPER Update UtilityLil ChordboxGridbox/Adaptive gridMX TunerRS5K LinkMIDI Editor Magic Donate💝: PayPal|ko-fi

Last edited by FeedTheCat; 01-30-2022 at 11:35 AM.
FeedTheCat is online now   Reply With Quote
Old 01-31-2022, 01:50 PM   #4
HurdyGuigui
Human being with feelings
 
Join Date: Nov 2014
Posts: 17
Default

Amazing ! Thank you so much, it works like a charm !
HurdyGuigui 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 12:31 PM.


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