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

Redraw not working in pixel preview mode?

Engaged ,
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

A recent update of Adobe Illustrator kinda broke my script.

My code:

$.setTimeout('redraw', Number(dialog._time.text));
// Extend ExtendScript's functionality:
$.setTimeout = function(name, time) {
    // Pause the loop for `time`.
    $.sleep(time); // Unfortunately this is a blocking function; there are not alternatives as of June 2015.
    app[name](); // Call passed `Application` function by name string.
};

I use setTimeout to loop over layers in a document.

Up until recently this code was working in pixel preview mode.

Now, it appears that app.redraw() only works when not in pixel preview mode.

Can anyone confirm if app.redraw() works in pixel preview mode? Basically, I just want to show/hide one layer at a time using a specified pause time.

This also doesn't work when in pixel preview mode (code condensed for readability):

for (i = 0, il = doc.layers.length; i < il; i++) {
    $.sleep(dialog._time.text);
    app.redraw();
}

I really need this to work in pixel preview mode.

Oh, this does work:

$.setTimeout('redraw', Number(dialog._time.text));
alert('this alert makes the document refresh the view as the layers show/hide');

I'd love some assistance/feedback/advice/tips on this one.

Thanks!

Micky

TOPICS
Scripting

Views

1.1K

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

Community Expert , Nov 20, 2015 Nov 20, 2015

What version of illustator did you upgrade to and which one did you have before? What operating system?

I'm on Mac OSX El Capitan with Illustrator CC 2014 (version 18.0.0) and app.redraw(); works fine for me in pixel preview. here's the test function i ran..

function test(){

  var docRef = app.activeDocument;

  var item = docRef.pathItems[0];

  for(var a=0;a<5;a++){

      item.top = item.top - 50;

      app.redraw();

  }

}

test();

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 20, 2015 Nov 20, 2015

Copy link to clipboard

Copied

What version of illustator did you upgrade to and which one did you have before? What operating system?

I'm on Mac OSX El Capitan with Illustrator CC 2014 (version 18.0.0) and app.redraw(); works fine for me in pixel preview. here's the test function i ran..

function test(){

  var docRef = app.activeDocument;

  var item = docRef.pathItems[0];

  for(var a=0;a<5;a++){

      item.top = item.top - 50;

      app.redraw();

  }

}

test();

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
Engaged ,
Nov 20, 2015 Nov 20, 2015

Copy link to clipboard

Copied

Hi William!

Thanks so much for your reply and help, I really really really appreciate it.

Ok, here's the scoop. I tried my script on my work late 2011 iMac, Yosemite, Illy 19.1.0, and my script worked!

I tried the same test file on my late 2011 Macbook Pro and it still doesn't work. I even reset Illustrator prefs using command + option + shift.

With that said, I just tried your script (thanks for the test code) ... On a new doc, I created a single square object with white fill with black stroke, ran your script, and all I see is the square moving from start point to end point, with no inbetweens (click to view animated gif):

illy-test.gif

This is driving crazy!

The only thing I can think of that could be affecting my system is my graphics card capabilities? Not sure if this means anything, but after resetting Illy, I see:

Screenshot 2015-11-20 18.57.54.png

Here's what my GPU prefs look like:

Screenshot 2015-11-20 18.59.46.png

Other than that, I am not sure what could be different about my system (although, I do have several plugins installed).

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
Community Beginner ,
Nov 20, 2015 Nov 20, 2015

Copy link to clipboard

Copied

Well, this is annoying.

I completely re-installed Illustrator and deleted all plugins/extensions.

Same problem.

William, I did notice something new. Your script would only work properly when not using pixel preview mode via "GPU" preview.

I think this started happening after upgrading to El Capitan.

Screenshot 2015-11-20 21.50.40.png

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
Community Expert ,
Nov 23, 2015 Nov 23, 2015

Copy link to clipboard

Copied

interesting. I'm on El Capitan as well and i haven't noticed any issues with any of my scripts. However, I should note that I am still using Illustrator 18 (because my art department noticed a smorgasbord of issues when our first few test subjects upgraded to 19. So I can't really speak to any of those issues regarding your exact setup and a potential connection between OSX 10.11.

My only other suggestion is maybe to try a setInterval/setTimeout to give the engine some room to breathe between loop executions? I really doubt it will work, but i guess if nothing else is working, everything is worth trying.

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
Community Expert ,
Nov 23, 2015 Nov 23, 2015

Copy link to clipboard

Copied

well scratch that. apparently ESTK doesn't have any native timer at all.. i've never had to use an interval or timeout yet, so i had no idea that functionality wasn't available...

Sorry Micky, I'm stumped. One last ditch effort, have you tried turning off your GPU performance setting? Does that make any difference?

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
Engaged ,
Nov 27, 2015 Nov 27, 2015

Copy link to clipboard

Copied

LATEST

Hi William!

Sorry for my late reply. Also, thanks so much for you help, I really appreciate it!

I did try turning off GPU. It didn't seem to make a difference.

So, looks like I'm going to write a new script that allows me to cycle layers on a button click. I'm hoping that controlling the layer cycling in this way will force the app to refresh on my system.

A part of me wonders if I were to buy a new computer if the problem would go away. My mac is getting older.

On the other hand, I think modifying the script will be a good workaround.

For what it's worth, this is the script I wrote that's having issues:

pixelfoot/illy-anim · GitHub

I'll post an update to this thread with my new script (that is, if it works out).

Thanks again for all of your help, I greatly appreciate it!

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