Copy link to clipboard
Copied
I have a script UI with a dropdow menu filled with layer names. My script generates new layers and those are added to the dropdown menu. But if the user perform an undo(menu command or keyboard), the layers get removed from the composition, but remain in the dropdown. I would need an event handler for the undo to call a function that updates the dropdown. Any ideas? There are ways to listen to the keyboard events but how about the menu command?
Cheers.
Copy link to clipboard
Copied
I don't think that's feasible. The undo queue is just that - a linear list in the base app. It has no way of knowing what you do inside your script. ultimately the operation would simply be redoable outside the script once it has been fired. It would probably make more sense to restructure your undoGroup and which functions need to be inside and which ones outside the loop. The most straightforward approach likely is to not even have an official undo and handle it all inside the script.
Mylenium
Copy link to clipboard
Copied
Thanks for the quick reply. I was afraid that it would be impossible to do. I'll have to figure it out some other way, or just add a simple button to update the dropdown.
However, I was reading the documentation and about registering new event handlers for the window object and came up with this: