Skip to content

Commit 07a9f8e

Browse files
authored
Merge pull request #62 from JessiMcM/guides-v2-scripting-docs
Document Enhanced Guides scripting API updates
2 parents 68c93be + 8592f87 commit 07a9f8e

5 files changed

Lines changed: 454 additions & 22 deletions

File tree

‎docs/introduction/changelog.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ What's new and changed for scripting?
88

99
---
1010

11+
## After Effects (Beta)
12+
13+
14+
### [After Effects (Beta) 26.5](https://helpx.adobe.com/after-effects/desktop/what-s-new/after-effects-beta.html) (July 2026)
15+
16+
!!! note
17+
This functionality was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta.
18+
19+
- Guide scripting extended with a `GuideOptions`-based API (percentage positioning, per-guide color, and pinning):
20+
- Added: [GuideOptions object](../other/guideoptions.md)
21+
- Added: [GuideOrientationType](../other/guideoptions.md#guideorientationtype) and [GuidePositionType](../other/guideoptions.md#guidepositiontype) enumerated values
22+
- Added: [Item.getGuideAsObject()](../item/item.md#itemgetguideasobject) and [Layer.getGuideAsObject()](../layer/layer.md#layergetguideasobject)
23+
- Added: `GuideOptions` overloads of [Item.addGuide()](../item/item.md#itemaddguide) / [Item.setGuide()](../item/item.md#itemsetguide) and [Layer.addGuide()](../layer/layer.md#layeraddguide) / [Layer.setGuide()](../layer/layer.md#layersetguide)
24+
25+
!!! warning "Differences between versions"
26+
**Breaking change:** The integer values behind `orientationType` and `positionType` on [Item.guides](../item/item.md#itemguides) / [Layer.guides](../layer/layer.md#layerguides) differ between versions of After Effects. In the beta, always compare against the enumerated constants rather than raw integer literals.
27+
28+
---
29+
1130
## After Effects 26
1231

1332
### [After Effects 26.3](https://helpx.adobe.com/after-effects/using/whats-new.html) (June 2026)
@@ -253,9 +272,14 @@ What's new and changed for scripting?
253272
- Added: [ViewOptions.guidesVisibility](../other/viewoptions.md#viewoptionsguidesvisibility)
254273
- Added: [ViewOptions.rulers](../other/viewoptions.md#viewoptionsrulers)
255274
- Scripting access to add, remove, and set existing guides:
275+
- Added: [Item.guides](../item/item.md#itemguides)
256276
- Added: [Item.addGuide()](../item/item.md#itemaddguide)
257277
- Added: [Item.removeGuide()](../item/item.md#itemremoveguide)
258278
- Added: [Item.setGuide()](../item/item.md#itemsetguide)
279+
- Added: [Layer.guides](../layer/layer.md#layerguides)
280+
- Added: [Layer.addGuide()](../layer/layer.md#layeraddguide)
281+
- Added: [Layer.removeGuide()](../layer/layer.md#layerremoveguide)
282+
- Added: [Layer.setGuide()](../layer/layer.md#layersetguide)
259283
- Scripting access to additional EGP property attributes:
260284
- Added: [CompItem.motionGraphicsTemplateControllerCount](../item/compitem.md#compitemmotiongraphicstemplatecontrollercount)
261285
- Added: [CompItem.getMotionGraphicsTemplateControllerName()](../item/compitem.md#compitemgetmotiongraphicstemplatecontrollername)

‎docs/item/item.md‎

Lines changed: 106 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,32 @@ String; read-only.
7878

7979
#### Description
8080

81-
An array of `guide` objects, containing `orientationType`, `positionType`, and `position` attributes.
81+
An array of objects describing the guides in the item's view. The properties on each entry depend on the version of After Effects.
82+
83+
In After Effects 16.1 (CC 2019) and later, each entry has the following properties:
84+
85+
| Property | Type | Description |
86+
| ----------------- | -------------------- | ----------------------------------------------------- |
87+
| `orientationType` | Integer | `0` for a horizontal guide, `1` for a vertical guide. |
88+
| `positionType` | Integer | Always `0` (a pixel position). |
89+
| `position` | Floating-point value | The guide's position, in pixels. |
90+
91+
In After Effects (Beta) 26.5 and later, each entry has the following properties:
92+
93+
| Property | Type | Description |
94+
| ----------------- | ---------------------- | ------------------------------------------------------------------------ |
95+
| `orientationType` | `GuideOrientationType` | `GuideOrientationType.HORIZONTAL` or `GuideOrientationType.VERTICAL`. |
96+
| `positionType` | `GuidePositionType` | `GuidePositionType.PIXEL` or `GuidePositionType.PERCENTAGE`. |
97+
| `position` | Floating-point value | The guide's position, in pixels or percent depending on `positionType`. |
98+
| `color` | Array of 3 floats | `[R, G, B]`, each `0.0`-`1.0`. |
99+
| `pinned` | Boolean | `true` if pinned to the opposite (bottom/right) edge. |
100+
101+
!!! warning "Differences between versions"
102+
**Breaking change:** The integer values behind `orientationType` and `positionType` differ between versions of After Effects. Always compare against the enumerated constants (for example [GuideOrientationType.HORIZONTAL](../other/guideoptions.md#guideorientationtype)) rather than raw integer literals — a test such as `guide.orientationType === 0` is not portable and may stop matching in a future version.
82103

83104
#### Type
84105

85-
Array; read-only.
106+
Array of objects; read-only.
86107

87108
---
88109

@@ -221,30 +242,78 @@ if (/Composition|Komposition|Composición|Composizione|コンポジション|컴
221242

222243
`app.project.item(index).addGuide(orientationType, position)`
223244

245+
`app.project.item(index).addGuide(guideOptions)`
246+
224247
!!! note
225-
This functionality was added in After Effects 16.1 (CC 2019)
248+
The `(orientationType, position)` form was added in After Effects 16.1 (CC 2019). The `GuideOptions` form was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta.
226249

227250
#### Description
228251

229-
Creates a new guide and adds it to the `guides` object of the Item.
252+
Adds a guide to the item's view and returns its index. There are two forms:
253+
254+
- **`addGuide(orientationType, position)`** - adds a pixel guide using an orientation and a pixel position.
255+
- **`addGuide(guideOptions)`** - adds a guide described by a [GuideOptions](../other/guideoptions.md) object, allowing percentage positioning, per-guide color, and pinning. *(After Effects (Beta) 26.5 and later; calling this form in an earlier version raises an error.)*
230256

231257
#### Parameters
232258

233-
| Parameter | Type | Description |
234-
| ----------------- | ------- | --------------------------------------------------------------------------------------------- |
235-
| `orientationType` | Integer | `0` for a horizontal guide, `1` for a vertical guide. Any other value defaults to horizontal. |
236-
| `position` | Integer | The X or Y coordinate position of the guide in pixels, depending on its `orientationType`. |
259+
| Parameter | Type | Description |
260+
| ----------------- | -------------------- | --------------------------------------------------------------------------------------------------------- |
261+
| `orientationType` | Integer | `0` for a horizontal guide, `1` for a vertical guide. Any other value defaults to horizontal. In After Effects (Beta) 26.5 and later you may also pass `GuideOrientationType.HORIZONTAL` / `GuideOrientationType.VERTICAL`. |
262+
| `position` | Floating-point value | The X or Y coordinate position of the guide in pixels. Clamped to ±100,000; non-finite values are rejected. |
263+
| `guideOptions` | GuideOptions object | A [GuideOptions](../other/guideoptions.md) describing the new guide. |
237264

238265
#### Returns
239266

240267
Integer; the index of the newly-created guide.
241268

242269
#### Example
243270

244-
Adds a vertical guide at 500 pixels on the X axis to the `activeItem` of a project.
271+
```javascript
272+
var item = app.project.item(1);
273+
274+
// (orientationType, position) form: a vertical guide at 500 px on the X axis.
275+
item.addGuide(1, 500);
276+
277+
// GuideOptions form: a vertical guide at 50%, red, pinned to the right edge.
278+
var opts = new GuideOptions();
279+
opts.orientation = GuideOrientationType.VERTICAL;
280+
opts.position = 50;
281+
opts.positionType = GuidePositionType.PERCENTAGE;
282+
opts.color = [1, 0, 0];
283+
opts.pinned = true;
284+
item.addGuide(opts);
285+
```
286+
287+
---
288+
289+
### Item.getGuideAsObject()
290+
291+
`app.project.item(index).getGuideAsObject(guideIndex)`
292+
293+
!!! note
294+
This functionality was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta. Calling it in an earlier version raises the error "getGuideAsObject() is not available in this version of After Effects."
295+
296+
#### Description
297+
298+
Returns the guide at the specified index as a [GuideOptions](../other/guideoptions.md) object, which you can modify and pass back to [setGuide()](#itemsetguide). This is a convenient way to read a guide's full state (orientation, position, position type, color, pinning).
299+
300+
#### Parameters
301+
302+
| Parameter | Type | Description |
303+
| ------------ | ------- | ------------------------------ |
304+
| `guideIndex` | Integer | The index of the guide to read. |
305+
306+
#### Returns
307+
308+
A [GuideOptions](../other/guideoptions.md) object.
309+
310+
#### Example
245311

246312
```javascript
247-
app.project.activeItem.addGuide(1, 500);
313+
var item = app.project.item(1);
314+
var g = item.getGuideAsObject(0);
315+
g.color = [0, 0, 1]; // tweak just the color
316+
item.setGuide(0, g); // write it back
248317
```
249318

250319
---
@@ -276,7 +345,7 @@ Nothing.
276345

277346
#### Description
278347

279-
Removes an existing guide. Choose the guide based on its index inside the `Item.guides` object.
348+
Removes an existing guide. Choose the guide based on its index inside the [Item.guides](#itemguides) array.
280349

281350
#### Parameters
282351

@@ -303,32 +372,47 @@ app.project.activeItem.removeGuide(0);
303372

304373
### Item.setGuide()
305374

306-
`app.project.item(index).setGuide(position,guideIndex)`
375+
`app.project.item(index).setGuide(position, guideIndex)`
376+
377+
`app.project.item(index).setGuide(guideIndex, guideOptions)`
307378

308379
!!! note
309-
This functionality was added in After Effects 16.1 (CC 2019)
380+
The `(position, guideIndex)` form was added in After Effects 16.1 (CC 2019). The `(guideIndex, guideOptions)` form was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta.
310381

311382
#### Description
312383

313-
Modifies the `position` of an existing guide. Choose the guide based on its `guideIndex` inside the `Item.guides` array.
384+
Updates an existing guide. There are two forms, distinguished by the type of the second argument:
385+
386+
- **`setGuide(position, guideIndex)`** - moves the guide at `guideIndex` to a new pixel `position`. *Note the order: position first, index second.* A guide's `orientationType` may not be changed after it is created.
387+
- **`setGuide(guideIndex, guideOptions)`** - applies the properties set on a [GuideOptions](../other/guideoptions.md) object to the guide at `guideIndex`. Only the properties you set are changed (partial update). *(After Effects (Beta) 26.5 and later.)*
314388

315-
A guide's `orientationType` may not be changed after it is created.
389+
!!! warning
390+
The two forms take their arguments in the **opposite order**: the `(position, guideIndex)` form takes the position first, while the `(guideIndex, guideOptions)` form takes the index first. After Effects decides which form you mean from the type of the second argument (a number selects the `(position, guideIndex)` form; a `GuideOptions` object selects the `(guideIndex, guideOptions)` form).
316391

317392
#### Parameters
318393

319-
| Parameter | Type | Description |
320-
| ------------ | ------- | ------------------------------------------------------------------------------------------------------- |
321-
| `position` | Integer | The new X or Y coordinate position of the guide in pixels, depending on its existing `orientationType`. |
322-
| `guideIndex` | Integer | The index of the guide to be modified. |
394+
| Parameter | Type | Description |
395+
| -------------- | -------------------- | ------------------------------------------------------------------------------------------------------- |
396+
| `position` | Floating-point value | The new X or Y coordinate position of the guide in pixels. Clamped to ±100,000; non-finite values are rejected. |
397+
| `guideIndex` | Integer | The index of the guide to be modified. |
398+
| `guideOptions` | GuideOptions object | A [GuideOptions](../other/guideoptions.md) whose set properties are applied to the guide. |
323399

324400
#### Returns
325401

326402
Nothing.
327403

328404
#### Example
329405

330-
Changes the position of the first guide in `activeItem` to 1200 pixels.
331-
332406
```javascript
333-
app.project.activeItem.setGuide(1200, 0);
407+
var item = app.project.item(1);
408+
409+
// (position, guideIndex) form: move guide 0 to 1200 px (position first, index second).
410+
item.setGuide(1200, 0);
411+
412+
// GuideOptions form: recolor guide 0 and switch it to a percentage position.
413+
var opts = new GuideOptions();
414+
opts.position = 75;
415+
opts.positionType = GuidePositionType.PERCENTAGE;
416+
opts.color = [0, 1, 0];
417+
item.setGuide(0, opts); // index first, options second
334418
```

0 commit comments

Comments
 (0)