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

Generator events question

Engaged ,
Aug 17, 2015 Aug 17, 2015

Hi again, I have another question!

I'm using imageChanged event (brush tool basically) in Generator to fire jsx-file with some document tweaking, the problem I have is that tweaking in jsx are also registered as imageChanged event.

Is there a nice way to ignore what's happening in jsx? (I guess timer is the worst because I'm not sure how much time will my jsx function take). Do I need to make a callback from jsx or maybe there's an event from using Brush tool?

Thanks

TOPICS
Actions and scripting
547
Translate
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
Adobe
Enthusiast ,
Aug 17, 2015 Aug 17, 2015

Basically you should keep track of document id's either by

  • allowing user to explicitly select documents you manage
  • store ids of open documents (see Generator.getOpenDocumentIDs()) at the time of starting your jsx
  • keep track of new documents from the delta having added=true

Then ignore all events from documents created during your jsx

Translate
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
Engaged ,
Aug 19, 2015 Aug 19, 2015

I'm sorry I'm not sure I follow. I'm working with one document, imageChanged event dispatches when active document changes and I want to ignore active document changes from my jsx so imageChanged wouldn't go in infinite loop

Translate
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 ,
Aug 19, 2015 Aug 19, 2015
LATEST

Not sure either anymore. My understanding was that your JSX is changing/creating docs that causes issue for your Generator plugin that would think user is doing something and would need to fire the JSX again. Because of that my suggestion was that you need logic to detect if doc changes are caused by your jsx or by the user.

But I don't understand why JSX needs to ignore active doc changes since it's the cause of the changes, right? While jsx is running, user can't change anything.

Translate
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