Scene Contents
Learn how to use the CreativeEditor SDK's CreativeEngine to explore scene contents through the scene
API.
Setup#
This example uses the headless CreativeEngine. See the Setup article for a detailed guide.
To get started right away, you can also access the block
API within a running CE.SDK instance via cesdk.engine.block
.
Check out the APIs Overview to see that illustrated in more detail.
Functions#
getPages(): DesignBlockId[]
Get the sorted list of pages in the scene.
- Returns The sorted list of pages in the scene.
setDesignUnit(designUnit: DesignUnit): void
Converts all values of the current scene into the given design unit.
designUnit
: The new design unit of the scene
getDesignUnit(): DesignUnit
Returns the design unit of the current scene.
- Returns The current design unit.
type DesignUnit = 'Pixel' | 'Millimeter' | 'Inch'
The unit type in which the page values (size, distances, etc.) are defined.
getCurrentPage(): DesignBlockId | null
Get the current page, i.e., the page of the first selected element if this page is at least 25% visible or, otherwise, the page nearest to the viewport center.
- Returns The current page in the scene or null.
findNearestToViewPortCenterByType(type: DesignBlockType): DesignBlockId[]
Find all blocks with the given type sorted by the distance to viewport center.
type
: The type to search for.- Returns A list of block ids sorted by distance to viewport center.
findNearestToViewPortCenterByKind(kind: string): DesignBlockId[]
Find all blocks with the given kind sorted by the distance to viewport center.
kind
: The kind to search for.- Returns A list of block ids sorted by distance to viewport center.