Skip to main content
varxtis
Inspiring
January 21, 2019
Beantwortet

Can one put a group of layers into independant precomps?

  • January 21, 2019
  • 2 Antworten
  • 10966 Ansichten

I have a crap-load of layers that each need to be in their own precomp. Is there any way, script or plug-in, that would allow me to select a group of layers from the time line and make it so each of those layers get into their own precomp?

    Beste Antwort von Dave Merchant

    Im sorry it took so long to respond. I finally had a chance to try this, but I get the error

    "Unable to execute script at line 8. undefined is not an object"

    Line 8 is:

    if (thislayer.selected) selectedLayers.push(i);

    I have the comp selected. I have nothing but the shape layers im wanting to pre-compose in the comp, and I have them all highlighted/selected before running the script.

    Since it's a script and not an expression, I don't think I have to define an index number/range, so im at a bit of a loss on whats goin' on here.


    Sorry, missed a line when I pasted:

    var moveAllAttributes = true;
    var laycol = app.project.activeItem.layers;


    // first cache the array of layer selections, starting at the bottom
    var selectedLayers = new Array();
    for (var i=laycol.length; i>0; i--) {

        var thislayer = laycol;
        if (thislayer.selected) selectedLayers.push(i);
    }


    // now precompose them individually
    for (var s=0; s<selectedLayers.length; s++) {
        var thislayer = laycol[selectedLayers];
        var precomp_name = thislayer.name;
        laycol.precompose([selectedLayers],precomp_name,moveAllAttributes);
    }

    2 Antworten

    JCIOM
    Participant
    April 3, 2025

    i know its a long time since this question but i created a plugin that can do this> precomps each layer to their own precomp.. while trimming it to the duration of each layer,, its free,, check it out...

    jciomkenya precomposehelper 

    Community Expert
    January 21, 2019

    You can group by color labels and then pre-compose.

    Pre-composing this one simple keystroke. I know of no way to write a script that automatically selects Different groups of layers unless you have already group layers by color, but, on the other hand, if layers are out of order or you can’t precomposed them anyway.

    Maybe I do not understand what you’re trying to do but shift select and the keyboard shortcut seems like a lot less trouble than digging for a script and then running It.

    varxtis
    varxtisAutor
    Inspiring
    January 21, 2019

    First off, thank your for your time and your response.

    So, lets say you have a comp with 20 shape layers in your timeline. Thats all, just 20 shape layers. You can select all 20, and put them into one precomp. Or, you can go one by one and put each of them in their own precomp.

    I have a lot more than 20 and I need each of them to be in their own precomp. Going one by one seems very inefficient, and will take a long time. I figure there has got to be a way to select all 20 (going back to the example) and telling After Effects to put each one of the selected layers in its own precomp.

    P.M.B
    Legend
    January 22, 2019

    Start a new comp

    Add a small rectangle as a shape layer

    Add this expression to the layer's opacity property:

    seedRandom(1);

    wiggle(3, 60)

    Duplicate the solid 3 or 4 times and offset the position so you can see all of them

    Preview the comp

    All layers will change opacity 3 times per second between 100% and 60% in unison.

    Here's the comp: Dropbox - Uniform Wiggle Opacity.aep

    If you are not getting the same wiggle in all layers then there is something else going on in the comp. My suggestion would be to put a master slider in the comp on a controller null and name it Random Opacity. Link the opacity of all layers to that slider, then apply your wiggle expression to the slider. You have just decreased the complexity of your composition by a factor equal to the number of layers you are controlling - 1. IOW - If you have 200 layrs you have decreased the complexity of the comp by a factor of 199.


    I think the problem they're having is that the wiggles ARE in unison.  The post says that the wiggles were randomized (which is what they wanted) but for some reason when they put all the layers into their own compositions they began wiggling in unison (which they do NOT want)

    ~Gutterfish