Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script-Pick Whip?

  • Posted by Jacob Danell on February 3, 2014 at 10:07 pm

    Hi! I’m trying to create a pick whip in AE Scripts but can’t make it to work.
    I want to achieve this expression:
    thisComp.layer('RealCameraMovement').transform.position+value
    but the only way I have found working is by hardcoding the expression like this in the script:
    selectedLayer.property("position").expression = "thisComp.layer('" + scriptName + "').transform.position+value";
    But this way, if the user later change the Null-object(the nulls name-variable is scriptName) the expression doesn’t update like if I would have made this inside AE.
    Are there any way to create a pick whip in AE scripts so if the Null is later renamed the expression still works?

    Thanks!

    Jacob Danell replied 12 years, 3 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    February 3, 2014 at 11:54 pm

    Try switching the way you use ‘ and ” so that the expression ends up with double quotes defining the null’s name, like this:

    selectedLayer.property(“position”).expression = ‘thisComp.layer(“‘ + scriptName + ‘”).transform.position+value’;

    Dan

  • Jacob Danell

    February 4, 2014 at 10:52 am

    Didn’t work =/ Guessing it’s nothing that is able to be done trough scripting.

  • Dan Ebberts

    February 4, 2014 at 4:43 pm

    I don’t think it has anything to do with scripting. If you pickwhip this expression:

    thisComp.layer(“Layer 1”).transform.position

    and change it to this (replace double quotes with single quotes like your script uses):

    thisComp.layer(‘Layer 1’).transform.position

    the expression won’t update when you change the name of Layer 1.

    Dan

  • Jacob Danell

    February 5, 2014 at 1:05 pm

    I tried as you said, chainging ‘ to ” and ” to ‘ so the script applied
    selectedLayer.property("position").expression = 'thisComp.layer("' + scriptName + '").transform.position+value';
    The code in AE looked like this:
    thisComp.layer("nullControll").transform.position+value
    and after tried to change the name of the null, the name didn’t change in the expression

  • Dan Ebberts

    February 5, 2014 at 6:15 pm

    Interesting. It works fine for me. What version of AE?

    Dan

  • Jacob Danell

    February 11, 2014 at 9:15 am

    I found the problem… My script exedently created two layers with the same name and there is where the problem happened. Than’s Dan for the help!

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