Skip to main content
oliverIntergrafika
Inspiring
March 20, 2016
Answered

Generator-core getting started

  • March 20, 2016
  • 1 reply
  • 1475 views

I decided to upgrade my extension with real time asset exporting, with the help of generator-core.

I have installed, configured everyting and dowloaded the:

GitHub - adobe-photoshop/generator-getting-started: Adobe Generator Getting Started Tutorial. Scripting Photoshop with J…

The generator-getting-started-master is crashing when I try to CTRL+T (transfrom) a layer with the following message: Error trace: TypeError: Cannot read property 'id' of null at Generator.handleToolChanged... If I comment the Tool handling out it is working fine.

But I have one Question: Why the "imageChanged" event is firing only once when I nudge a layer with the Move tool? It dispatching only at the first cursor key press.

Or two:

Is there a dedicated forum about generator?

Thanks a lot!

This topic has been closed for replies.
Correct answer matias.kiviniemi

I recommend to start with printing all event data to console and see what you're getting in different scenarios. For example imageChanged can have a multitude of different shapes from file save to reordering to content changes. On element move it should fire on "every nudge" (I checked my code), you might have some other issue.

There is also a Google Groups forum which I've used mainly for bug reporting.

Google Groups

1 reply

matias.kiviniemi
matias.kiviniemiCorrect answer
Legend
March 20, 2016

I recommend to start with printing all event data to console and see what you're getting in different scenarios. For example imageChanged can have a multitude of different shapes from file save to reordering to content changes. On element move it should fire on "every nudge" (I checked my code), you might have some other issue.

There is also a Google Groups forum which I've used mainly for bug reporting.

Google Groups

oliverIntergrafika
Inspiring
March 20, 2016

Hi Matias,

Thanks for the Google group address!

Do you have any idea what can be an other issue? I have no clue. I am trying to fix this behaviour since hours without success. As I remember the imageChanged event worked fine at first. I was able to print out the strigified document with changing bounds at every cursor keypress.

I have tried to install the whole stuff on an other machine. Reinstall the latest nodeJS, redownload the latest generator-core. No success, the event only coming at the first time. I have no clue....

I will ask my friend to check out this problem, because I think its a mysterious virus in my gigabit switch

oliverIntergrafika
Inspiring
March 21, 2016

That sounds really weird... So "generator" is actually several things:

  • Node.js server built into the Photoshop CC that runs everything
  • Generator Node-app developed by Adobe that implements basic Node-Photoshop integration like the event system and import/export of pixel data
  • Assets-plugin for Generator Node-app developed by Adobe that implements the auto export of PNG's (this is what users see as "generator")
  • Your plugin for Generator Node-app

What you describe sounds like the Assets-plugin, it's feature is that you can name a layer like "foo.png" to get it automatically exported. And your plugin should have nothing to do with it (except maybe the example you started with starts from that?).


What I use is the getting started tutorial:

GitHub - adobe-photoshop/generator-getting-started: Adobe Generator Getting Started Tutorial. Scripting Photoshop with J…

without the Image Asset Generation Plug-in for Generator:

https://github.com/adobe-photoshop/generator-assets

This asset generator isn't running. Just the vanilla generator-core-master with only one plugin which is the generator-getting-started.

In this scenario, if I move a layer without a "valid" extension in it's name, the imageChanged event dispatching only the first time. Until I select another layer, or do something else. While the movements of layers with an asset extension in their names, dispatching the imageChanged event multiple times.

I would like to export an .html beside the image assets ( on the fly ), which requires the non-asset layers position.