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

Warp ?

Advocate ,
Feb 24, 2017 Feb 24, 2017

Copy link to clipboard

Copied

I can't locate any reference to the warp tool in the reference guide ?

TOPICS
Scripting

Views

1.7K

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

Valorous Hero , Feb 25, 2017 Feb 25, 2017

Do you mean the Warp effect? If so, you may be able to use the Live Effect scripting technique - for which you will need to try and decipher certain necessary information, as described here: Re: PageItem.applyEffect(LiveEffectXML)

Votes

Translate

Translate
Adobe
Valorous Hero ,
Feb 25, 2017 Feb 25, 2017

Copy link to clipboard

Copied

Do you mean the Warp effect? If so, you may be able to use the Live Effect scripting technique - for which you will need to try and decipher certain necessary information, as described here: Re: PageItem.applyEffect(LiveEffectXML)

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
Advocate ,
Feb 25, 2017 Feb 25, 2017

Copy link to clipboard

Copied

Yes, Warp effect.

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
Valorous Hero ,
Feb 26, 2017 Feb 26, 2017

Copy link to clipboard

Copied

Getting a scriptable Warp effect.

First, I save a very basic Illustrator document which contains one shape with whichever Live Effect is desired.

The document is saved with no compression and with as many unnecessary things turned off as possible: ICC Profiles are unchecked and PDF compatibility is unchecked. Next, the document is opened inside a text editor where you will find the text which constitutes an .AI document, and most likely it contains information about the live effect applied to the one shape which was originally placed in the document.

Screen Shot 2017-02-26 at 7.00.15 AM.png

This is a section of text where information about the Warp Tool is stored.

From here, the important string can be extracted:

/BasicFilter :

(Adobe Deform) 1 0 /Filter ,

1 /Visible ,

(Deform.aip) /PluginFileName ,

(Warp) /Title ,

/Dictionary : /NotRecorded ,

(Warp: Arc) /String (DisplayString) ,

0.449999988079071 /Real (DeformValue) ,

0 /Real (DeformVert) ,

0 /Bool (Rotate) ,

1 /Int (DeformStyle) ,

0 /Real (DeformHoriz) ,

; /Dict ;

Using the string, now can begin the efforts to transform this information into syntax as described by Carlos Canto here: https://forums.adobe.com/thread/1877476 .

'<LiveEffect name="Adobe Offset Path"><Dict data="R mlim 4 R ofst 20 I jntp 2 "/></LiveEffect>';

The 'name' seems to live under "/BasicFilter:" and all the pertinent info is somewhere in the block before a "/Dict;".

The data inside the .ai text is written in such an order:

  1. value
  2. data type
  3. name

In the LiveEffect XML syntax, they have got to be inside of a 'data' attribute, in this order with some extra transformation:

  1. first capital letter of data type
  2. name
  3. value

'<LiveEffect name="Adobe Deform"><Dict data="R DeformValue 45 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';

Now the string is ready to test.

#target illustrator

function test(){

  var doc = app.activeDocument; 

  var p = doc.selection[0]; 

  var effectStr_2 = '<LiveEffect name="Adobe Deform"><Dict data="R DeformValue 45 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';

  p.applyEffect(effectStr_2);

};

test();

The result: I did get a Warp effect, but it was at 100%. I needed mine to be at 45%.

Well that's because I made a little mistake and wrote "45" for the DeformValue - whereas the actual value is between a 0 and 1L "0.45". Having changed this bit, it now works.

Screen Shot 2017-02-26 at 7.28.27 AM.png

We shall see that the real working code is:

'<LiveEffect name="Adobe Deform"><Dict data="R DeformValue 0.45 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';

#target illustrator

function test(){

  var doc = app.activeDocument; 

  var p = doc.selection[0]; 

  var effectStr_2 = '<LiveEffect name="Adobe Deform"><Dict data="R DeformValue 0.45 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';

  p.applyEffect(effectStr_2);

};

test();

Screen Shot 2017-02-26 at 7.28.38 AM.png

There you have it, achieving a dynamic live warp effect using scripting!

If anything fails, in terms of unknown syntax for effects other than this one, post a question here on the forums and with enough luck, we may see the answer revealed to us by Carlos, as I did with my question about the Inner Glow - a syntax which contained nested elements. The gods have endowed him with great power.

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
Advocate ,
Feb 26, 2017 Feb 26, 2017

Copy link to clipboard

Copied

Sorry, I should have mentioned; not warp, rather the warp tool.  Is it the same procedure as warp ?

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
Valorous Hero ,
Feb 26, 2017 Feb 26, 2017

Copy link to clipboard

Copied

Oh you meant the tool ! Yea I completely mistook that part, unfortunately it just doesn't look like it's accessible to any scriptable technique, except maybe some programs which can execute their own mouse movements.

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
Advocate ,
Feb 26, 2017 Feb 26, 2017

Copy link to clipboard

Copied

Script listener type is what you mean ?

Otherwise, bummer

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
Valorous Hero ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Yea, I do not know too much about this area, but it's something I may want to get into so that I can make an example someday - here's a sample search result for Windows' AutoHotKey program: https://autohotkey.com/board/topic/43887-hold-click-mouse-moves-down/

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
Advocate ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

One can't even use a "listener" plugin in Illustrator and output the code used for the warp tool, arghh. 

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
Valorous Hero ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Certainly without such a plugin already in existence, I think.

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
Advocate ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

?

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
Valorous Hero ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

If someone made a plugin which can record and play the tools usage, maybe it would be possible, I'm not sure what Adobe would think about something like 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
Advocate ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Thanks SillyV, bummer.

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
Explorer ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

LATEST

Hello,

 

Thank you very much for your answer on this post regarding Live Effects. It certainly helped me since I can now warp my object. However, I still have a minor issue after using this tool. Namely, after warping, the shape of the object changes but the selection stays the same. I have a specified canvas size and therefore the selection may stay inside the canvas while the shape actually does not. Since my script also exports the PDF it therefore cuts off parts of the shape.

I have seen that using envelope distort updates the selection so that the entire shape is included after warping. However, I cannot find any way to apply the envelope distort warp other than this: 

app.executeMenuCommand("Make Warp");
Nonetheless, I need the whole process to be automatic so that does not help.
 
Another potential solution would be to update the selection so that it includes the full shape. I don't know how to do this either. If you have any ideas or solutions that would be very much appreciated! Thank you.

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