• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Generator-core getting started

Contributor ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

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. Script...

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!

TOPICS
Actions and scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Mar 20, 2016 Mar 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

Votes

Translate

Translate
Adobe
Enthusiast ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

Does it happen also if you drag with a mouse or do individual nudges (i.e. not holding down the arrow key)? Holding the key down is potentially one of those things you have to consider a bit: how do you handle it if events stack up or come late. I.e. one issue could be (if you process & write files) that you're not ready with previous event when the next arrives and something wonky happens. I've resulted in building an action queue, i.e. I process events and queue the actions  (checking if I have same kind of action already stacked up so I don't do same thing several times) and let that process a bit late.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

OMG i got it! The event coming through multiple times only if the moved layer have a .png,.jpg or .gif extension in it's name. It took approximately 4 hours for me to accidentally realize this. My fault, next time i'll study the whole generator-core source first, before asking something.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

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?).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

LATEST

What I use is the getting started tutorial:

GitHub - adobe-photoshop/generator-getting-started: Adobe Generator Getting Started Tutorial. Script...

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines