Old 02-19-2019, 10:06 AM   #1
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,066
Default Redraw item after reverse?

If I reverse items using this code the items don't redraw. What should I be using?
BTW, the action 'Item properties: Toggle take reverse' does redraw the items, so its not my system/setup.

Code:
-- Toggle selected items reverse

reaper.Undo_BeginBlock(0)

local itemcount = reaper.CountSelectedMediaItems(0)
for i = 0, itemcount-1 do
  local item = reaper.GetSelectedMediaItem(0, i)
  local take = reaper.GetActiveTake(item)
  if take then
    _, section, start, length, fade, reverse = reaper.BR_GetMediaSourceProperties(take)
    reaper.BR_SetMediaSourceProperties(take, section, start, length, fade, not reverse)
  end
end

reaper.Undo_EndBlock("Toggle selected items reverse", -1)
reaper.UpdateTimeline() -- Redraw the arrange view and ruler

Last edited by Edgemeal; 02-19-2019 at 10:20 AM.
Edgemeal is online now   Reply With Quote
Old 02-19-2019, 02:46 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,505
Default

Code:
reaper.UpdateArrange()
at the end of the script !
X-Raym is offline   Reply With Quote
Old 02-19-2019, 02:58 PM   #3
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,066
Default

Quote:
Originally Posted by X-Raym View Post
Code:
reaper.UpdateArrange()
at the end of the script !
Ya I tried that too, doesn't help. I'm more curious then anything why/how.
Edgemeal is online now   Reply With Quote
Old 02-19-2019, 04:19 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,505
Default


Something is going on there....
X-Raym is offline   Reply With Quote
Old 02-19-2019, 04:21 PM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,505
Default

You can force refresh with a zoom and dezoom action





But I don't understand either why UpdateArrange is not enough.
X-Raym is offline   Reply With Quote
Old 02-19-2019, 04:24 PM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,505
Default

Ok in fact you also have to adjust item start offset.


It is automatically updated when you do Reverse from Media Item Properties but not from the SWS reascript function.
X-Raym is offline   Reply With Quote
Old 02-19-2019, 04:26 PM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,505
Default

Note that I already have action for toggling reverse and which doesn't have the issues you shew us cause I already solved that ^^


  • Script: X-Raym_Toggle selected active takes reverse arround their snap offset.lua
  • Script: X-Raym_Toggle selected active takes reverse preserving snap offset.lua
X-Raym is offline   Reply With Quote
Old 02-19-2019, 04:46 PM   #8
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,066
Default

Ya if you modify the items then it works, for example if I toggle item loop or item lock that forces the items to get redrawn.
Edgemeal is online now   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:30 PM.


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