Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Parent Vertex to Layer

  • Parent Vertex to Layer

    Posted by Cbleslie on January 28, 2007 at 4:39 am

    Hey!
    First off; greetings! This is my first post here, and knowing my luck it won’t be my last. Regardless, your forum (I’ve been lurking for some months) and your tutorials have been quite helpful, I hope to give that same help/credit back someday.

    Now for the question:
    I was wondering if it’s possible to parent a vertex (Multiple vertexes?) of a mask to a layer? The reason I ask is I would like to treat the parented layer as sort of a controller for the points of the mask.

    It seems like it would be a useful in many situations, and I am surprised that adobe (if they haven’t already) has yet to implement such a feature.

    c.b.leslie

    Haro, haro.

    Cbleslie replied 19 years, 6 months ago 4 Members · 7 Replies
  • 7 Replies
  • Iancorey

    January 28, 2007 at 6:43 am

    [cbleslie] “I was wondering if it’s possible to parent a vertex (Multiple vertexes?) of a mask to a layer?”

    You want to assign a parent to a point in a mask? Not possible.

    What would be the purpose, if I may?

  • Mike Clasby

    January 28, 2007 at 8:35 am

    Like Ian said, it would be nice to know what you want to do.

    You can control mask vertices with a script from harmdanpath, named RotAE.jsx, you can find it here:

    https://del.icio.us/escruz/Rotoscope

    The only problem is that the script needs keyframes (from the tracker for the intent of the script, roto work), but anyway of getting keyframes, like a wiggle expression, then Animation>Keyframe Assistant>convert expression to keyframes, and you can apply these new keyframes to the mask vertex, as it’s done here:

    https://forums.creativecow.net/cgi-bin/new_read_post.cgi?forumid=2&postid=891545

    So what do you want to do, if you can make keyframes you can control the vertices of a mask.

  • Mike Clasby

    January 28, 2007 at 9:24 am

    I didn’t mean to give the impression that you need tracker keyframes or expreswsions converted to keyframes to make the script work. After you run the script, then select the mask and click “Apply Tracker” you get a new Traccker with track points that correspond to each vertex of the script (as many track ponts as vertices). And later (after you’ve made a track with the track points, you click “Apply Mask” and the vertices are now linked to the track points.

    But you don’t have to use the tracker, if you generate keyframes by dragging a layer around over time, by motion sketch, or in any manner, just copy/paste them into the “Attach Point” of the tracker that corresponds to the vertex you want to control. Any keyframes will do.

  • Mylenium

    January 28, 2007 at 1:35 pm

    [cbleslie] “I was wondering if it’s possible to parent a vertex (Multiple vertexes?) of a mask to a layer? The reason I ask is I would like to treat the parented layer as sort of a controller for the points of the mask.”

    No. The workarounds the others suggested is your only option.

    [cbleslie] “It seems like it would be a useful in many situations, and I am surprised that adobe (if they haven’t already) has yet to implement such a feature.”

    Any speculation on Adobe’s development policy is beside the point. It’s unproductive and if you are really feeling not comfortable with AE, then ask yourself if it is the right tool for the job at hand. It’ not that there are other tools on the planet, is it? *hint,hint* ;o) I know it sucks, but there’s nothing you can do about it.

    Mylenium

    [Pour Myl

  • Cbleslie

    January 28, 2007 at 5:22 pm

    It sort of hard to explain. What I was planing on doing was something like the link to the image below. (the stuff in the image is simulated of course.)

    https://www.cbleslie.com/nur/aearm.gif

    So basically, the null boxes would be the angle and position controllers bound to the mask’s vertexes making a sort of… well, really dynamic arm. Boy I hope I’m making sense.

    Haro, haro.

  • Mike Clasby

    January 29, 2007 at 1:25 am

    Buckle up, this is a long post, but it does what you want, two different ways, and I’m glad you asked because I can use this myself. An individual vertex of the mask is controlled by a layer, a small white solid’s positon, the soild as a child in the first way, and independently the second way.

    Overview: The control boxes you want will be controlling the mask vertices via the RotAE.jsx script I gave in an earlier post. Small White Solids will be positioned over the vertices, they’ll be parented to your Control Boxes, then via an expression that ties the Attach Point of Track Points (needed for the Roto Script) to the anchor point of the children, you’ll convert the expression to keyframes then apply those to the mask, and have your “really dynamic arm”. Also there is a simplier alternative to your Controls Boxes at the bottom, animating each vertex independently.

    First you need to download the Script from the link I gave before, and put it in you Scripts folder in AE.

    On a layer that is the same size as the comp, I drew a mask (Pen Tool) the same shape as your mask. I started at your top right vertex (this will be track Point 1) then went in a counter clockwise direction, closing the mask back at the top right where I started. I used the convert vertex Tool to make the mask straight edged. I used fill to make the masked area green. It is important the layer is comp size as we’re going to use an expression later that finds a child’s position in comp space … toComp().

    File>Run Script>RotAE.jsx

    Select the mask, then In the Script’s Control Panel, click “Apply Tracker”. This gives you a new “Tracker 1” with Track Points 1-6, one for each vertex of the mask. If you double click Tracker 1, you will bring up the layer showing where all the 6 track points are positioned over your mask vertices. So 3 and 4 will be your left “Null Box”, 2 and 5 your center Null Box, and 1 and 6 will be your right Null Box.

    So to make your Control Box, I made a 10×10 White Solid, and moved it over the Track Point 1 (the first vertex). You might want to lock the mask below so you don’t grab it by mistake.I lowered the opacity so I could center the solid’s anchor point exactly on the vertex. The anchor points will control the ends of each control box. I dupped the white solid, renamed it White Solid 2 and put it over Track Point 2, make a new solid for each Track Point. Unlock the mask below.

    Now to make the control box (and parent the little white solids above to them), I made a Blue solid, rename it Left Box (hey, the blue went with your green) 10×80 (it fit), and positioned it over the two left white solids, Track Points 3 and 4. I had to rotate it 2 degrees to fit over the 2 points. I made a Center Box (points 2 and 5, -3 degrees rotation) and a Right Box (1 and 6, -4 degrees rotation).

    Now I parented Solids 3 and 4 to the Left Box. Now if I rotate and/or reposition the Left Box, the anchor points (which will be connected to the mask vertices via the Track Points) will also move. I did the same parenting for Center Box (2 and 5 are now children) and Right Box (the parent of 1 and 6).

    Now we just need to tie the anchor points to the Trackers via expressions.

    Twirl down the Tracker 1 (in the layer with the mask, to Track Point 1, twirl again to reveal the Attach Point. Alt Click the Attach Point and add this expression:

    C = thisComp.layer(“White Solid 1”);
    childPosition = C.toComp(C.anchorPoint);

    This expresson is needed to find the location of the solid’s anchor point in relation to comp space(because it’s a child).

    Now change the “White Solid 1” to “White Solid 2” so this expression goes on Track Point 2’s Attach Point:

    C = thisComp.layer(“White Solid 2”);
    childPosition = C.toComp(C.anchorPoint);

    Do the same for Solids 3-6 to their corresponding Track Point Attach Point expressions. The numbers correspond so it’s pretty straight forward, just a lot of twirling and pickwhipping.

    Now you can shy all the layers except for you top three, Right Box, Center Box and Left Box.

    “P” and “R” reveals the three layer position and rotation, set keyframes and animate over time (sorry the mask won’t update automatically, we’ll have to Convert Expression to keyframes before we can change the mask. But you can animate the Control Boxes as much as you want.

    Then, select the layer with your mask and “ee” reveals the expressions, select all the expressions, then, Animation>Keyframe Assistant>Convert Expression to Keyframes.

    “M” reveals the mask, select it and select Tracker 1, then in the Script Control Panel click “Apply Mask”.

    Done.

    Note, if you didn’t want your “Control boxes”, you could just animate the 6 vertices via the 6 white solids, and with an expression made by merely pickwhipping the Track Point Attach Point to the Position of the corresponding Solid, getting an expression on the Attach Point:

    thisComp.layer(“White Solid 1”).position

    You don’t need the toComp expression becuase the White Solid’s arent children here, so when you position the White Solids, you should place the upper left corner of the White Solid on the vertex (where the Position is from, I believe. You see this expression uses Position,not anchor poin)

    Then just animate the position of the White Solids 1-6 over time.

    Again you need to match the “White Solid #” to the # of the Track Point. Anyway, this is a faster setup and more flexible than your Control Boxes as you can animate each vertex independently. Again, you’d need to Convert Expressions to Keyframes and “Apply Mask” via the Script’s panel.

  • Cbleslie

    January 29, 2007 at 1:37 am

    Thanks. This is a step in the right direction! Much thanks. 🙂

    Haro, haro.

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