Page 1 of 1

recursively set composition lengths

Posted: August 2nd, 2010, 2:15 pm
by z00story
I thought I saw a script that did this a few years back on aescripts, but I can't seem to find it.

Say you have a layer, nested deep within a structure of pre-comps.

I want to select that layer, then hit a script to adjust the length of every parent comp to the length of that layer.

My problem is, I'm having trouble finding the code to select "parent" layers. While parent is quite common in javascript, that term seems to be reserved for layer parenting in AE.

Any tips?

Re: recursively set composition lengths

Posted: August 2nd, 2010, 3:17 pm
by lloydalvarez
It's not very straight forward, I would use the AVItem usedIn attribute on the parent comp, then on it's parent comp, etc.:

Code: Select all

app.project.item(index).usedIn

Re: recursively set composition lengths

Posted: August 2nd, 2010, 4:27 pm
by z00story
Thanks for this, I get it now.

Now I'm struggling with trying to make the arrays necessary to find every "usedIn" item. I need to go up through parents until there are no more parents, I also need to go "sideways" that is, find every usedIn[] array instance that is not undefined. I guess spanning both ways is confusing me...

Is this making sense?