With some layouts the API function BR_SetMediaTrackLayouts creates glitches. For example in the default theme, if you change the TCP layout to "bd --- Small Full Meter" and then back to the default layout, it will break the later.
ReaScript documentation (Help->ReaScript documentation) clearly states:
Note that in case of setting MCP layout, due to API limitations, MCP panel width is not updated to match the new layout. However, you can manually refresh it by calling the action "Mixer: Toggle master track visible" (just make sure to call it twice so master track visibility stays the same).
Why is this expected from the user and not done directly when the API is called?
Because you may be changing layout of multiple tracks and that means that those actions would be called multiple times (for each call to BR_SetMediaTrackLayouts the action would be called twice). Instead, user can simply call the action only 2 times, after setting all the layouts and thus not wasting CPU cycles on unneeded actions.
But the problem happens with the TCP.
I see now that you wrote TCP and not MCP. Sorry about that, I missed it.
I guess you could employ the same trick but this time try and hide/show the track? I'll see if that works and I'll do it automatically in SWS for the next update.
It does work, thanks!
Ah, thanks for testing it for me then :) I'll push the fix now
The MCP workaround is problematic for me because I'm using the function in a defer() script and it keeps changing the Master's visibility making the mixer useless. Any way to refresh the mcp panel width only when the layout is changed? Here is a post to Sexan's newest modification of my script: http://forum.cockos.com/showpost.php?p=1565504&postcount=5
Function should return true if there were any changes so you can use that as the flag to refresh MCP with said actions
Me again. I was able to avoid successfully the glitches but the use of hide/unhide (they have to be toggle to keep visibility state) makes the tcp and arrange view blink in a visible and quite annoying way. Is it going to be transparent when integrated in the function?
Latest pre introduces additional API for track layouts. You can use that now. I'll fix SWS api so it also uses this new native API calss
Fixed #764: glitches in TCP after setting new TCP layout with BR_SetM…