redefinery

Markers

This section describes how to work with markers (which are internally represented as keyframes). The following topics are covered:


Accessing Flash Video cue point fields for a layer marker

Layer markers include Flash Video cue point data. The existing MarkerValue object includes additional attributes and methods for accessing these new fields. If your scripts are simply setting or getting the old marker fields, you do not need to make any changes to existing scripts. It is only when you want to use the Flash Video cue point fields that you need to worry about the new attibutes and methods.

The following code shows how to add a marker with cue point data.

// given:
// layer = Layer object

// Flash Video cue point data
var markerStream = layer.property("Marker");  // access the layer markers
var myMarkerData = new MarkerValue("Flash Video cue point test");  // create MarkerValue object

myMarkerData.cuePointName = "trigger";        // cue point name
myMarkerData.eventCuePoint = true:            // event (not navigation) cue point
var cueData = new Object;                     // new object with custom names and values
cueData.fadeTime = 2;
cueData.fadeMode = "slow";
myMarkerData.setParameters(cueData);

markerStream.setValueAtTime(1, myMarkerData); // create new marker

Accessing composition marker data (workaround)

Composition markers are not accessible via scripting at this time. However, there is a workaround that uses expressions, which do have access to composition markers.

To access composition markers, first create a hidden text layer with the following type of expression on the Source Text property:

thisComp.marker.nearestKey(time).comment

This expression retrieves the comment for the marker closest to the current time. You can revise the expression as needed if you need the previous marker or some other marker.

Then, your script can refer to the Source Text property's value, as follows:

// given:
// layer = Layer object

var sourceTextProp = layer.property("ADBE Text Properties").property("ADBE Text Document");
var nearestMarkerComment = sourceTextProp.value;