Highly Requested APIs Added To The After Effects Scripting DOM Now Available In Beta!

New Here ,
Jul 22, 2021 Jul 22, 2021

Copy link to clipboard

Copied

Three new, highly requested APIs have been added to the Scripting DOM:

  • Layer.id,
  • Project.layerByID,
  • Property.essentialPropertySource,

All available in AE Beta versions 22x25 or newer.

 

Here's An In-Depth Look At Each API:

Layer.id

app.project.item(index).layer(index).id

 

Description

Instance property on Layer which returns a unique and persistent identification number used internally to identify a Layer between sessions. The value of the ID remains the same when the project is saved to a file and later reloaded. However, when you import this project into another project, new IDs are assigned to all Layers in the imported project. The ID is not displayed anywhere in the user interface.

 

Type

Integer; read-only.


 

Project.layerByID

app.project.layerByID(id)

 

Description

Instance method on Project which, when given a valid ID value, returns the Layer object on the Project with that given ID.

 

Parameters

name description

idA non-negative integer representing the ID of the Layer to be retrieved from the Project

 

Returns

Layer object with the given ID if it exists on the project; otherwise null. Non-valid IDs will throw an exception stating that the input parameter is not an unsigned integer.

 

Example

var firstComp = app.project.item(1);
var firstLayer = firstComp.layer(1);
var layerID = firstLayer.id;

if (app.project.layerByID(layerID) === firstLayer) {
    alert("You can get the Layer from the ID!");
}

 

Property.essentialPropertySource

app.project.item(index).layer(index).essentialProperty.property(index).essentialPropertySource

 

Description

Instance property on an Essential Property object which returns the original source Property which was used to create the Essential Property.

 

Type

Can return either:

  • A read/write Property object, in the case that the source object used to create the Essential Property was a Property,
  • A read/write AVLayer object, in the case that the source object used to create the Essential Property was a Media Replacement Footage item,
  • Or null if called on a non-Essential Property

 

Example

var firstComp = app.project.item(1);
var opacityProp = firstComp.layer(1).property("Transform").property("Opacity");

opacityProp.addToMotionGraphicsTemplate(firstComp);

var secondComp = app.project.item(2);
secondComp.layers.add(firstComp);

var essentialOpacity = secondComp.layer(1).essentialProperty.property(1);
if (essentialOpacity.essentialPropertySource == opacityProp) {
    alert("You can get the source Property from an Essential Property!");
}

TOPICS
Feedback

Views

722

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources