Adobe Creative Cloud

scripting changes in After Effects CC (12.0-12.2)

This article describes the changes to the After Effects scripting interface implemented in After Effects CC (12.0). You can use this article together with the most recent full version of the After Effects scripting guide (for After Effects CS6), which you can find on the After Effects Developer Center page.

There were no significant changes in the scripting interface for After Effects CC (12.1) or After Effects CC (12.2).

ScriptUI Drover adpapter

ScriptUI is now based on the same controls as the main application.

The scripting reference for ScriptUI is in the Adobe Creative Cloud JavaScript Tools Guide (PDF).

access to effect’s internal version string

Added: Application effects object’s version attribute to get an effect’s internal version string. This value might be different than the version number the plug-in vendor decides to show in the effect’s about box.

ability to get and set preview mode

Added: ViewOptions fastPreview property to access the state of the Fast Previews menu with the scripting interface. This is a read/write attribute using an enumerated value:

Value Fast Previews menu option
FastPreviewType.FP_OFF Off (Final Quality)
FastPreviewType.FP_ADAPTIVE_RESOLUTION Adaptive Resolution
FastPreviewType.FP_DRAFT Draft
FastPreviewType.FP_FAST_DRAFT Fast Draft
FastPreviewType.FP_WIREFRAME Wireframe

If you try to get or set the attribute’s value in the Layer or Footage panel, you’ll get an error message.

The Draft preview mode is only available in ray-traced 3D compositions. If you try to use it in a Classic 3D composition, you’ll get an error: “Cannot set Draft fast preview mode in a Classic 3D composition.”

access to layer sampling method

Added: layer.samplingQuality and LayerSamplingQuality enum to set/get layer sampling method (bicubic or bilinear):

// Set layer to bicubic sampling

app.project.activeItem.layer(1).samplingQuality = LayerSamplingQuality.BICUBIC;

// Set layer to bilinear sampling

app.project.activeItem.layer(1).samplingQuality = LayerSamplingQuality.BILINEAR;

changed preference and settings methods

Preferences and settings methods now take a third argument to specify the target preferences file if Section/Key is not in “Adobe After Effects 12.x Prefs.txt”. If the third argument is not passed, default value (PREFType.PREF_Type_MACHINE_SPECIFIC) is used and After Effects tries to save/get from the “Adobe After Effects 12.x Prefs.txt” preferences file. The third argument is enum PREFType value.

You can now pass the preference type with a script with new PREFType enum:

    Adobe After Effects 12.x Prefs.txt
    Adobe After Effects 12.x Prefs-indep-general.txt
    Adobe After Effects 12.x Prefs-indep-render.txt
    Adobe After Effects 12.x Prefs-indep-output.txt
    Adobe After Effects 12.x Prefs-indep-composition.txt
    Adobe After Effects 12.x Prefs-text.txt
    Adobe After Effects 12.x Prefs-paint.txt

// Section ["Settings_test_section"] is saved in "Adobe After Effects 12.x Prefs.txt" without third argument

app.settings.saveSetting("test_section", "test_key1", "test_key1_value");

if (app.settings.haveSetting("test_section", "test_key1"))
var current_set = app.settings.getSetting("test_section", "test_key1");

// Section ["Settings_test_section2"] is saved in "Adobe After Effects 12.x Prefs-indep-general.txt"

app.settings.saveSetting("test_section2", "test_key1", "test_key1_value", PREFType.PREF_Type_MACHINE_INDEPENDENT);

if (app.settings.haveSetting("test_section2", "test_key1", PREFType.PREF_Type_MACHINE_INDEPENDENT))
var current_set2 = app.settings.getSetting("test_section2", "test_key1", PREFType.PREF_Type_MACHINE_INDEPENDENT);

alert(app.preferences.getPrefAsString("Text Style Sheet", "Font Family Name", PREFType.PREF_Type_MACHINE_SPECIFIC_TEXT));

After Effects, General, Region of Interest