Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 07-22-2016, 09:58 AM   #1
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 3,990
Default Lua bug: reaper.TrackFX_SetPreset creates undo outside undo block (FIXED)

reposting this in the bug reports forum, since I think it is a bug and I posted it wrongly in the JSFX forum first.

I don't expect the "Change FX preset: Track 1: ReaEQ" to appear in the undo history. It should be enclosed by the Undo Block. So it seems a bug, that after the undo block is created, another undo entry is added for setting the preset. If you add multiple different TrackFX_SetPreset, a lot of undo entries are added.





code to test:
Code:
reaper.Undo_BeginBlock()
    local track=reaper.GetSelectedTrack(0,0)
    fxint=reaper.TrackFX_GetByName(track, "ReaEQ", true)
    if fxint>=0 then
        preset = reaper.TrackFX_SetPreset(track, fxint, "stock - Track Default") 
    end
reaper.Undo_EndBlock("Setting Preset", -1)


But it would be better if we could have an option in the reaper.TrackFX_SetPreset function to completely skip the creation of undo entry.
something like:

boolean reaper.TrackFX_SetPreset(MediaTrack track, integer fx, string presetname, boolean createundo)

I've totally failed trying to make it not adding the undo. help!
thanks
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 09-14-2016, 09:23 AM   #2
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 3,990
Default

I've done an alternative way to code this using get/set chunks that doesn't generate undo. But it is not CPU friendly, and it generates audio glitches if used when playing. Sometimes I need to set preset for 10 or 20 tracks at once. so I have the option to use reaper.TrackFX_SetPreset which generates 20 undo entries, or use chunks and deal with audio glitches.
If at least I could group all 20 undo entries in one undo block it would be better.
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 03-08-2017, 04:01 PM   #3
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 790
Default

Confirmed.

The same applies to reaper.TrackFX_SetPresetByIndex...
amagalma is offline   Reply With Quote
Old 03-14-2017, 03:15 PM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 10,147
Default

Fixing this!
Justin 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 04:31 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.