PDA

View Full Version : Custom tools and undo


animatorgeek
03-22-2010, 10:28 AM
Does anyone have experience with custom tools? I'm working on one that doesn't draw anything in the document, just rotates and/or moves what's already there. The problem is that when I use it and then press undo, I can only go stepwise through all the steps the tool took in its scripting. This means that one use of the tool ends up producing something like twenty entries in the history panel, not just one. Not only that, but when I do go through the undo process the document often ends up different than how it started! (Seems like a big bug in the undo system -- I may report it through Adobe's bug reporting system)

Does anyone know a way to control the undo system from JSFL? I really want to make it so that each use of this tool will count as one history item, in the same way that running a command from the commands menu creates one history item. As it is now, without an easy undo of what this command does, it doesn't end up being very useful.

jslice390
03-23-2010, 04:20 PM
This is definitely an interesting topic. I've been creating a few tools and have run into similar issues with undo/redo. I can think of a hackish way to get the job done, by storing some metadata in the document and then using the keyDown() to check for Ctrl-Z to revert to the data saved in the document... but that gets messy and it doesn't handle undo's called by the menu.

I'd be really interested to know if you're able to find anything out about this issue. Until then I'll keep pouring through Adobe's documentation. Good luck.