Skip to main content
Inspiring
June 20, 2015
Question

Expression Evaluation Issue in CC 2015

  • June 20, 2015
  • 2 replies
  • 1477 views

Hi,

I have a script that applies the sampleImage expression to a layer in order to find its boundaries. In all previous versions of After Effects, this script could evaluate a layer in less then a second. In AE CC 2015, the script was failing completely. I found the problem was that the value of the applied script was not being updated fast enough.

In order to get things working i have to add a half second delay each time the expression is changed, so a function that used to take half a second now takes almost 2 minutes.

Has anyone came accross any similar issues or have any ideas for fixing the problem without hurting the performance so much?

Thanks,

Jesse

This topic has been closed for replies.

2 replies

Known Participant
October 6, 2016

Hi,

I know this is kinda old thread but I just encountered this issue as well.

I wrote a script with a bi-section sampleImage loop that scans a layer for the alpha channel value to find its bounds.

This script works perfectly and in literally 0 milliseconds in After Effects 2014 CC.

In AE 2015 (any version including the most recent one), I get the an AE internal error and a sorry!  Haven't debugged this thoroughly yet but I'm sure it has everything to do with the new way in which sampleImage is processed asynchronously and I the script doesn't get the correct results when harvesting the sampleImage expression value.

Did you manage to overcome this issue in AE 2015? Is there a way to force run sampleImage synchronously?

using .sleep(1000)  is not an option because that means the scripts takes around 2 minutes per layer because of the sampleImage loop.

I can't figure out why would someone ever need an asynchronous sampleImage anyway... This should maybe be a boolean parameter passed to sampleImage...

I found this thread that addresses the same problem:

Re: Problem with sampleImage in After Effects CC 2015 (Extendscript / Expressions)

but I thought I'd check here first to see if you managed to solve this in 2015 versions.

Thanks

Roy.

Dan Ebberts
Community Expert
Community Expert
June 20, 2015

Just curious--what does the expression look like?

Dan

Inspiring
June 20, 2015

var theArray = thisComp.layer("theLayer").sampleImage([960,540],[960,50], true, time);

Dan Ebberts
Community Expert
Community Expert
June 20, 2015

So you've got a loop looking at comp-wide, 100-pixel strips of the layer, looking for non-zero alpha? If you get a hit, then you zero in at finer precision--something like that? So how many times do you have to apply the expression and harvest the results to get the info you need? I assume the target layer is not text or shape because you're not using sourceRectAtTime(), is that correct?

Dan