Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scripting: Change layer marker attributes

  • Scripting: Change layer marker attributes

    Posted by Peter Nepp on March 16, 2020 at 3:41 pm

    Hi there,

    I want to alter attributes of existing layer markers via ExtendedScript. But something like:

    app.project.item(50).layer(3).property("Marker").keyValue(1).comment = "New comment!";

    doesn’t work at all. I mean there’s no error message or something like this. But the actual value won’t change in the UI, and retrieving the value via script with:

    $.writeln(app.project.item(50).layer(3).property("Marker").keyValue(1).comment)

    after assigning a new one is returning the previous (unaltered) value instead. This is weird somehow. The documentation says these attributes on MarkerValue objects are “read” AND “write”. Did I get something wrong?

    Thanks,
    Peter

    Peter Nepp replied 6 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Walter Soyka

    March 16, 2020 at 4:41 pm

    You have to use .setValueAtTime(), with the time of the marker you want to change and a MarkerValue object to change it to. Try something like this:

    app.project.item(50).layer(3).property("Marker").setValueAtTime(app.project.item(50).layer(3).property("Marker").keyTime(1), new MarkerValue("New comment!"));

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Peter Nepp

    March 16, 2020 at 5:07 pm

    Hi Walter,

    many thanks, that did the trick.

    This is still a bit weird to me. ????

    Peter

  • Walter Soyka

    March 16, 2020 at 7:38 pm

    It is a bit weird. The documentation doesn’t make this super-clear, but markers are basically a special kind of keyframe, and keyframe values are set with .setValueAtTime(). Not only that, but markers use a MarkerValue object as their data type, so if you want to change the comment text, you have to do so by creating a MarkerValue object to contain the comment.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Peter Nepp

    March 17, 2020 at 12:06 pm

    Hi Walter,

    if this is the way to go, so be it. ☺

    My way to handle this conveniently:

    var ctrl = ....

    var marker = ctrl.property("Marker").keyValue(1);
    var markerTime = ctrl.property("Marker").keyTime(1);

    marker.label = 1;
    marker.comment = "New Comment!"

    ctrl.property("Marker").setValueAtTime(markerTime, marker);

    Thanks again,
    Peter

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