Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER General Discussion Forum

Reply
 
Thread Tools Display Modes
Old 05-24-2023, 01:53 PM   #1
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Location: earth
Posts: 472
Default Random "ReaScript: Run" undo state, losing redo states!

I'm not sure what ReaScript is causing this. How can I figure it out?

I don't have any scripts running that are in an active/deferred state (listed at the bottom of the Actions menu). Scripts like that which monitor the project state (e.g. automatically selecting tracks of selected items whenever item selection changes) have caused a lot of headaches in the past, so I stopped using them.

But still, there's some script that is somehow being run run occasionally that pops up this "ReaScript: Run" entry at seemingly random intervals in the undo history, and if I have made any undos to check/possibly change something I did, it will wipe out the undo states so that I can no longer hit redo to get back to the most recent edit I made - REALLY annoying when this happens!

Hopefully someone here knows a way to figure out what is causing this.
earhax is offline   Reply With Quote
Old 05-24-2023, 04:49 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Perhaps you're running a script within a custom action?
nofish is offline   Reply With Quote
Old 05-24-2023, 05:14 PM   #3
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Location: earth
Posts: 472
Default

Quote:
Originally Posted by nofish View Post
Perhaps you're running a script within a custom action?
Possibly, but most of what I use are scripts with specific undo state descriptions. And since it doesn't seem to happen often, just once in a while when navigating the cursor, triggering playback, or doing some other stuff that normally wouldn't set an undo state, I can't figure out which action/script could be the cause of it.
earhax is offline   Reply With Quote
Old 05-25-2023, 03:51 AM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,823
Default

What version of REAPER are you running?

Complicating the behavior you are seeing is that there are some actions (possibly native, possibly extensions) that change the project's undo state without adding a correct undo point. Once that has happened, running any reascript creates a "cleanup" undo point that will include the previous undo changes, even if the reascript itself does not change the project state at all.

In the undo history window, if you right-click on an undo entry and choose "undo state information", you can get some very specific information about what exactly the undo point contains, which may help you narrow down what is causing these undo entries.
schwa is offline   Reply With Quote
Old 05-25-2023, 10:15 AM   #5
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Location: earth
Posts: 472
Default

Quote:
Originally Posted by schwa View Post
What version of REAPER are you running?

Complicating the behavior you are seeing is that there are some actions (possibly native, possibly extensions) that change the project's undo state without adding a correct undo point. Once that has happened, running any reascript creates a "cleanup" undo point that will include the previous undo changes, even if the reascript itself does not change the project state at all.

In the undo history window, if you right-click on an undo entry and choose "undo state information", you can get some very specific information about what exactly the undo point contains, which may help you narrow down what is causing these undo entries.
Thanks, schwa. I'm not at my computer right now, but I do recall looking at the undo state info a number of times when this has happened. IIRC, there was generally only one simple change, which I believe was something like the following (without including the other unchanged code surrounding the part that changed):
Code:
- SEL 0
+ SEL 1
AFAIK, this relates to an item/track being selected that wasn't previously. However, when I see this happen, if I hit undo/redo, I see no change to the currently selected tracks/items. So IDK why it's showing up like it is if there was no change to any selection, unless it was something like you mentioned with the undo state "cleanup". But I wish REAPER would only handle these cases when there were no undo states ahead of the current one (i.e. nothing I could redo, or more importantly, could lose the ability to redo).
earhax is offline   Reply With Quote
Old 05-26-2023, 12:10 PM   #6
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Location: earth
Posts: 472
Default

Here's a sample of one that shouldn't be happening since I've disabled undo state being set for almost all UI and navigation changes in preferences.

Code:
<TRACK {D5E5E246-92D3-3B43-9F2A-08B2DF93D78B}
...
     SHOWINMIX 1 0.660377 0.5 1 0.5 0 -1 0
     SEL 1
     REC 0 5088 0 2 0 0 0
     VU 2
-    TRACKHEIGHT 16 0 0 0 -1 0
+    TRACKHEIGHT 31 0 0 0 -1 0
     INQ 0 0 0 0.5 100 0 0 100
     NCHAN 4
     FX 1
Looking at the undo state info, the case is the same for what looks like every track in my project (although, the values for the -/+ TRACKHEIGHT are different for a lot of the tracks). This time, the "ReaScript: Run" undo state occurred after I did a marquee item selection, and ran the script "X-Raym_Select only tracks of selected items.lua"

Considering these actions only select items and then the tracks associated with them, I have no idea why the project state is showing track height changes when there were none that occurred.

However, later on, I saw another "ReaScript: Run" in the undo history. Again, the state seems to have been changed for what appears to be every track in the project.
Code:
 <TRACK {6359A8A0-8FB5-9C4B-9CAA-BF26E98E38FE}
...
     PLAYOFFS 0 1
     ISBUS 0 0
     BUSCOMP 0 0 0 0 0
     SHOWINMIX 1 0.660377 0.5 1 0.5 0 -1 0
-    SEL 0
+    SEL 1
     REC 0 5088 0 2 0 0 0
     VU 2
     TRACKHEIGHT 16 0 0 0 -1 0
Coincidentally, this time it was the -/+ SEL change undo state issue.

So now I'm wondering: if a script runs using reaper.defer(), does this leave the script running passively somehow until the next script/function is run without being deferred, at which point the deferred function/script changes are pushed to the project file (or simply just added to the undo history)?

Maybe this is the kind of thing schwa was talking about? But still, IDK why any track height changes would create an undo point based on my preferences.

Also, I just checked which version I am running.

v6.54+dev0421a/OSX64 rev bc169c

I know it's a bit old, but so am I. And that has resulted in becoming a strong believer in avoiding upgrading anything until/unless I absolutely need to because something is failing catastrophically.
earhax is offline   Reply With Quote
Old 05-26-2023, 12:42 PM   #7
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,823
Default

Quote:
Originally Posted by earhax View Post
Also, I just checked which version I am running.

v6.54+dev0421a/OSX64 rev bc169c

I know it's a bit old, but so am I. And that has resulted in becoming a strong believer in avoiding upgrading anything until/unless I absolutely need to because something is failing catastrophically.
Ah, well, that TRACKHEIGHT undo bug specifically was fixed in version 6.76 I think. It's worth installing the latest version to see if your problem is fixed -- you can install it to a different folder from your existing REAPER install, if you are reluctant to commit.
schwa 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 10:05 AM.


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