After Effects CC (April 2017) In-Depth: Scripting Improvements

May 6, 2017 

Earlier this month we released version 14.2 of After Effects CC, which added many often-requested features as well as an exciting new workflow for sharing motion graphics.

In this article, we’re sharing more detail about new scripting access to text leading and Team Projects (Beta), the new Recent Script Files menu and keyboard shortcut, and bug fixes related to scripting.

Please, if you want to ask questions about these new and changed features, come on over to the After Effects Forums. That’s the best place for questions. Questions left in comments on a blog post are much harder to work with; the blog comment system just isn’t set up for conversations. If you’d like to submit feature requests or bug reports, you can do so at this page.


Recent Script Files Menu and Keyboard Shortcut


The File > Scripts menu now includes a Recent Script Files sub-menu which lists the 10 most recently run scripts.

The most recently run script can also be re-run by pressing the keyboard shortcut Command+Option+Shift+D (macOS) or Control+Alt+Shift+D (Windows).


Text Leading Scripting Access


Scripts can now read and write the leading property of text layers. Text leading is an attribute of a TextDocument object.

TextDocument leading attribute

textDocument.leading

Description

The text layer’s spacing between lines.

NOTE: If the text layer has different leading settings for each line, this attribute returns the setting for the first line. Also, if you change the value, it resets all lines in the text layer to the specified setting.

Type

Floating-point value; read/write.

Example

This creates a text layer and sets the leading to 100:

var composition = app.project.activeItem;
var myTextLayer = comp.layers.addText("Spring\nSummer\nAutumn\nWinter");
var myTextSource = myTextLayer.sourceText;
var myTextDocument = myTextSource.value;
myTextDocument.leading = 100;
myTextSource.setValue(myTextDocument);


Team Projects (Beta) scripting access


Scripts can now create, open, close, share, sync and perform other operations for team projects. Team project scripting calls are methods of a project object.


newTeamProject() method

app.project.newTeamProject(teamProjectName, <description>)

Description

Creates a new team project. Returns true if the team project is successfully created, false otherwise.

 

Parameters

teamProjectName Team project name, string value. Required.
<description> Team project description, string value. Optional.

Returns

Boolean.


openTeamProject() method

app.project.openTeamProject(teamProjectName)

Description

Opens a team project. Returns true if the team project is successfully opened, false otherwise.

Parameters

teamProjectName Team project name, string value. Required.

Returns

Boolean.


shareTeamProject() method

app.project.shareTeamProject(comment)

Description
Shares the currently open team project. Returns true if the team project is successfully shared, false otherwise.

Parameters 

comment Comment, string value. Optional.

Returns
Boolean.


syncTeamProject() method

app.project.syncTeamProject()

Description
Syncs the currently open team project. Returns true if the team project is successfully synced, false otherwise.

Parameters
None.

Returns
Boolean.


closeTeamProject() method

app.project.closeTeamProject()

Description
Closes a currently open team project. Returns true if the command was successful, false otherwise.

Parameters
None.

Returns
Boolean.


convertTeamProjectToProject() method

app.project.convertTeamProjectToProject(project_file)

Description

Converts a team project to an After Effects project on a local disk. Returns true if the command was successful, false otherwise.

Parameters

project_file File object for the local After Effects project. File extension should be either .aep or .aet (.aepx is not supported). Required.

Returns

Boolean.


listTeamProjects() method

app.project.listTeamProjects()

Description
Returns an array containing the name strings for all team projects available for the current user. Archived Team Projects are not included.

Parameters
None.

Returns
Array.


isTeamProjectOpen() method

app.project.isTeamProjectOpen(teamProjectName)

Description

Returns true if the specified team project is currently open, false otherwise.

Parameters

teamProjectName Team project name, string value. Required.

Returns

Boolean.


isAnyTeamProjectOpen() method

app.project.isAnyTeamProjectOpen()

Description
Returns true if any team project is currently open, false otherwise.

Parameters
None.

Returns
Boolean.


isTeamProjectEnabled() method

app.project.isTeamProjectEnabled()

Description
Checks whether or not team projects is enabled for After Effects. Returns true if team projects is currently enabled, false otherwise. (This will almost always return true.)

Parameters
None.

Returns
Boolean.


isLoggedInToTeamProject() method

app.project.isLoggedInToTeamProject()

Description
Returns true if the client (After Effects) is currently logged into the team projects server, false otherwise.

Parameters
None.

Returns
Boolean.


isSyncCommandEnabled() method

app.project.isSyncCommandEnabled()

Description
Returns true if the team projects Sync command is enabled, false otherwise.

Parameters
None.

Returns
Boolean.


isShareCommandEnabled() method

app.project.isShareCommandEnabled()

Description
Returns true if the team projects Share command is enabled, false otherwise.

Parameters
None.

Returns
Boolean.


isResolveCommandEnabled() method

app.project.isResolveCommandEnabled()

Description
Returns true if the team projects Resolve command is enabled, false otherwise.

Parameters
None.

Returns
Boolean.


resolveConflict(ResolveType) method

app.project.resolveConflict(ResolveType)

Description

Resolves a conflict between the open team project and the version on the team projects server, using the specified resolution method. Returns true if the resolution of the specified type was successful, false otherwise.

Parameters

ResolveType Required. The type of conflict resolution to use; a ResolveType enumerated value, one of:
  • ResolveType.ACCEPT_THEIRS: Take the shared version. The shared version replaces your version.
  • ResolveType.ACCEPT_YOURS: Keep your version of the project. The shared version is not taken.
  • ResolveType.ACCEPT_THEIRS_AND_COPY: Copy and rename your version, then take the shared version. The shared version replaces your original version.

Returns

Boolean.


Bug fixes Related to Scripting


  • Drop-down menus in ScriptUI panels are no longer clipped on HiDPI displays on Windows.
  • The appearance of buttons, sliders, disclosure triangles (“twirly arrow”), scroll bar, progress bar, radio buttons, and checkboxes in ScriptUI embedded panels have been updated to match the appearance of After Effects native controls.
  • After Effects no longer crashes when the compPointToSource() scripting method is used with a 3D text layer.
  • The match name of the Fast Box Blur effect is “ADBE Box Blur2”. The older match name “ADBE Box Blur” will continue to work: when used to add the effect, “ADBE Box Blur” will apply the Fast Box Blur effect, but with the older name “Box Blur”; the Iterations parameter will be set to the new default of 3.