Store undo queue into string array?

Store undo queue into string array?

Anonymous
Not applicable
465 Views
2 Replies
Message 1 of 3

Store undo queue into string array?

Anonymous
Not applicable
Any ideas on how to grab the undo queue and store the individual items into an array?

"undoInfo -q -pq" will only output the queue into the script editor window but the items are not storable.

I've discovered this undocumented "repeatLast" command. There may be some use with "repeatLast -q -cnl" but that outputs a lot more than just the undo queue. Perhaps there is a way to filter out anything that's not part of the undo queue...?
0 Likes
466 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
After some collaboration, I have found a solution. The solution is to output the contents of the Script Editor window into a text file, then read the text file and store the lines into a string array (or textScrollList).

The pseudo code would be something like this:

Enable writeHistory and write to a particular .txt file on the hard drive.
Clear the history
undoInfo -q -pq;
Disable writeHistory
Open the file and store each line into an array
Close the file

My end goal for all this is to create an "Undo List" similar to 3ds Max's method of undo'ing. In Maya, if you have to undo several times back you have to just undo undo undo undo undo undo undo undo blah blah blah... And you have to pay attention to what you're undo'ing so that you don't go too far. It is much better to just be able to "see" where you want to undo to, and then one click later you're done. I am working on a script that will be done soon. I'll post the link here when it's ready...
0 Likes
Message 3 of 3

Anonymous
Not applicable
The script is done and available to download here:

http://www.creativecrash.com/maya/downloads/scripts-plugins/interface-display/c/maya-visual-undo-lis...

It works very nicely!
0 Likes