Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWS/S&M: Unselect offscreen items can't get the updated arrange view #1325

Closed
dsyrock opened this issue Mar 23, 2020 · 1 comment · Fixed by #1418
Closed

SWS/S&M: Unselect offscreen items can't get the updated arrange view #1325

dsyrock opened this issue Mar 23, 2020 · 1 comment · Fixed by #1418
Assignees
Labels

Comments

@dsyrock
Copy link

dsyrock commented Mar 23, 2020

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

@cfillion
Copy link
Collaborator

cfillion commented Oct 9, 2020

Fixing!

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) > 0
if 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.

Fixes reaper-oss#1325.
@cfillion cfillion self-assigned this Oct 9, 2020
@cfillion cfillion added the bug label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants