As a workaround, you can temporarily disable "SWS/S&M: Toggle toolbars auto refresh enable" before running the unselect action:
local SWS_TOOLBAR_REFRESH_ENABLE = reaper.NamedCommandLookup('_S&M_TOOLBAR_REFRESH_ENABLE')
local SWS_UNSEL_OFFSCREEN_ITEMS = reaper.NamedCommandLookup('_S&M_UNSEL_OFFSCREEN_ITEMS')
local edge_L, edge_R =30, 60
reaper.GetSet_ArrangeView2(nil, true, 0, 0, edge_L, edge_R)
local refreshEnabled = reaper.GetToggleCommandState(SWS_TOOLBAR_REFRESH_ENABLE) >0if refreshEnabled then reaper.Main_OnCommand(SWS_TOOLBAR_REFRESH_ENABLE, 0) end
reaper.Main_OnCommand(SWS_UNSEL_OFFSCREEN_ITEMS, 0)
if refreshEnabled then reaper.Main_OnCommand(SWS_TOOLBAR_REFRESH_ENABLE, 0) end
cfillion
added a commit
to cfillion/sws
that referenced
this issue
Oct 9, 2020
SWS/S&M: Unselect offscreen items
SWS/S&M: Toolbar - Toggle offscreen item selection
It previously required "SWS/S&M: Toggle toolbars auto refresh enable" to
be disabled for the offscreen items to be refresh synchronously.
Otherwise the refresh would be done through the global toolbar refresh timer.
This made the above actions potentially use out-of-date data when used as part
of a custom action or a script.
Fixesreaper-oss#1325.
When I use this action in a script like this:
reaper.GetSet_ArrangeView2(0, true, 0, 0, edge_L, edge_R)
reaper.Main_OnCommand(reaper.NamedCommandLookup('_S&M_UNSEL_OFFSCREEN_ITEMS'), 0)
It runs using the old arrange view data, but not edge_L and edge_R
The text was updated successfully, but these errors were encountered: