Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions copy markers from layer markers to comp markers

  • copy markers from layer markers to comp markers

  • Dan Ebberts

    April 22, 2020 at 3:32 pm

    This should work:


    function CopyLayerMarkersToComp(){
    var theComp = app.project.activeItem;
    if ((theComp == null) || ! (theComp instanceof CompItem)){
    alert ("No comp active.");
    return;
    }
    if (theComp.selectedLayers.length == 0){
    alert("No layer selected.");
    return;
    }
    var theLayers = theComp.selectedLayers;
    var theLayer;
    var theMarker = new MarkerValue("");
    var theTime;
    for (var i = 0; i < theLayers.length;i++){
    theLayer = theLayers[i];
    for (var j = 1; j <= theLayer.property("Marker").numKeys; j++){
    theTime = theLayer.property("Marker").keyTime(j);
    theMarker = theLayer.property("Marker").keyValue(j);
    theComp.markerProperty.setValueAtTime(theTime,theMarker);
    }
    }
    }
    CopyLayerMarkersToComp();

    Of course only one comp marker can exist at a given time, so if two selected layers have markers at the same time, the layer selected last wins.

    Dan

  • Simone Maldini

    November 5, 2020 at 5:05 am

    Hi Dan, i am new in expression and it is the first time that i write and apply a script. i found your script for move markersLayer to markersComp. I need to change the target: create a compMarker for each inPoint layer selected that i have in the comp. I tryed to change your script but the new one works only for the first selected layer.

    Can i ask you to help me understanding where is the error and how can i fix it?Thank you very much.

    var theComp = app.project.activeItem;

    var theLayer = theComp.selectedLayers[0];

    var theTimes = [];

    for (var i = 1; i <= theComp.numLayers; i++){

    theTimes.push(theLayer.inPoint);

    }

    for (var i = 1; i <= theComp.numLayers; i++){

    theComp.layer(i).selected = false;

    }

    for (var i = 0; i < theTimes.length; i++){

    theComp.time = theTimes[i];

    app.executeCommand(app.findMenuCommandId(“Add Marker”));

    }

  • Dan Ebberts

    November 5, 2020 at 8:03 am

    It’s easier to do now that scripting has access to comp markers. Something like this should work:

    var theComp = app.project.activeItem;

    var theLayers = theComp.selectedLayers;

    var theMarker = new MarkerValue("");

    for (var i = 0; i < theLayers.length; i++){

    theMarker.comment = theLayers[i].name;

    theComp.markerProperty.setValueAtTime(theLayers[i].inPoint,theMarker);

    }

  • Shashank Raghu

    September 21, 2021 at 11:49 am

    Hi Dan, is there a way to copy markers from one layer and move them to another layer?

  • Andrei Popa

    September 21, 2021 at 12:36 pm

    Here is a script made by Jeff Almasol, that could be downloaded from his website, redefinery.com, when it was not offline.

    https://www.dropbox.com/s/2adn48jkkpaqyus/rd_CopyMarkers.jsx?dl=0

Viewing 21 - 25 of 25 posts

Log in to reply.

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