Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 12-03-2020, 09:44 AM   #1
bhuether
Human being with feelings
 
Join Date: Nov 2016
Posts: 226
Default What function calls needed after making track structure changes?

Hi,

I am writing a script that does a lot of track manipulation. So I have various getTrack, ReOrderSelectedTracks, InsertTrackAtIndex, etc calls.

But in addition to these calls, I am not sure if I should be doing something else as well, like maybe there is some housekeeping call I am supposed to make after I make track changes?

thanks
bhuether is offline   Reply With Quote
Old 12-03-2020, 11:19 AM   #2
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 190
Default

If you are preventing the UI from refreshing during those function calls then you just need to call UpdateArrange() after you allow the UI to refresh again. If you aren't doing that then I don't think you need to worry about doing anything extra, as the function calls you make should handle everything.

If you are preventing your refresh it should look something like this:

Code:
reaper.Undo_BeginBlock()

reaper.PreventUIRefresh(1)

--your code here--

--whenever you want to stop preventing the UI from refreshing (normally at the end of the code)

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()

reaper.Undo_EndBlock("Script ran", -1)
jkooks is offline   Reply With Quote
Old 12-03-2020, 11:46 AM   #3
bhuether
Human being with feelings
 
Join Date: Nov 2016
Posts: 226
Default

I am doing undo blocks, but nothing with refresh.

I noticed after running my script, that Neutronic's Quick Add script doesn't work. So I figured it has to do with my script resulting in some track state that throws things off for other scripts?
bhuether is offline   Reply With Quote
Old 12-03-2020, 11:50 AM   #4
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Sometimes you may also need to call TrackList_AdjustWindows() to update TCP/MCP.
(about isMinor see here)
nofish 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 02:39 AM.


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