Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Force script evaluation and update

  • Force script evaluation and update

    Posted by Brecht Debackere on February 25, 2012 at 4:15 pm

    Hi,

    I am currently working on a project using a textfile to read parameters into after effects. This works quite well, with one exception:
    While the script reads the contents of the file and sets the correct parameter, this only happens when the script is evaluated (i.e. on every frame). When I change the contents of the textfile and move to the next frame, the new value is used. When I move back to the previous frame however the previous value is still stored… There are no keyframes so this value is apparently stored somewhere else.

    A workaround is: put the play-head at the beginning of the clip, and press ‘[‘. While this seems to update all the values to the new ones in the textfile it is hardly the most elegant way of doing things.

    Now, my question is whether there is another way to ‘force’ after effects to update the value which it stored somewhere? Also, is there a way to continuously evaluate an expression of the current frame?

    Dan Ebberts replied 14 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 25, 2012 at 4:25 pm

    It’s probably a caching issue. Once AE has rendered a frame, it will use that image unless you change something but it probably wouldn’t detect that you changed the text file. You should be able to force an update with Edit > Purge > Image Cache Memory, but I can’t think of any way to do it continuously.

    Dan

  • Brecht Debackere

    February 25, 2012 at 11:40 pm

    That makes sense… I’ll look around for an alternative; I’ll post post the reason for it later on once I finished setting everything up, maybe that’ll explain things better and might trigger some other ideas.
    Thank you for the clarification.

  • Brecht Debackere

    April 8, 2012 at 5:08 pm

    OK. I’ve finally had time to set everything up and it seems to be working, though not efficiently due to the posted after effects script issue.

    Here’s what I wanted to do: use a midi controller for color correction or other effects tweaking.

    1. I’ve set up a midi controller in Max/Msp. It registers the knob turns and writes the parameters to a file.
    2. I’ve set up After Effects to read the contents of the file; adjusting the appropriate parameters of the effect.

    Now, as I mentioned before, the problem is not that after effects is not reading the file, it’s that it’s not updating the viewer, unless you move to a next frame (or previous, generally one that has not been processed yet and is thus not cached)

    As a work-around, I’m triggering an AppleScript from Max/Msp which sends after effects the following ‘key presses’: [ to place the layer in-point at the current time. This seems to re-evaluate the script, reading in the new values. Works wonderfully.

    This of course is problematic, as it means it would only allow for an effect to be changed at the in-point of a layer, an not at another point in time, as the AppleScript would effectively move the layer…

    To circumvent this, I’ve used the ‘KeyEd Up’ script to remap the keyboard shortcut for ‘undo previous action’ (applescript can’t apparently not send the keycode for command-z or any command-combo shortcuts). This works aswell, as I see the layer jump back and forth when turning a knob on the midi controller.

    The main issue now is speed… as the moving of the layer and the subsequent undo action takes up too much time it becomes much less intuitive. So the question remains, but might be clearer now, which other possible commands would force after effects to re-evaluate the expression and not show the cached image…???
    Purge-all does not seem to have any effect whatsoever, as does disabling ‘use disk cache’ in the preferences…

  • Dan Ebberts

    April 9, 2012 at 3:36 pm

    I haven’t tried this, but maybe you could have a layer’s rotation property selected and send AE a “+” character (from the numeric keypad) to increment the rotation 1 degree. That might cause AE to rerender the frame.

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy