Old 04-10-2020, 05:48 AM   #1
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 532
Default Undo and Proj ExtStates...

Hi guys,
I have Script A which changes the pitch of items and save the amount in a ProjExtState

Then Script B Shows that ProjExtState in a GUI.
It works great but the problem is if I undo Script A, then the ProjExtState is not undone which leads to Script B not showing the right value.

How can I include my ProjExtState change in the undo cycle? It's already in the undo loop in my code.
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 04-10-2020, 11:45 AM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 2,130
Default

Afaik no, so it's probably a case for a bugreport.
__________________
Use she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you want
mespotine is offline   Reply With Quote
Old 04-10-2020, 12:42 PM   #3
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,185
Default

Maybe your script could have a "Previous_Ext_State" variable and have an undo button for the script? Not ideal... but may help?

Cheers,

Andrew K
__________________
Cheers,
Andrew K
v6.03+dev0114 - January 14 2020 • Mac 10.12.+ • i7 Quad 2.9GHz • 24GB
Thonex is offline   Reply With Quote
Old 04-10-2020, 04:09 PM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 2,130
Default

I thought about that too, but you don't know, if undo happened in the first place so you don't know, when to read the former one.
Even if you could, undoing it twice would mean, you'd need the two former projextstates, undoing three the three former ones, etc.

So it wouldn't work as a workaround unfortunately.
__________________
Use she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you want
mespotine is offline   Reply With Quote
Old 04-10-2020, 04:46 PM   #5
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 532
Default

I’ve decided to find a way to read the pitch from the items without having a need to the extstates. It’s gonna be simpler that way.
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 04-10-2020, 04:58 PM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,171
Default

Quote:
Originally Posted by lexaproductions View Post
Hi guys,
I have Script A which changes the pitch of items and save the amount in a ProjExtState

Then Script B Shows that ProjExtState in a GUI.
It works great but the problem is if I undo Script A, then the ProjExtState is not undone which leads to Script B not showing the right value.

How can I include my ProjExtState change in the undo cycle? It's already in the undo loop in my code.

Script A is a deferred script? How do you undo? Using Reaper's undo (CTRL+Z) or an undo button in your script?


You could save the previous value along with the new one in Script A and add an Undo button on your Script B that resets to the previous value. It's up to you how many undo states you want to save.
Code:
pseudocode for 3 undos for example


Script A
if  undoextstate2 then undoextstate3 = undoextstate2 end
if  undoextstate1 then undoextstate2 = undoextstate1 end
current_value = undoexstate1
set current_value
amagalma is offline   Reply With Quote
Old 04-10-2020, 05:00 PM   #7
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,171
Default

Quote:
Originally Posted by lexaproductions View Post
I’ve decided to find a way to read the pitch from the items without having a need to the extstates. It’s gonna be simpler that way.

We should have asked you what were you trying to do in the first place! :P
It was so easier!


Code:
 reaper.GetMediaItemTakeInfo_Value( take, "D_PITCH" )
amagalma is offline   Reply With Quote
Old 04-10-2020, 06:33 PM   #8
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 532
Default

Quote:
Originally Posted by amagalma View Post
We should have asked you what were you trying to do in the first place! :P
It was so easier!


Code:
 reaper.GetMediaItemTakeInfo_Value( take, "D_PITCH" )
Well I would’ve preferred to use extstate instead iterating through media item to find a value I could’ve easily predict
It makes the code way more complicated for nothing.
But it’ll work.
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 04-10-2020, 11:18 PM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,171
Default

Set in ExtState take guids, then get them and get their pitch
amagalma is offline   Reply With Quote
Old 04-11-2020, 04:29 AM   #10
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 532
Default

I e never used GUIDs before. I’ll look it up.
Thanks!
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions 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 06:03 AM.


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