Align to Path
  • nice script , I will try it , thank you
  • Just trying this. However for me, the auto orient isn't working. The rotation just isn't happening.

    I tried creating a new simple comp - layer 1 with a rotobezier mask path, layer 2 a simple square. Linked them with your script and auto orient turned on - no joy.

    AE CC 12.1.0.168

  • Ooooh, I take that back - well a bit.

    It wasn't working until I added a keyframe on the 'Motion Path Complete' slider and now it is orienting. Maybe to do with the numkeys part of the expression? If no keys exist, auto rotate doesn't work?

  • Hi Paul,

    Yes, that is correct. Auto-Orient will only work once you have keyframes on the slider. I thought I had mentioned that fact in the docs, but I guess I missed it. Thanks for pointing the omission out.

    Adam
  • Docs - what are they ;)

    The other thing I just found is that if you accidentally turn on the layer's auto orient to path feature, it seriously messes with the expressions! I was scratching my head for a bit wondering why the layer would suddenly flip 90 degrees on the Y axis - until I remembered I had turned auto orient on when trying to troubleshoot the previous problem!

    Right - going to read the docs now!! ;)

  • Yeah, I originally had the script working by using the Auto-Orient feature, but it ended up failing in some cases that had more than one motion path along with a couple details I can't remember right now. So I recreated the auto-orient in the expression and it worked better. It's not too surprising that Auto-Orient would conflict with the custom expression.

    Glad you got it working again.
  • One thing that's missing that would make this script absolutely great is an update button. So when making a change to the mask path (as would happen a lot), pressing a button would update the null rather than having to reapply the script and then delete the extra null and controllers.

    Even better, an automated update or live update would be great if possible?
  • That's a good idea. I'm not sure how easy it would be to get Live Update to work, but I think an update button on the script would be doable. I'll try to find some time in the next week or two to take a look at implementing it.
  • That would be great. Just buying the script now :)

    I think I'd use this script quite a bit :)

    Cheers,

    Paul
  • Hi Adam,

    Did you get a chance to have a think about an update button? using the script on a few projects now - update would be very useful :)

  • Hi Paul,

    Yes, I have gotten it working. I was planning on uploading it today or tomorrow.
  • Oh excellent - any chance of an early version at all? I'm working on the paths right now and it would be incredibly useful :)

    For a future possibility - is it possible to do the same align to path but on a shape layer path? or is that a completely different ball game?

    Cheers,

    Paul.

  • Oh, on another topic - if the layer that has the mask on is scaled, align to path doesn't work properly - can that be fixed? Not sure if that was a limitation in the docs at all?
  • I'm not sure about the shape layer path, I'd have to look into it.

    The update will probably happen tonight, but I can't post it here. It will be under the normal place where you can download updates.
  • As for the layer scaling, yes that is a limitation, and it's mentioned in the docs :)

    The best work around is to scale the mask, not the layer.
  • Is that the same for layer masks in 3D space?

    I was hoping to create a layer, rotate along X axis to line up to a ground plane and animate a null along it so I can attach a camera to create a camera rig but the path is just drawn in 2D orientation. Can that then be rotated?

    3D support would be even more awesome!

  • Yeah, it's the same issue for masks in 3d space.

    What you could do, would be to set up the path, and then drag the composition into a new composition, and make the original comp a 3d layer. That would let you rotate it, but I'm not sure if you would be able to use the camera as you want to.

    One thing to make sure you don't do, is pre-comp the composition that has the controllers in it. That will break the expressions. This will be fixed in the update, however.
  • OK thanks - will need to re-think how I do it then.

    Would you consider adding 3D support for the future?

  • Yeah, absolutely. It might be a while until I can take a look at that though.
  • OK thanks - maybe in time for the next project then.

    If you could also look at support for scaled layers too, that would be great.

    Thanks.

  • Actually, I have a solution for your 3d question. But you need to make a few tweaks to your comp after the script is run.

    Here's the steps:
    1. Unlock the motion path null that the script created
    2. Change the Follower, Path Layer, and Null to 3d layers
    3. Add a new 3d null
    4. Parent all layers to the new 3d null
    5. Edit the position of the Follower layer to be 0,0,0 (just click on the position value and you should be able to change it)
    6. Now rotate the new 3d null, and you should be able to update the path like normal

    I've attached a screen grab to help explain what I'm talking about
    align-to-path-3d_example.jpg
    817 x 238 - 101K
  • Oh cool thanks Adam.

    Let me try that now...

  • will that work with your new update feature - i.e. the motion path nulls wont get deleted and re-created will they?
  • Yeah, it will work. The motion path nulls stay where they are
  • This script has now been updated! You are now able to update a path after you have attached an object to it. See the description or included docs for more information. Enjoy.
  • Thanks Adam!

    Will give it a go.
  • Adam,
         This is very close to the solution I've been looking for except I'd want the ability to have the object follow the selected paths in the order selected. i.e. it follows path_1 100% then switches to path 2 then to path 3 etc. I realize I could set that up with this script but if I want 100's of paths, I would want it done automatically. 
  • Hi Keven,

    That's a good idea. I think with some reworking of the script it should be possible. I'll try to find some time and see if I can incorporate it.
  • Well, that took quicker than I thought.

    The script is now updated with the ability to automatically animate sequentially through all your masks. Enjoy!
  • Hi Adam,

    Your script looks amazing... but it doesn't seem to work on french version of After Effects. I tried it on CS6 and CC, the expression isn't applied.
    No problem with english version of After Effects.

    Cheers,

    Benoit
  • Hi Benoit,

    Thanks for letting me know. I'll find some time this week to fix that and get an update ready.

    Adam
  • The script has now been updated and should work on non-English versions of After Effects. Please let me know if you have any issues with the update.

    Adam
  • Hi Adam,

    Unfortunately I can't let you know if it works because you don't update the trial version. ;)

    By the way, nice responsiveness!

    Benoit
  • Ok, the trial version is now updated. Thanks for letting me know.

    Adam
  • Hi Adam,

    The updated version doesn't work either.
    The expression isn't applied.

    Benoit
  • Hmm, ok. I'll dig a little deeper and see if I can figure out what's going on.

    Adam
  • This script has now been updated again to work on international versions. I found a small bug in the most recent update which prevented it from applying expressions, but it has now been fixed. So please try version 1.6

    Adam
  • Works like a charm Adam!
    Nice work.

    Benoit
  • I just got this script and it works well, my only problem is that when I duplicate the comp, and try to edit the mask in the new comp it wont update that one. is there an easy way to do that?   

    Thanks
  • Hey Andres,

    I'll take a look at the Update part of the script, and see if I can fix that up so it works.

    Adam
  • I select my layers and a mask.
    I click Align to Path(s).  
    Null gets created, but no control sliders appear. 

    Mac - English - After Effects CC2015 13.7.1.6

    What could I be doing wrong ?



  • I select my layers and a mask.
    I click Align to Path(s).  
    Null gets created, but no control sliders appear. 

    Mac - English - After Effects CC2015 13.7.1.6

    What could I be doing wrong ?



    I narrowed it down: it happens only if I check "Keep Position Offset"


  • "Auto-Orient to Path" makes my layer spin instead of orienting it. Is there some trick I'm missing ?


  • Hi Marc-Andre,

    I'm sorry you're having trouble with this. I'll take a look at it the first chance I get and see if I can narrow down the problem.

    Adam
  • Hi Marc-Andre,

    Can I just clarify the exact steps you're taking when you run the script so I can narrow down the problem?

    Here's the steps that should work (regardless of if you have "Keep Position Offset" checked or not)

    1. Select the layer you want to attach to the path
    2. Add to your selection a mask on a second layer
    3. Click Align to Path

    Are those the steps that you are taking?
  • Hi Adam,

    yes these are the steps. And they do work as long as I don't check "Keep Position Offset".


  • Hmm, ok. That's strange then.

    Would you mind opening up a support ticket for this? That way I can give more specific help to try and figure out what's going on.

    Thanks,
    Adam
  • When I select to auto-align to path, the object seems to glitch and it'll randomly twitch its rotation while moving along the path. Also it'd be nice to have a button to remove all alignment effects and expressions. Thanks.
  • Hi Nick,

    Sorry you're having an issue. What frame rate is your composition that is glitching?

    Are you talking about a button to permanently remove all effects, or more like an animated checkbox so you can disable/enable the alignment when you need?

    Adam
  • Auto orient isn't working for me either. There is no glitch and no other problem, but I cannot get auto-orient to work at all.

    Also, is there no way to get it to attach to a mask layer that has been rotated? Not a huge deal, just curious. I saw your work-around for 3D space, and it's working perfectly for me on that! I just wondered if I wanted to stay in 2D, and rotate the mask layer.

    I wish I had found this script before my last project - it would have saved me literally hours of time! If I can get Auto-Orient to work, I will be over the moon!

    Thanks!