FORUMS: list search recent posts

Scripting: Change layer marker attributes

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Nepp
Scripting: Change layer marker attributes
on Mar 16, 2020 at 3:41:12 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


Return to posts index

Walter Soyka
Re: Scripting: Change layer marker attributes
on Mar 16, 2020 at 4:41:32 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Peter Nepp
Re: Scripting: Change layer marker attributes
on Mar 16, 2020 at 5:07:21 pm

Hi Walter,

many thanks, that did the trick.

This is still a bit weird to me. 😉

Peter


Return to posts index


Walter Soyka
Re: Scripting: Change layer marker attributes
on Mar 16, 2020 at 7:38:31 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Peter Nepp
Re: Scripting: Change layer marker attributes
on Mar 17, 2020 at 12:06: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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]