|
|
|
09-17-2013, 10:36 AM
|
#41
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by spk77
Tested with v4.401 and v.4.53pre4 - undo point is added in v4.401, but not in v.4.53pre4. There have been undo-related updates lately.
|
I'm on 4.52. I guess something got broken?
|
|
|
09-17-2013, 10:45 AM
|
#42
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by IXix
I'm on 4.52. I guess something got broken?
|
I think something happened around v4.5:
from v4.5 changelog :
Code:
Undo: extensive optimizations and improvements
Undo: avoid excessive state loading when undoing changes to track order/counts
Undo: better reuse of undo buffers when changing track order/counts
Undo: improved memory use, scan for common blocks in history when adding states
Undo: incrementally updated RPP-UNDO files, can make for much faster save of undo history
|
|
|
09-17-2013, 10:57 AM
|
#43
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by spk77
I think something happened around v4.5
|
Is normal ReaScript undo (ie. not "with undoable") working for you? I'm never sure if I'm just doing something wrong.
|
|
|
09-17-2013, 12:15 PM
|
#44
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by IXix
Is normal ReaScript undo (ie. not "with undoable") working for you? I'm never sure if I'm just doing something wrong.
|
No, it seems to be broken, at least when changing FX parameter values from a script. (Changing manually adds an undo point):
Code:
from reaper_python import *
import random
RPR_Undo_BeginBlock2(0)
firstTrack = RPR_GetTrack(0, 0)
value = random.uniform(0, 0.5)
RPR_TrackFX_SetParam(firstTrack, 0, 0, value)
##RPR_Undo_OnStateChange2(0, "undo name")
RPR_Undo_EndBlock2(0, "undo point name", -1)
I don't know - I always use "-1" for RPR_Undo_EndBlock2(). Sometimes I have to add " RPR_Undo_OnStateChange2(0, "undo name")" to get rid of the extra "ReaScript: run" -point.
Last edited by spk77; 09-17-2013 at 12:24 PM.
|
|
|
09-17-2013, 12:43 PM
|
#45
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Almost working in 4.401 - except the random "ReaScript: run" -points:
|
|
|
09-19-2013, 12:11 PM
|
#46
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
API vs Undo system: I can confirm something went wrong around v4.5, and not only for ReaScript. ATM, most of undo points set by the SWS extension are broken for ex (!)
v4.51, Win XP - everything OK with the same reaper_sws.dll in REAPER v4.402. it's a bit like states are "remembered" but no no undo point is actually set (so you need to make a sel change or something to get it after you run the said actions, etc.)
Repro example: "cut take" & "paste take" S&M actions.
EDIT: let's make a BR!
Quote:
Originally Posted by spk77
except the random "ReaScript: run" -points:
|
that's where I left the thread...
I don't understand that either, it should be up to the reascripter to create (or not) an undo point, no? it works like that is C, fortunately!
Last edited by Jeffos; 09-19-2013 at 12:17 PM.
|
|
|
09-19-2013, 12:15 PM
|
#47
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by Jeffos
ATM, most of undo points set by the SWS extension are broken for ex (!)
|
Ouch! I assume you'll be raising the matter with the devs then?
|
|
|
09-19-2013, 02:02 PM
|
#48
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
=> BR: http://forum.cockos.com/project.php?issueid=4934
Quote:
Originally Posted by IXix
Ouch! I assume you'll be raising the matter with the devs then?
|
Yes, hot, will do (although I'm not sure Justin or Schwa read my mails anymore lateky, and have no actual prOof Christophe reads/writes or even understands French )
|
|
|
04-12-2014, 04:33 PM
|
#49
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
So was it fixed?
Jeffos, as you're now a part of main developement could you pleease look at this?
Thanks!
|
|
|
04-12-2014, 06:47 PM
|
#50
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
Quote:
Originally Posted by Jeffos
|
This is the one and only thing that annoys me about Cockos: there is no 'priority channel' for trusted developers, experienced beta testers or professional users to communicate with Justin/John/Christophe.
|
|
|
04-16-2014, 06:17 AM
|
#51
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
I'm still getting 2 undo points...
Is there a reliable known way to consolidate all undo points?
|
|
|
04-16-2014, 06:23 AM
|
#52
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
There was for Python.
|
|
|
04-16-2014, 06:25 AM
|
#53
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Quote:
Originally Posted by daxliniere
There was for Python.
|
Which one? Could you share please? So far nothing works for me...
|
|
|
04-16-2014, 06:30 AM
|
#54
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
I can't remember who wrote this one (Tim, Breeder or spk77 I think), but it's not the standard one that you see all the time.
Here's an example from my split tool:
Code:
from reaper_python import *
from contextlib import contextmanager
@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0,message,-1)
with undoable('Split item(s)'):
SelectItemUnderCursor = 40528
DeselectItems = 40289
MoveCursor = 40513
SplitItems = RPR_NamedCommandLookup('_SWS_AWSPLITXFADELEFT')
SelectPreviousItem = RPR_NamedCommandLookup('_SWS_SELPREVITEM2')
CrossfadeToTimeSel = 40916
selItems = RPR_CountSelectedMediaItems(0)
timeSel = RPR_GetSet_LoopTimeRange2(0, 0, 0, 0, 0, 0)[3] != RPR_GetSet_LoopTimeRange2(0, 0, 0, 0, 0, 0)[4]
RPR_Main_OnCommand(MoveCursor, 0)
if (selItems==0):
RPR_Main_OnCommand(SelectItemUnderCursor, 0)
RPR_Main_OnCommand(SplitItems, 0)
if (timeSel!=0):
RPR_Main_OnCommand(SelectPreviousItem, 0)
RPR_Main_OnCommand(CrossfadeToTimeSel, 0)
RPR_Main_OnCommand(DeselectItems, 0)
if (selItems!=0):
RPR_Main_OnCommand(SplitItems, 0)
if (timeSel!=0):
RPR_Main_OnCommand(SelectPreviousItem, 0)
RPR_Main_OnCommand(CrossfadeToTimeSel, 0)
As you can see, you just insert your py code as you would in any script, but indented.
For the less experienced users reading this, just insert your standard script under with undoable('Split item(s)'): and be sure to indent your whole script one level.
|
|
|
04-16-2014, 06:36 AM
|
#55
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Thanks but it doesn't work
Still 2 undo points...
|
|
|
04-16-2014, 06:38 AM
|
#56
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
Really?? Weird.. I could swear it did. Maybe something's been broken again, the undo system for scripts has always been pretty unreliable.
I wish we could get a straight answer from Justin about exactly how to use it.
|
|
|
04-16-2014, 06:40 AM
|
#57
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Quote:
Originally Posted by daxliniere
Really?? Weird.. I could swear it did. Maybe something's been broken again, the undo system for scripts has always been pretty unreliable.
I wish we could get a straight answer from Justin about exactly how to use it.
|
Yes, unfortunately. I'm on Windows 8.1 64bit, Python 3.4.0
Please somebody give us a hand! Undo is absolutely critical workflow process...
|
|
|
04-16-2014, 06:43 AM
|
#58
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
Quote:
Originally Posted by Viente
Undo is absolutely critical workflow process...
|
Only if you make mistakes all the time/as part of your workflow. :P
Just kidding, I'm totally with you on this.
|
|
|
04-16-2014, 06:44 AM
|
#59
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Quote:
Originally Posted by daxliniere
Only if you make mistakes all the time/as part of your workflow. :P
Just kidding, I'm totally with you on this.
|
Undo is not only for fixing mistakes Trying different things and experiment, then go back if needed is essential
You know this
|
|
|
04-16-2014, 06:50 AM
|
#60
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by daxliniere
I can't remember who wrote this one (Tim, Breeder or spk77 I think), but it's not the standard one that you see all the time.
|
That would be Tim and spk77
Viente, are you seeing things like
Code:
- Undo point name created by script
- ReaScript: Run
I can confirm that. It seems Reaper will always create an additional undo point when running ReaScript :/
|
|
|
04-16-2014, 06:52 AM
|
#61
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Yes...this is sad
|
|
|
04-16-2014, 06:55 AM
|
#62
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
THe only solution so far is to put script inside custom action...which add clutter
|
|
|
09-03-2014, 12:02 AM
|
#63
|
Human being with feelings
Join Date: Jan 2009
Posts: 559
|
Quote:
Originally Posted by Viente
THe only solution so far is to put script inside custom action...which add clutter
|
Shameless threaddigger!
I have just tested this workaround and it INSANELY speeds up my reascripts (especially when the project contains loads and loads of grouped items). It's good to have this workaround.
You have just saved me a few hours a month, Viente!
|
|
|
09-03-2014, 03:22 AM
|
#64
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Guys, I think this is fixed in latest version
|
|
|
12-27-2014, 06:35 AM
|
#65
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
^ yes, the double undo point bug has been fixed some versions ago.
Now, just an update about the other "issue": the famous "ReaScript: Run" undo point (automatically created unless you create your own one), which would also mean that scripts can't turn off undo... In fact, they can! but it is not documented ATM (will do). So, if you don't want any undo point to be created the recommended way is to defer things. I mean like (EEL):
Code:
ShowConsoleMsg("Yo");
^ this will create a dummy undo point "ReaScript: Run" (*)
Code:
function run()
(
ShowConsoleMsg("Yo");
);
defer("run();");
^ this script won't create any undo point.
___
(*) I can confirm things are marked as dirty and an undo point is automatically created (UNDO_STATE_ALL).
We know this is both a convenience (no need to deal with undo within scripts, safer vs bad scripts, etc), or just like my example above, an inconvenience (wtf-undo-point that undoes nothing, uselessly mark projects as dirty, slight performance penalty for good scripts, etc) but since many scripts rely on this behavior now, we'll have to stick with it (not to break them).
Anyway, you have the choice now
|
|
|
12-27-2014, 06:55 AM
|
#66
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
|
Thanks a bunch, Jeffos.
|
|
|
05-20-2015, 01:34 AM
|
#67
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by Jeffos
^ yes, the double undo point bug has been fixed some versions ago.
Now, just an update about the other "issue": the famous "ReaScript: Run" undo point (automatically created unless you create your own one), which would also mean that scripts can't turn off undo... In fact, they can! but it is not documented ATM (will do). So, if you don't want any undo point to be created the recommended way is to defer things. I mean like (EEL):
Code:
ShowConsoleMsg("Yo");
^ this will create a dummy undo point "ReaScript: Run" (*)
Code:
function run()
(
ShowConsoleMsg("Yo");
);
defer("run();");
^ this script won't create any undo point.
___
(*) I can confirm things are marked as dirty and an undo point is automatically created (UNDO_STATE_ALL).
We know this is both a convenience (no need to deal with undo within scripts, safer vs bad scripts, etc), or just like my example above, an inconvenience (wtf-undo-point that undoes nothing, uselessly mark projects as dirty, slight performance penalty for good scripts, etc) but since many scripts rely on this behavior now, we'll have to stick with it (not to break them).
Anyway, you have the choice now
|
Jeffos, there's just one small corner case concerning this. If you use scripts that defer things from cycle action or macros, the order of execution gets messed up (because when the script is called, the real "meat" of it gets deferred to next timer call)
My guess is, we should simply call things immediately when script is executed, and then defer some kind of empty function instead to overcome this. Haven't tested it though, but I guess it should work.
edit: yep, it works.
I do it like this ( Main() being the function that executes whatever the script is doing):
EEL:
Code:
Main();
function NoUndoPoint ()(abs(0)); // Makes sure there is no necessary undo point created, see more
defer("NoUndoPoint()"); // here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
Lua:
Code:
Main()
function NoUndoPoint () end -- Makes sure there is no necessary undo point created, see more
reaper.defer(NoUndoPoint) -- here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
Python:
Code:
Main()
def NoUndoPoint (): pass # Makes sure there is no necessary undo point created, see more
RPR_defer("NoUndoPoint()") # here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
Last edited by Breeder; 05-20-2015 at 02:31 AM.
|
|
|
05-22-2015, 12:07 PM
|
#68
|
Human being with feelings
Join Date: Oct 2013
Posts: 77
|
Does this mean we can now make scripts that don't create any undo points?
Quote:
Originally Posted by Breeder
Jeffos, there's just one small corner case concerning this. If you use scripts that defer things from cycle action or macros, the order of execution gets messed up (because when the script is called, the real "meat" of it gets deferred to next timer call)
My guess is, we should simply call things immediately when script is executed, and then defer some kind of empty function instead to overcome this. Haven't tested it though, but I guess it should work.
edit: yep, it works.
I do it like this ( Main() being the function that executes whatever the script is doing):
EEL:
Code:
Main();
function NoUndoPoint ()(abs(0)); // Makes sure there is no necessary undo point created, see more
defer("NoUndoPoint()"); // here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
Lua:
Code:
Main()
function NoUndoPoint () end -- Makes sure there is no necessary undo point created, see more
reaper.defer(NoUndoPoint) -- here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
Python:
Code:
Main()
def NoUndoPoint (): pass # Makes sure there is no necessary undo point created, see more
RPR_defer("NoUndoPoint()") # here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67
|
|
|
|
04-07-2016, 12:30 PM
|
#69
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,268
|
is there a way to erase latest undo block from undo history?
for example let's say I do something like this:
Code:
reaper.Undo_BeginBlock()
reaper.TrackFX_SetPreset() -- creates Change FX preset undo point that I don't need.
reaper.Undo_EndBlock("my undo block", -1)
then I want to erase "my undo block" from undo history without doing Undo. I really need it to not flood the undo history with unnecessary undo points.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:19 AM.
|