Composition
CompItem
¶
Bases: AVItem
The CompItem object represents a composition, and allows you to
manipulate and get information about it.
Example
Info
Item is the base class for AVItem object and for FolderItem object, which are in turn the base classes for various other item types, so Item attributes and methods are available when working with all of these item types.
See: https://ae-scripting.docsforadobe.dev/item/compitem/
Attributes¶
active_camera
¶
active_camera: CameraLayer | None
The front-most enabled camera layer, or None.
Returns the first CameraLayer that is active at the current
composition time. The value is None when the composition
contains no active camera layers.
adjustment_layers
¶
A list of the adjustment layers in this composition.
bg_color
¶
bg_color = ChunkField[List[float]](
"_cdta",
"bg_color",
transform=normalize_values,
reverse_seq_field=denormalize_values,
validate=validate_sequence(length=3, min=0.0, max=1.0),
)
The background color of the composition. The three array values specify the red, green, and blue components of the color. Read / Write.
composition_layers
¶
A list of the composition layers whose source are compositions.
display_start_frame
¶
display_start_frame = ChunkField[int](
"_cdta",
"display_start_frame",
transform=int,
reverse_instance_field=_reverse_display_start_frame,
validate=validate_number(
min=lambda self: int(-10800.0 * frame_rate),
max=lambda self: int(86340.0 * frame_rate),
integer=True,
),
invalidates=[
"display_start_time",
"frame_work_area_duration",
"frame_work_area_end_absolute",
"frame_work_area_start_absolute",
"frame_work_area_start_relative",
"work_area_duration",
"work_area_end_absolute",
"work_area_start_absolute",
"work_area_start_relative",
],
)
The frame value of the beginning of the composition. Read / Write.
display_start_time
¶
display_start_time = ChunkField[float](
"_cdta",
"display_start_time",
reverse_instance_field=_reverse_display_start_time,
validate=validate_number(min=-10800.0, max=86340.0),
invalidates=[
"display_start_frame",
"frame_work_area_duration",
"frame_work_area_end_absolute",
"frame_work_area_start_absolute",
"frame_work_area_start_relative",
"work_area_duration",
"work_area_end_absolute",
"work_area_start_absolute",
"work_area_start_relative",
],
)
The time set as the beginning of the composition, in seconds. This is the equivalent of the Start Timecode or Start Frame setting in the Composition Settings dialog box. Read / Write.
draft3d
¶
When True, Draft 3D mode is enabled for the composition.
Read / Write.
Warning
Deprecated in After Effects 2024 in favor of the new Draft 3D mode.
drop_frame
¶
When True, timecode is displayed in drop-frame format. Only
applicable when frameRate is 29.97 or 59.94. Read / Write.
duration
¶
duration = ChunkField[float](
"_cdta",
"duration",
reverse_instance_field=_reverse_duration,
validate=validate_number(min=0.0, max=10800.0),
invalidates=["frame_duration"],
)
The duration of the item in seconds. Read / Write.
footage_layers
¶
A list of the composition layers whose source are footages.
frame_blending
¶
When True, frame blending is enabled for this Composition. Corresponds
to the value of the Frame Blending button in the Composition panel.
Read / Write.
frame_duration
¶
frame_duration = ChunkField[int](
"_cdta",
"frame_duration",
transform=int,
reverse_instance_field=_reverse_frame_duration,
validate=validate_number(
min=1,
max=lambda self: int(duration * frame_rate),
integer=True,
),
invalidates=["duration"],
)
The duration of the item in frames. Read / Write.
frame_rate
¶
frame_rate = ChunkField[float](
"_cdta",
"frame_rate",
reverse_instance_field=_reverse_frame_rate,
validate=validate_number(min=1.0, max=999.0),
invalidates=[
"display_start_frame",
"frame_duration",
"frame_time",
"frame_work_area_end_absolute",
"frame_work_area_start_absolute",
],
)
The frame rate of the item in frames-per-second. Read / Write.
frame_time
¶
frame_time: int = ChunkField[int](
"_cdta",
"frame_time",
transform=int,
reverse_instance_field=reverse_frame_ticks("time"),
validate=validate_number(
min=lambda self: display_start_frame,
max=lambda self: (
display_start_frame + frame_duration - 1
),
integer=True,
),
invalidates=["time", "frame_time"],
)
The current time of the item when it is being previewed directly from the Project panel. This value is a number of frames. Read / Write.
guides
¶
The item's ruler guides. Each guide has an orientation and a pixel position. Read-only.
has_audio
¶
has_audio: bool
When True, the composition has an audio component.
A composition has audio when at least one of its layers has a source with audio. Read-only.
has_video
¶
has_video: bool
True if the item has a video component.
An AVItem has video when it has non-zero dimensions (width > 0
and height > 0). In a CompItem, the value is always True.
In a FootageItem,
the value depends on the footage source (e.g. audio-only files
return False).
height
¶
height = ChunkField[int](
"_cdta",
"height",
validate=validate_number(
min=4, max=30000, integer=True
),
)
The height of the item in pixels. Read / Write.
hide_shy_layers
¶
When True, only layers with shy set to False are shown in the
Timeline panel. When False, all layers are visible, including those
whose shy value is True. Corresponds to the value of the Hide All
Shy Layers button in the Composition panel. Read / Write.
id
¶
id = ChunkField[int](
"_idta", "item_id", read_only=True, default=0
)
The item unique identifier. Read-only.
label
¶
label = enum(Label, '_idta', 'label', default=NONE)
The label color. Colors are represented by their number (0 for None, or 1 to 16 for one of the preset colors in the Labels preferences). Read / Write.
layers_by_id
¶
Map of layer ID to layer, for O(1) lookup by sibling layers.
markers
¶
markers: list[MarkerValue]
A flat list of MarkerValue objects for this composition.
Shortcut for accessing marker data without navigating the property tree. Returns an empty list when the composition has no markers.
motion_blur
¶
When True, motion blur is enabled for the composition. Corresponds
to the value of the Motion Blur button in the Composition panel.
Read / Write.
motion_blur_adaptive_sample_limit
¶
motion_blur_adaptive_sample_limit = ChunkField[int](
"_cdta",
"motion_blur_adaptive_sample_limit",
validate=validate_number(
min=lambda self: motion_blur_samples_per_frame,
max=256,
integer=True,
),
)
The maximum number of motion blur samples of 2D layer motion. This
corresponds to the Adaptive Sample Limit setting in the Advanced tab of
the Composition Settings dialog box. Must be >= samples_per_frame.
Read / Write.
motion_blur_samples_per_frame
¶
motion_blur_samples_per_frame = ChunkField[int](
"_cdta",
"motion_blur_samples_per_frame",
validate=validate_number(min=2, max=64, integer=True),
)
The minimum number of motion blur samples per frame for Classic 3D layers, shape layers, and certain effects. This corresponds to the Samples Per Frame setting in the Advanced tab of the Composition Settings dialog box. Read / Write.
motion_graphics_template_controller_count
¶
motion_graphics_template_controller_count: int
The number of properties in the Essential Graphics panel for the composition. Read-only.
motion_graphics_template_controller_names
¶
The names of all properties in the Essential Graphics panel. Read-only.
motion_graphics_template_name
¶
motion_graphics_template_name: str | None
The name property in the Essential Graphics panel for the composition. The name in the Essential Graphics panel is used for the file name of an exported Motion Graphics template. Read / Write.
name
¶
name = ChunkField[str](
"_name_utf8", "contents", transform=strip_null
)
The name of the item, as shown in the Project panel. Read / Write.
parent_folder
¶
parent_folder: FolderItem | None
The parent folder of this item. None for the root folder.
Read-only.
pixel_aspect
¶
pixel_aspect = ChunkField[float](
"_cdta",
"pixel_aspect",
reverse_instance_field=_reverse_pixel_aspect,
validate=validate_number(min=0.01, max=100.0),
)
The pixel aspect ratio of the item (1.0 is square). Read / Write.
placeholder_layers
¶
A list of the layers whose source are placeholders.
preserve_nested_frame_rate
¶
When True, the frame rate of nested compositions is preserved in
the current composition. Corresponds to the value of the "Preserve frame
rate when nested or in render queue" option in the Advanced tab of the
Composition Settings dialog box. Read / Write.
preserve_nested_resolution
¶
When True, the resolution of nested compositions is preserved in
the current composition. Corresponds to the value of the "Preserve
Resolution When Nested" option in the Advanced tab of the Composition
Settings dialog box. Read / Write.
renderer
¶
renderer: str
The current rendering plug-in module to be used to render this
composition, as set in the Advanced tab of the Composition Settings
dialog box. Allowed values are the members of renderers.
Read / Write.
resolution_factor
¶
resolution_factor = ChunkField[List[int]](
"_cdta",
"resolution_factor",
transform=list,
validate=validate_sequence(
length=2, min=1, max=99, integer=True
),
)
The x and y downsample resolution factors for rendering the composition. The two values in the array specify how many pixels to skip when sampling; the first number controls horizontal sampling, the second controls vertical sampling. Full resolution is [1, 1], half resolution is [2, 2], and quarter resolution is [4, 4]. The default is [1, 1]. Read / Write.
selected
¶
selected: bool
When True, this item is selected. Read-only.
Note
Item selection is not stored in the .aep binary format; it is a
runtime-only state. Parsed projects always report False.
selected_layers
¶
The layers that are selected in the composition. Read-only.
selected_properties
¶
All selected layers in this composition.
Warning
This is not the same as ExtendScript's selectedProperties,
which returns selected properties.
Read-only.
shutter_angle
¶
shutter_angle = ChunkField[int](
"_cdta",
"shutter_angle",
validate=validate_number(min=0, max=720, integer=True),
)
The shutter angle setting for the composition. This corresponds to the Shutter Angle setting in the Advanced tab of the Composition Settings dialog box. Read / Write.
shutter_phase
¶
shutter_phase = ChunkField[int](
"_cdta",
"shutter_phase",
validate=validate_number(
min=-360, max=360, integer=True
),
)
The shutter phase setting for the composition. This corresponds to the Shutter Phase setting in the Advanced tab of the Composition Settings dialog box. Read / Write.
three_d_model_layers
¶
three_d_model_layers: list[ThreeDModelLayer]
A list of the 3D model layers in this composition.
time
¶
time: float = ChunkField[float](
"_cdta",
"time",
reverse_instance_field=reverse_ratio("time"),
validate=validate_number(
min=lambda self: display_start_time,
max=lambda self: (
display_start_time + duration - 1 / frame_rate
),
),
invalidates=["time", "frame_time"],
)
The current time of the item when it is being previewed directly from
the Project panel. This value is a number of seconds. It is an error to set
this value for a FootageItem whose main_source is still
(item.main_source.is_still is True). Read / Write.
time_scale
¶
time_scale = ChunkField[float](
"_cdta", "time_scale", read_only=True
)
The time scale, used as a divisor for keyframe time values. Read-only.
type_name
¶
type_name: str
A user-readable name for the item type ("Folder", "Footage" or "Composition"). These names are application locale-dependent, meaning that they are different depending on the application's UI language. Read-only.
width
¶
width = ChunkField[int](
"_cdta",
"width",
validate=validate_number(
min=4, max=30000, integer=True
),
)
The width of the item in pixels. Read / Write.
work_area_duration
¶
work_area_duration = ChunkField[float](
"_cdta",
"work_area_duration",
reverse_instance_field=_reverse_work_area_duration,
validate=validate_number(
min=lambda self: 1 / frame_rate,
max=lambda self: duration - work_area_start,
),
invalidates=[
"frame_work_area_duration",
"frame_work_area_end_absolute",
"frame_work_area_start_relative",
"work_area_end_absolute",
"work_area_start_relative",
],
)
The work area duration in seconds. Read / Write.
work_area_duration_frame
¶
work_area_duration_frame = ChunkField[int](
"_cdta",
"frame_work_area_duration",
transform=int,
reverse_instance_field=_reverse_work_area_duration_frame,
validate=validate_number(
min=1,
max=lambda self: (
frame_duration - work_area_start_frame
),
integer=True,
),
invalidates=[
"frame_work_area_end_absolute",
"frame_work_area_start_relative",
"work_area_duration",
"work_area_end_absolute",
"work_area_start_relative",
],
)
The work area duration in frames. Read / Write.
work_area_start
¶
work_area_start = ChunkField[float](
"_cdta",
"work_area_start_relative",
reverse_instance_field=_reverse_work_area_start,
validate=validate_number(
min=0.0, max=lambda self: duration - 1 / frame_rate
),
invalidates=[
"frame_work_area_duration",
"frame_work_area_start_absolute",
"frame_work_area_start_relative",
"work_area_duration",
"work_area_start_absolute",
],
)
The work area start time relative to composition start. Read / Write.
work_area_start_frame
¶
work_area_start_frame = ChunkField[int](
"_cdta",
"frame_work_area_start_relative",
transform=int,
reverse_instance_field=_reverse_work_area_start_frame,
validate=validate_number(
min=0,
max=lambda self: frame_duration - 1,
integer=True,
),
invalidates=[
"frame_work_area_duration",
"frame_work_area_start_absolute",
"work_area_duration",
"work_area_start_absolute",
"work_area_start_relative",
],
)
The work area start frame relative to composition start. Read / Write.
Functions¶
get_motion_graphics_template_controller_name
¶
Get the name of a single property in the Essential Graphics panel.
Parameters:
-
index(int) –The 1-based index of the EGP property.
layer
¶
layer(
name: str | None = None,
index: int | None = None,
other_layer: Layer | None = None,
rel_index: int | None = None,
) -> Layer
Get a Layer object by name, index, or relative to another layer.
Parameters:
-
name(str | None, default:None) –The name of the layer to return.
-
index(int | None, default:None) –The index position of the layer to return.
-
other_layer(Layer | None, default:None) –A Layer object to use as a reference for the relative index position of the layer to return.
-
rel_index(int | None, default:None) –The index position of the layer relative to the other_layer to return.