Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Attaching null script that jumps null above new parent, then…..

  • Attaching null script that jumps null above new parent, then…..

  • Ralph Moreau

    June 15, 2022 at 2:33 pm

    Hi everyone,

    Need some help in finishing my script. I have a script that when I select multiple layers and run the script. It will bind all layers to the null. But now trying to have the parenting null jump above the last selected layer, and match the layers duration. I made a test one separate from my working script. I get this error: “Unable to call “setParentWithJump” because of parameter 1. 3 is not of the correct type. Here is the code so far:

    if (comp instanceof CompItem){

    props = comp.selectedProperties;

    var layNum = comp.selectedLayers[0].index; // number of designated chosesn layer

    var selLay = comp.layer(layNum); // actual layer object with the proper index.

    var inLay = comp.layer(layNum).inPoint;

    var outLay = comp.layer(layNum).outPoint;

    var inOutlay = Math.abs(inLay - outLay);

    var newNull = comp.layers.addNull([inOutlay]).moveBefore(selLay);

    $.sleep(1000)

    comp.layer(layNum).setParentWithJump(layNum -1);

  • Dan Ebberts

    June 15, 2022 at 3:12 pm

    I think setParentWithJump() is throwing the error because it’s expecting a layer object as its argument, and you’re giving it an index.

  • Ralph Moreau

    June 15, 2022 at 3:24 pm

    Thank you Dan, will try to figure it from here

  • Ralph Moreau

    June 15, 2022 at 4:19 pm

    So I fixed it for now. But is there a way of properly setting the inPoint of the new null to match the current layer? I got it to match the duration, but can’t seem to target the null layer to set the inpoint.

  • Dan Ebberts

    June 15, 2022 at 4:32 pm

    I’m not sure exactly what you’re trying to do, but sometimes you just need to move a layer’s startTime to get it to line up with another layer’s inPoint. Sometimes you may need to manipulate both startTime and inPoint (in which case, always do startTime first).

Viewing 1 - 5 of 5 posts

Log in to reply.

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