Old 08-15-2018, 01:59 PM   #1
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 753
Default Cycle through track layouts

Is there currently script that can cycle through track and mixer layouts?

Sometimes, I just want to select a track and hit a hotkey a few times to select its layout instead of going through the menu or relying on track status or name.

Anyone knows of if something currently exists for such?
Ozman is offline   Reply With Quote
Old 08-16-2018, 07:58 AM   #2
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

This is and old script, but seems to work:


https://forum.cockos.com/showthread....76#post1532976

Quote:
Originally Posted by spk77 View Post
I was "playing" with reaper.BR_GetMediaTrackLayouts/reaper.BR_SetMediaTrackLayouts, but there seems to be something weird happening when changing from horizontal meter to vertical meter:





This cycles through the user defined TCP-layouts ("default", "bd --- Small Full Meter" and "cd --- Large expanding, popup fader" in this example)
PHP Code:
local tcp_layouts = { -- TCP layout names from the default theme (REAPER v5.0pre36)
    
"", -- default
    --
"aa - Standard",
    --
"ab --- Standard + value readouts",
    --
"ac --- Standard Media",
    --
"ad --- Standard Media stretch",
    --
"ae --- Standard expanding",
    --
"af --- Standard expanding, popup fader",
    --
"ag --- Standard Extra-expanding",
    --
"ba - Small",
    --
"bb --- Small + value readouts",
    --
"bc --- Small Media",
    
"bd --- Small Full Meter",
    --
"bd --- Small Full Meter + value readouts",
    --
"be --- Small expanding, popup fader",
    --
"ca - Large",
    --
"cb --- Large + value readouts",
    --
"cc --- Large Media",
    
"cd --- Large expanding, popup fader"
}


function 
get_current_layouts_and_pos(track) -- "pos" means index in "tcp_layouts" -table
  local current_mcp_layout
current_tcp_layout reaper.BR_GetMediaTrackLayouts(track)
  
local i 1
  local pos 
0
  
for kv in ipairs(tcp_layouts) do
    if 
== current_tcp_layout then
      pos 
i
    end
    i 
1
  end
  
return current_mcp_layoutcurrent_tcp_layoutpos
end


function set_next_tcp_layout()
  
reaper.PreventUIRefresh(1)
  for 
i=1reaper.CountSelectedTracks(0) do
    
local track reaper.GetSelectedTrack(0i-1)
    if 
track ~= nil then
      current_mcp_layout
current_tcp_layoutpos get_current_layouts_and_pos(track)
      if 
current_tcp_layout == tcp_layouts[#tcp_layouts] then
        
new_tcp_layout tcp_layouts[1]
      else
        
new_tcp_layout tcp_layouts[pos+1]
      
end
      reaper
.BR_SetMediaTrackLayouts(trackcurrent_mcp_layoutnew_tcp_layout)
    
end
  end
  reaper
.PreventUIRefresh(-1)
end 

set_next_tcp_layout
() 
NOTE: If you try it, use REAPER v5.0pre36 for testing (or edit the names in "tcp_layouts" -table to match your theme)
spk77 is offline   Reply With Quote
Old 08-16-2018, 08:02 AM   #3
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 753
Default

Much thanks, spk77 for that script. Haven't seen that one.

One issue I have with approaches I've seen so far though is that it requires target layouts be predefined/chosen. However, being that different themes have different layouts, it just seems that it would make good sense to have a script/action that parses the available layouts and iterates through them.

Last edited by Ozman; 08-16-2018 at 08:17 AM.
Ozman is offline   Reply With Quote
Old 08-16-2018, 08:05 AM   #4
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

I'll update the script...there are new functions that weren't available back then:

Code:
themePath, string themeName = reaper.BR_GetCurrentTheme()

string retval, optional string desc, optional number value, optional number defValue, optional number minValue, optional number maxValue = reaper.ThemeLayout_GetParameter(integer wp)

returns theme layout parameter. return value is cfg-name, or nil/empty if out of range.

reaper.ThemeLayout_RefreshAll()

Refreshes all layouts


boolean reaper.ThemeLayout_SetParameter(integer wp, integer value, boolean persist)

sets theme layout parameter to value. persist=true in order to have change loaded on next theme load. note that the caller should update layouts via ??? to make changes visible.
spk77 is offline   Reply With Quote
Old 08-16-2018, 08:10 AM   #5
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Nice one spk77!!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 08-16-2018, 08:11 AM   #6
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Thanks Thonex!
spk77 is offline   Reply With Quote
Old 08-16-2018, 08:26 AM   #7
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 753
Default

Thanks, spk77.

Such a feature would most definitely come in handy.
Ozman is offline   Reply With Quote
Old 08-16-2018, 12:28 PM   #8
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Ok, it's still not possible to get all layout names for current theme (from reascripts). I hope that the devs would add EnumTCPLayouts/EnumMCPLayouts -functions at some point.

(This is just a thought)
It might be possible to get the names, currently selected layout (and layout count) from the "Layout" submenu using Win32/SWELL functions:
juliansader might know something about this :

spk77 is offline   Reply With Quote
Old 08-16-2018, 01:35 PM   #9
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 753
Default

Dang!

Well, hopefully, they see this and consider adding adding EnumTCPLayouts/EnumMCPLayouts to the API.


Please guys!
Ozman is offline   Reply With Quote
Old 08-17-2018, 01:32 AM   #10
DynamicK
Human being with feelings
 
Join Date: Nov 2017
Location: Gloucestershire, UK
Posts: 223
Default

Yeah... would be a great feature to have.
DynamicK is offline   Reply With Quote
Old 08-17-2018, 01:59 AM   #11
Bri1
Banned
 
Join Date: Dec 2016
Location: England
Posts: 2,432
Default

lol-trolltime!
wow--oldskool users still lost in a maze of unnecessary scripts>>

wake up you dopey fookers! - try view :screensets/layouts::layout tab @ end. <mousewheel scrolling by selecting+ mouse hover there=wootwithwonderous joy.
Bri1 is offline   Reply With Quote
Old 08-17-2018, 06:19 AM   #12
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 753
Default

Quote:
Originally Posted by Bri1 View Post
lol-trolltime!
wow--oldskool users still lost in a maze of unnecessary scripts>>

wake up you dopey fookers! - try view :screensets/layouts::layout tab @ end. <mousewheel scrolling by selecting+ mouse hover there=wootwithwonderous joy.
As I stated before:
Approaches I've seen so far require target layouts be predefined/chosen. However, being that different themes have different layouts, it just seems that it would make good sense to have a script/action that parses the available layouts and iterates through them.

I, like some other users, utilize more than one theme.
There should be a theme-neutral option for quick iteration through track layouts.
Ozman 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 03:37 PM.


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