Copy link to clipboard
Copied
I'm automating Photoshop and have implemented a simple feature that involves fading the top layer of the active document in and out, repeatedly by changing its opacity from a timer's tick event.
The key bit of code that I use to change a layer's opacity is:
ActiveDocument.ArtLayers(layer).Opacity = opacity
This works well except that it fills the history with opacity state changes.
Is there a way to avoid having the opacity change step recorded in the history or a way to remove the last step recorded?
Thanks.
Copy link to clipboard
Copied
I'm not sure why you want to repeatly turn the opacity on and off, but if you don't want your history staty filled, why don't you record a snapshot of your history state then when you're done, go back to that state, or which ever state you want to finish on?
Copy link to clipboard
Copied
A snapshot will still fill the history with a lot of opacity changes( and wipe out any of the user's history ).
Your code looks like some flavor of VB. I don't know if it is available there but javascript has a suspendHistory method. That would limit the historyStates created by the script to one. And that assumes the opacity changes are being made during one running of the script. If the timer is running the script multiple times I don't think there is any thing you to do to save the history except dupe the document and make the changes on the dupe.
Copy link to clipboard
Copied
Thanks. It is vb.net using the photoshop interop dll. There doesn't appear to be a suspendHistory property for the Photoshop.Document object. Oh well.