Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE/ExtendScript: Composition not showing up content after change duration

  • AE/ExtendScript: Composition not showing up content after change duration

    Posted by Junior Ramos on April 14, 2021 at 3:28 pm

    Hi.

    I have a script that configures my project and sets the compositions and the duration of their content.

    But when a layer it’s another comp, the duration for the comp itself and for its contents are changed, but the content is not showing up after the initial duration length.

    For example: by default, my project has a duration = 10s.
    When I run the script the duration is set to 14 minutes.
    Despite the extension of the comp get the timeline length (14m), its content only shows until 10s.

    Does anyone know what might be the problem?

    Thanks in advance.

    Junior Ramos replied 5 years, 1 month ago 4 Members · 6 Replies
  • 6 Replies
  • Andrei Popa

    April 16, 2021 at 7:04 am

    Are you sure all the layers in the composition are also extended? And you have no time remap on any of the elements?

  • Robert Womack

    April 16, 2021 at 2:19 pm

    I’m not sure if I understand your question, but if you’re extending the length of the Comp, you’ll need to loop through the layers and set the outPoint of each layer to the new length of the Comp. If you’re already doing that, can you provide a more concrete example, maybe posting the script?

  • Tomas Bumbulevičius

    April 16, 2021 at 6:09 pm

    In addition to what Robert wrote – if the layer in your comp is “Comp layer”, when you need to update that comp’s duration AND layers lengths as well. Otherwise – you won’t be able to set outPoint of it. Unless, timeremapping is applied to comp-type layer.

  • Junior Ramos

    April 16, 2021 at 8:31 pm

    Yes. All the layers are extended also, ad I’m not using time remapping.
    And the problem occurs only with comp layers that already exist in the project or the timeline when I tried to extend the duration.
    If I create a comp by script setting the duration, it works normally.
    And is recreating the comps via script what I’m doing as a workaround for this.

    Below is the method that I use to loop through all the layers inside a comp.

    function setLayersDuration(comp, durationValue){
    comp.duration = durationValue;
    comp.startTime = 0;
    comp.outPoint = comp.inPoint + durationValue;
    for(var j=1; j<=comp.layers.length; j++){
    var layer = comp.layers[j];
    if (layer instanceof CompItem){
    $.writeln('we have a CompItem');
    // layer.source.duration = durationValue;
    layer.source.duration = durationValue;
    } else {
    $.writeln('we have a layer');
    layer.outPoint = layer.inPoint + durationValue;
    }
    }
    }
  • Andrei Popa

    April 17, 2021 at 9:07 am

    Your function here has some mistakes. It does not go through the layers inside a comp if it finds one, it does not modify the length of the layer source aswell as the layer itself if it finds a comp. I have made some small changes. This worked for me.

    function setLayersDuration(comp, durationValue){
    comp.duration = durationValue;
    comp.startTime = 0;
    //comp.outPoint = comp.inPoint + durationValue;
    for(var j=1; j<=comp.layers.length; j++){
    var layer = comp.layers[j];
    if (layer.source instanceof CompItem){
    $.writeln('we have a CompItem');
    // layer.source.duration = durationValue;
    layer.source.duration = durationValue;
    layer.outPoint = durationValue;
    setLayersDuration (layer.source, durationValue)
    } else {
    $.writeln('we have a layer');
    layer.outPoint = layer.inPoint + durationValue;
    }
    }
    }

  • Junior Ramos

    April 17, 2021 at 8:58 pm

    Hi Andrei.

    It worked.
    Besides using the method recursively for the case of CompItem, I think that the thing is to set the layer outPoint for the CompItem layer.
    But it still weird, because for that case I was setting the outPoint for my comps before calling the method.
    Thanks for the help anyways.

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