adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer
MIT License
691 stars 97 forks source link

Can't target a plugin's menu using the generateAssets action when started via CLI #132

Closed envex closed 10 years ago

envex commented 10 years ago

When running generator-core from the command line to develop a plugin, I'm unable to target the plugin's menu from the generate menu when using the provided sample code.

executeAction (app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO);

However, if I take my plugin and add it to the photoshop plugins/generator folder, it works like a charm.

Is it possible to target menu items that are started from the command-line?

joelrbrandt commented 10 years ago

@envex a couple of clarifying questions:

  1. Where are you running the executeAction code? In the extendscript engine? How are you triggering it?
  2. Can you tell me a bit more about what you're hoping to achieve? There might be a better way to do it.
  3. Where did you find this sample code?
envex commented 10 years ago

@joelrbrandt for sure!

  1. I ran the executeAction from both the ExtendScript Toolkit and an extension.
  2. We'd like a user to be able to stop and start our generator plugin from an extension. Right now I have a hacky way of doing it by creating a layer and listening for that layer name.
  3. Sample code from the wiki - https://github.com/adobe-photoshop/generator-core/wiki/Calling-Generator-Plugins-from-ExtendScript
marekhrabe commented 10 years ago

In my setup I avoided this integration problem by making my Generator plugin start normally with Photoshop (this is how plugins are intended to be used, right?) and I created socket.io server in node which I can then connect to in my html extension, so I can have fully custom "frontend" for my generator plugin. I just tend to avoid ExtendScript as much as possible when there are more elegant ways just in JavaScript.

Btw: recently released beta of Render.ly generator plugin went with totally same aproach of html panel communication—they use socket.io server too for that.

envex commented 10 years ago

@marekhrabe That sounds amazing -- do you have a example of the how socket.io connects to the extension?

marekhrabe commented 10 years ago

@envex I made a gist for you with some code that should give you right direction. Consider it a pseudo-code, I haven't run that actually, but the concept is exactly the same as in my app.

envex commented 10 years ago

@marekhrabe Thanks!

marekhrabe commented 10 years ago

@envex You're welcome, let me know when you build something :) btw: you should close the issue as the problem is not related to generator-core

umarniz commented 9 years ago

I am having the same problem as the op.

I can see from the generator architecture documentation why this is happening as photoshop creates a new menu section for each KVLR connection but i cant figure out the name of the section that photoshop assigns to my external generator-core.

I really need this functionality in my plugin and need it during development so any help would be greatly appreciated.

joelrbrandt commented 9 years ago

@umarniz Unfortunately, what you're looking for simply isn't possible. The "generateAssets" action that can be executed from extendscript only targets the built-in generator (and is intended to only be used for the asset generation feature). Given the intent of the feature, this is unlikely to be fixed.

I'd highly recommend going the route that @envex and @marekhrabe discussed above. In fact, the websocket server infrastructure has now been added directly to generator-core. See Generator.prototype.startWebsocketServer: https://github.com/adobe-photoshop/generator-core/blob/master/lib/generator.js#L1832

For an example of how to use the Websocket server in Generator (both from the plugin side and as a client), see this repo (especially the README): https://github.com/adobe-photoshop/generator-connection

Let us know if you experience any problems!

cc @iwehrman

umarniz commented 9 years ago

@joelrbrandt thank you for such a prompt response. I will work around the problem then.

I'll keep bumping you on issues I come across, cheers!