So, I’m surprised I can’t find this on the web, but I’m trying to write a script to essentially precompose selected layers like you would manually by Ctrl/cmd+Shift+C, selecting to move all attributes and adjust the composition to the time span of the selected layers.
But alas, it doesn’t seem to behave like the manual steps in AE.
It takes layer(s), Pre-composes them and sets the in/out point of the layer in the original comp, but does not trim the content of the resulting comp to the in/out points of the layer(s). Instead it retains the full length of the parent comp unlike when you Ctrl/cmd+Shift+C, selecting to move all attributes and adjust the composition to the time span of the selected layers.
What would be the best way to go into the resulting pre-comp, and making the work area (trimmed) to the in and out points of the layers so it behaves more like the manual process?
New to extendscript so please forgive me if I’m overlooking the obvious.
Hey Chris, I just checked that script, and my questions are, assuming that pre-comp is built, and is auto-added in the main comp, and with these sample conditions:
Main comp length: – 60s long;
1st layer in point – starts at 10s;
xth layer out point – ends and 40s;
Now when script executed:
1. Would you prefer that ‘pre-comp’ actually would have its start point at the area where current in point belongs? Because now, pre-comp turns out to be the same length as main comp, but in/out points are trimmed to 1st and xth layers times.
2. Accordingly, in this sample above, pre-comp shall turn out to be 30s long instead, or not necessarily this way?
From what I see, and how I like things to be pre-composed, is that every pre-comps starting layer, would begin at 0s, instead of matching main-comp length. Is this is the same behaviour you are after?
Thanks Tomas, yes, I wanted the generated precomp to be trimmed to the length of the layer(s) chosen, much like the behaviour if you Ctrl/cmd+Shift+C, selecting to “move all attributes…” AND select to “adjust the composition to the time span of the selected layers”.
That said, in lieu of any feedback I managed to figure it out. There are still a couple of bugs, but I will post the solution here once it’s cleaned up.