Hi there, I want to be able to update my panel UI whenever a guide is moved. If my memory serves me correctly, I think previously in Extendscript I managed to do this by listening to an event.
I’ve attached the event notifier but it looks like no event gets called when I move a guide.
I’d rather avoid having to update my panel UI every so often if possible. Any ideas?
I’m running Photoshop v23.2.2
However, I wouldn’t recommend this approach for a plugin you intend to distribute:
First of all it’s dependent on PS being in English, since other languages would have other history texts.
Also, historyStateChanged also fires when you do undo/redo for example.
Now that I think about it, you could also listen to a mosueup using the move tool via toolModalStateChanged, but that also wouldn’t be accurate in 100% of the events coming in. If you just need to check or update some state, it might be enough though.
Looks like a good solution but I didn’t manage to implement it yet, should I replace event name with “delate” and desc with _target?.[0]?._ref === “layer” ?
That is misleading. There are another ways to kill a layer. E.g. when you ungroup folder. It does kill the layergroup but it is not delete event. Or when you convert layer into smart object you do loose your original ID and it is replaced by new layer. Also plugins/Scripts can remove layers too but no usefull events are emited.
You’re right, the delete event alone doesn’t cover 100% of the cases where the layer (ID) gets removed, but I think it just depends on what @Adam is trying to achieve. If he just wants to show some warning when the user actively deletes the layer he uses for his plugin, that should be fine in most cases. Also he selects it by name anyways, which doesn’t change upon smart object conversion. Of course the plugin should check if the layer type is still correct then
I’m not sure about the performance impacts if a plugin just listens to all events to validate some state (e.g layer exists) - if every plugin does it that’s surely not the best