adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

imageChanged event stops dispatching

zimag opened this issue · comments

commented

I was desperate when imageChanged events stopped arriving ( looked like ) randomly. The only cure was to save the document which turned on the events again. Finally I realized that the Timeline Panel's animation frame chages causing this. The solution was to watch CSEvents containing 'animationFrameClass' and instantly save the doc. Which is a workaround but obviously not a perfect solution.

I am using generator-core ( unofficially ) from a HTML panel.

Is it a PS bug or solvable via JS or appearing only on my unsupported setup?

PHXS 18.1.1 Windows 7 64-bit, "generator-core": "3.8.3"

@zimag I don't immediately know what is causing the behavior you are seeing. But we are planning to phase out reliance on the imageChanged event in our generator-assets plugin, and recommend other generator plugin developers do the same. You can still listen for the event, but we'll begin logging a warning when you do. The issue is that the event is extremely non-performant and can effect photoshop responsiveness. If you would like to discuss alternate approaches, please comment with some details of how you are currently using this event.

commented

@mcilroyc I am usin this event to determine when do I need to fetch the full docInfo. Later by comapring the old and the new docInfos I can decide which image assets must regenerate.

My dream is a pixelsChanged event, which would eliminate thousands of difference recognition lines from my source code. This simple and comprehensive event would tell us if any color or alpha value changed in any pixel of the layer.

I don't want to know the change in a shape layer's path's anchor's forward handle. I need to know olny is there any visible difference.

:)

commented

I have found another case when the event isn't firing.

Tranform_Glasses_NoEvent_728x90_ADWORDS.zip

glassesBlack_NotFiringImageChanged is the layer which is non casting the event on transform.

Best Regards

@mcilroyc I can confirm this same issue persist when any sort of actions is done as a part of redo
process in PS CC 2019. Simple reproduction steps:

  1. Create new document in PS
  2. Create new layer and fill it's content (or draw)
  3. Remove the layer (imageChanged is fired)
  4. Undo using shortcut - CTRL (CMD) + Z // imageChanged is fired
  5. Redo using shortcut - CTRL (CMD)+ Z // imageChanged is NOT fired

After opening History panel in PS and playing around with history - it seems to work fine and it also fixes history shortcuts undo/redo for that session.

Since you're planning on removing "imageChanged" event, is there any other that we can hook onto? I'm having the same dream as zimag above - something like pixelsChanged event would be awesome!