SceneAPI provides methods for managing scenes and pages
Implements#
ISceneAPI
Constructors#
Color Management#
setDocumentColorProfile()#
Assigns an ICC profile to one document role and component space.
Profiles save with the scene and are bundled into archives. Default/CMYK drives managed
conversion. Output/RGB and Output/CMYK are the profiles that a PDF export converts to and
embeds with outputProfileMode and embedProfiles. A PNG, JPEG or WebP export
uses Output/RGB. Other slots store profiles only.
Failure keeps the previous profile. Another assignment or removal in this slot, or scene
replacement, supersedes pending loading. Other slots are independent. Undo and redo do not
change profiles.
outputProfileMode and embedProfiles. A PNG, JPEG or WebP export
uses Output/RGB. Other slots store profiles only.
Failure keeps the previous profile. Another assignment or removal in this slot, or scene
replacement, supersedes pending loading. Other slots are independent. Undo and redo do not
change profiles.Parameters#
| Parameter | Type | Description |
|---|---|---|
slot |
ProfileSlot |
The role and component space to assign. |
uri |
string |
The URI of an ICC profile matching the slot’s space. |
options? |
AbortOptions |
Abort options. Aborting keeps the previous profile unchanged. |
Returns#
Promise<void>
Resolves after assignment; rejects on loading, validation, a space mismatch,
supersession or an invalid slot (COLOR.PROFILE_SLOT_INVALID).
Implementation of#
ISceneAPI.setDocumentColorProfileSignature#
setDocumentColorProfile(slot: ProfileSlot$1, uri: string, options?: AbortOptions): Promise<void>setDocumentColorProfileFromData()#
Assigns ICC bytes synchronously, with the same slots and persistence as setDocumentColorProfile.
The engine copies the bytes and keeps one buffer per distinct profile for its lifetime.
saveToString stores a buffer URI readable only by this engine; use an archive to retain the bytes.
To save a URL instead, upload the bytes that findAllTransientResources lists and call relocateResource
before saving.
Parameters#
| Parameter | Type | Description |
|---|---|---|
slot |
ProfileSlot |
The role and component space to assign. |
data |
Uint8Array |
ICC bytes matching the slot’s space. |
Returns#
void
Throws#
On invalid bytes, a space mismatch or an invalid slot. The previous profile stays unchanged.
Implementation of#
ISceneAPI.setDocumentColorProfileFromDataSignature#
setDocumentColorProfileFromData(slot: ProfileSlot$1, data: Uint8Array): voidgetDocumentColorProfileInfo()#
Returns the reference stored in a slot without loading it. Fallback profiles are not reported.
The name is empty while unloaded or when absent from the profile.
Parameters#
| Parameter | Type | Description |
|---|---|---|
slot |
ProfileSlot |
The role and component space to inspect. |
Returns#
DocumentColorProfileInfoThe stored hash, URI and loaded name.
Throws#
COLOR.DOCUMENT_PROFILE_NOT_SET for an empty slot, or COLOR.PROFILE_SLOT_INVALID.
Implementation of#
ISceneAPI.getDocumentColorProfileInfoSignature#
getDocumentColorProfileInfo(slot: ProfileSlot$1): DocumentColorProfileInforemoveDocumentColorProfile()#
Removes one profile and supersedes its pending assignment. Other slots stay unchanged.
Removing Default/CMYK restores fallback resolution. Removing an empty slot succeeds.
Parameters#
| Parameter | Type | Description |
|---|---|---|
slot |
ProfileSlot |
The role and component space to remove. |
Returns#
void
Throws#
COLOR.PROFILE_SLOT_INVALID for an invalid slot.
Implementation of#
ISceneAPI.removeDocumentColorProfileSignature#
removeDocumentColorProfile(slot: ProfileSlot$1): voidExperimental Features#
unstable_disableCameraPositionClamping()#
Disables any previously set position clamping for the current scene.
engine.scene.unstable_disableCameraPositionClamping();Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene? |
number |
Optionally, the scene or a block in the scene for which to query the position clamping. This API is experimental and may change or be removed in future versions. |
Returns#
void
unstable_isCameraPositionClampingEnabled()#
Queries whether position clamping is enabled.
engine.scene.unstable_isCameraPositionClampingEnabled();Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene? |
number |
Optionally, the scene or a block in the scene for which to query the position clamping. |
Returns#
boolean
True if the given block has position clamping set or the scene contains a block for which position clamping is set, false otherwise. This API is experimental and may change or be removed in future versions.
unstable_disableCameraZoomClamping()#
Disables any previously set zoom clamping for the current scene.
engine.scene.unstable_disableCameraZoomClamping();Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene? |
number |
Optionally, the scene or a block for which to query the zoom clamping. This API is experimental and may change or be removed in future versions. |
Returns#
void
unstable_isCameraZoomClampingEnabled()#
Queries whether zoom clamping is enabled.
engine.scene.unstable_isCameraZoomClampingEnabled();Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene? |
number |
Optionally, the scene or a block for which to query the zoom clamping. |
Returns#
boolean
True if the given block has zoom clamping set or the scene contains a block for which zoom clamping is set, false otherwise. This API is experimental and may change or be removed in future versions.
Camera & Zoom#
enableZoomAutoFit()#
Continually adjust the zoom level to fit the block’s bounding box on the
chosen axis. For ‘Horizontal’/‘Vertical’, the second/third arguments are
paddingBefore/paddingAfter along that axis. For ‘Both’ the four
arguments map to left/top/right/bottom.
paddingBefore/paddingAfter along that axis. For ‘Both’ the four
arguments map to left/top/right/bottom.Parameters#
| Parameter | Type | Description |
|---|---|---|
id |
number |
The block to follow. |
axis |
"Horizontal" |
"Vertical" |
paddingBefore? |
number |
- |
paddingAfter? |
number |
- |
Returns#
void
Call Signature#
enableZoomAutoFit( id, axis, paddingLeft?, paddingTop?, paddingRight?, paddingBottom?): void;Continually adjusts the zoom level to fit the width or height of a block’s axis-aligned bounding box.
This only shows an effect if the zoom level is not handled/overwritten by the UI.
Without padding, this results in a tight view on the block.
Calling setZoomLevel or zoomToBlock disables the continuous adjustment.
// Follow page with padding of 20px in both directionsengine.scene.enableZoomAutoFit(page, 'Both', 20.0, 20.0, 20.0, 20.0);Parameters#
| Parameter | Type | Description |
|---|---|---|
id |
number |
The block for which the zoom is adjusted. |
axis |
"Both" |
The block axis for which the zoom is adjusted. |
paddingLeft? |
number |
Optional padding in screen pixels to the left of the block. |
paddingTop? |
number |
Optional padding in screen pixels to the top of the block. |
paddingRight? |
number |
Optional padding in screen pixels to the right of the block. |
paddingBottom? |
number |
Optional padding in screen pixels to the bottom of the block. |
Returns#
void
Signatures#
enableZoomAutoFit(id: number, axis: "Horizontal" | "Vertical", paddingBefore?: number, paddingAfter?: number): voidenableZoomAutoFit(id: number, axis: "Both", paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): voidOther#
setCMYKProfile()#
Loads the ICC profile at a URI and makes it the CMYK profile of the document.
Assigns to the slot with role Default and color space CMYK.
Default and color space CMYK.The profile is document state: it is saved with the scene and bundled into an archive. It
converts CMYK colors, the CMYK approximations of spot colors, and CMYK images without an
embedded profile, while scene/colorConversionMode is 'Managed'. An image with its own
profile keeps using that profile.
The assignment is atomic. The previous profile stays in effect while the new one loads, and a
failure leaves it unchanged. A later assignment, removeCMYKProfile or a scene load replaces a
request that is still loading. Undo and redo do not change the profile.
Parameters#
| Parameter | Type | Description |
|---|---|---|
uri |
string |
The URI of a CMYK ICC profile. |
options? |
AbortOptions |
An abortSignal that stops the download of the profile. The previous profile stays then. |
Returns#
Promise<void>
A promise that resolves once the profile is in effect. It rejects with
COLOR.PROFILE_MISSING, COLOR.PROFILE_INVALID, COLOR.PROFILE_UNSUPPORTED_SPACE,
COLOR.PROFILE_SPACE_MISMATCH or COLOR.PROFILE_ASSIGNMENT_SUPERSEDED.
Deprecated#
Use setDocumentColorProfile with Default/CMYK.
Implementation of#
ISceneAPI.setCMYKProfilesetCMYKProfileFromData()#
Makes the ICC profile in the given bytes the CMYK profile of the document.
Assigns to the slot with role Default and color space CMYK.
Default and color space CMYK.Works like setCMYKProfile, but the change is in effect when the call returns. The engine
keeps one buffer per distinct profile for its lifetime.
saveToString stores this profile as a buffer:// URI that only this engine can read.
Save to an archive to keep the profile bytes with the scene.
Parameters#
| Parameter | Type | Description |
|---|---|---|
data |
Uint8Array |
The bytes of a CMYK ICC profile. |
Returns#
void
Throws#
COLOR.PROFILE_INVALID, COLOR.PROFILE_UNSUPPORTED_SPACE or
COLOR.PROFILE_DATA_SPACE_MISMATCH. The previous profile then stays in effect.
Deprecated#
Use setDocumentColorProfileFromData with Default/CMYK.
Implementation of#
ISceneAPI.setCMYKProfileFromDatagetCMYKProfileInfo()#
What the document stores about its CMYK profile.
Reports the profile that the document names, whether it is loaded, still loading, or failed to load. The fallback profile is not reported.
Returns#
CMYKProfileInfoThe info for the document’s CMYK profile.
Throws#
Error when the document names no CMYK profile.
Deprecated#
Use getDocumentColorProfileInfo with Default/CMYK.
Implementation of#
ISceneAPI.getCMYKProfileInforemoveCMYKProfile()#
Removes the CMYK profile from the document, so CMYK conversion uses the fallback profile again.
A setCMYKProfile request that is still loading is cancelled.
setCMYKProfile request that is still loading is cancelled.Returns#
void
Deprecated#
Use removeDocumentColorProfile with Default/CMYK.
Implementation of#
ISceneAPI.removeCMYKProfilegetColorRenderingIntent()#
How a color that the destination cannot reproduce is mapped into it.
Returns#
ColorRenderingIntentThe rendering intent of the document. RelativeColorimetric unless it was changed.
Implementation of#
ISceneAPI.getColorRenderingIntentSignature#
getColorRenderingIntent(): ColorRenderingIntentsetColorRenderingIntent()#
Sets how a color that the destination cannot reproduce is mapped into it. Undo and redo do not
change it.
Parameters#
| Parameter | Type | Description |
|---|---|---|
intent |
ColorRenderingIntent |
The rendering intent. |
Returns#
void
Throws#
COLOR.RENDERING_INTENT_INVALID when the value is not one of the four intents.
Implementation of#
ISceneAPI.setColorRenderingIntentSignature#
setColorRenderingIntent(intent: ColorRenderingIntent): voidisBlackPointCompensationEnabled()#
Whether conversion maps the black point of the source onto the destination.
Returns#
boolean
True when black point compensation is on, which is the default.
Implementation of#
ISceneAPI.isBlackPointCompensationEnabledSignature#
isBlackPointCompensationEnabled(): booleansetBlackPointCompensationEnabled()#
Turns black point compensation of the document on or off. Undo and redo do not change it.
Parameters#
| Parameter | Type | Description |
|---|---|---|
enabled |
boolean |
Whether conversion maps the black point. |
Returns#
void
Implementation of#
ISceneAPI.setBlackPointCompensationEnabledSignature#
setBlackPointCompensationEnabled(enabled: boolean): voidcreate()#
Create a new design scene, along with its own camera.
Parameters#
| Parameter | Type | Description |
|---|---|---|
sceneLayout? |
string |
The layout of the scene. |
options? |
CreateSceneOptions |
- |
Returns#
number
The scene’s handle.
Implementation of#
ISceneAPI.createSignature#
create(sceneLayout?: string, options?: CreateSceneOptions): numberget()#
Return the currently active scene.
Returns#
number
The scene or null, if none was created yet.
Implementation of#
ISceneAPI.getSignature#
get(): numberload()#
Load a scene from a scene string or from a URL to a scene or archive file.
The input kind is detected automatically: serialized scene content is loaded directly, while a
URL is fetched and loaded as an archive or as a scene file depending on its content. This loads
.imgly files as well as the legacy .scene and .zip formats.
Also supports data URIs (data:application/zip;base64,…) which are converted to buffer://
protocol internally.
Pass onProgress to show how much of an archive the engine has read:
await engine.scene.load('file:///path/to/scene.imgly', { onProgress: (percent) => console.log(`${percent} %`)});Parameters#
| Parameter | Type | Description |
|---|---|---|
source |
string |
URL |
options? |
LoadSceneOptions |
The load options, including the onProgress callback for archives. |
Returns#
Promise<number>
A handle to the loaded scene.
Call Signature#
load( source, overrideEditorConfig?,waitForResources?): Promise<number>;Load a scene from a scene string or from a URL to a scene or archive file.
Parameters#
| Parameter | Type | Description |
|---|---|---|
source |
string |
URL |
overrideEditorConfig? |
boolean |
Whether to override editor configuration. The scene’s variables load either way, and a key that is not valid is repaired, such as ubq.name to ubq_name. A variable set while no scene existed replaces the loaded value of its key. |
waitForResources? |
boolean |
Whether to wait for all resources to finish loading. |
Returns#
Promise<number>
A handle to the loaded scene.
Signatures#
load(source: string | URL, options?: LoadSceneOptions): Promise<number>load(source: string | URL, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<number>loadFromString()#
Load the contents of a scene file. The scene loads within the call. With waitForResources, an abort of
abortSignal stops only the wait for the resources, so the loaded scene stays.
A damaged scene, such as one with a missing key or a value of the wrong type, fails the load. A damaged block fails it after the open scene is cleared, so load another scene after that error.
waitForResources, an abort of
abortSignal stops only the wait for the resources, so the loaded scene stays.
A damaged scene, such as one with a missing key or a value of the wrong type, fails the load. A damaged block fails it after the open scene is cleared, so load another scene after that error.Parameters#
| Parameter | Type | Description |
|---|---|---|
sceneContent |
string |
The scene file contents, a base64 string. |
options? |
LoadSceneOptions |
The load options. A scene string reports no progress. |
Returns#
Promise<number>
A handle to the loaded scene.
Implementation of#
ISceneAPI.loadFromStringCall Signature#
loadFromString( sceneContent, overrideEditorConfig?,waitForResources?): Promise<number>;Load the contents of a scene file. A damaged scene, such as one with a missing key or a value of the wrong type, fails the load. A damaged block fails it after the open scene is cleared, so load another scene after that error.
Parameters#
| Parameter | Type | Description |
|---|---|---|
sceneContent |
string |
The scene file contents, a base64 string. |
overrideEditorConfig? |
boolean |
Whether to override editor configuration. The scene’s variables load either way, and a key that is not valid is repaired, such as ubq.name to ubq_name. A variable set while no scene existed replaces the loaded value of its key. |
waitForResources? |
boolean |
Whether to wait for all resources to finish loading. |
Returns#
Promise<number>
A handle to the loaded scene.
Implementation of#
ISceneAPI.loadFromStringSignatures#
loadFromString(sceneContent: string, options?: LoadSceneOptions): Promise<number>loadFromString(sceneContent: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<number>loadFromURL()#
Load a scene from the URL to the scene file.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The URL of the scene file. |
options? |
LoadSceneOptions |
The load options. This call reports no progress. |
Returns#
Promise<number>
A promise that resolves with the scene ID.
Implementation of#
ISceneAPI.loadFromURLCall Signature#
loadFromURL( url, overrideEditorConfig?,waitForResources?): Promise<number>;Load a scene from the URL to the scene file.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The URL of the scene file. |
overrideEditorConfig? |
boolean |
Whether to override editor configuration. The scene’s variables load either way, and a key that is not valid is repaired, such as ubq.name to ubq_name. A variable set while no scene existed replaces the loaded value of its key. |
waitForResources? |
boolean |
Whether to wait for all resources to finish loading. |
Returns#
Promise<number>
A promise that resolves with the scene ID.
Implementation of#
ISceneAPI.loadFromURLSignatures#
loadFromURL(url: string, options?: LoadSceneOptions): Promise<number>loadFromURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<number>loadFromArchiveURL()#
Load a previously archived scene from the URL to the scene file.
Also supports data URIs (data:application/zip;base64,…) which are converted to buffer:// protocol internally.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The URL of the scene archive file, or a data URI containing base64-encoded archive data. |
options? |
LoadSceneOptions |
The load options, including the onProgress callback. |
Returns#
Promise<number>
A promise that resolves with the scene ID.
Call Signature#
loadFromArchiveURL( url, overrideEditorConfig?,waitForResources?): Promise<number>;Load a previously archived scene from the URL to the scene file.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The URL of the scene archive file, or a data URI containing base64-encoded archive data. |
overrideEditorConfig? |
boolean |
Whether to override editor configuration. The scene’s variables load either way, and a key that is not valid is repaired, such as ubq.name to ubq_name. A variable set while no scene existed replaces the loaded value of its key. |
waitForResources? |
boolean |
Whether to wait for all resources to finish loading. |
Returns#
Promise<number>
A promise that resolves with the scene ID.
Signatures#
loadFromArchiveURL(url: string, options?: LoadSceneOptions): Promise<number>loadFromArchiveURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<number>saveToString()#
Serializes the current scene into a string.
The output is compressed with Zstd by default. The options overload changes
the format and the level. A compressed string has a UBQ2 prefix followed by
base64 of the compressed bytes. Pass it back to loadFromString
to round-trip.
While a font loads, its text is laid out with another font. When the text’s size follows its
content, a scene saved before the font arrives can differ from one saved after it. To compare two
saved scenes, first await engine.block.forceLoadResources([engine.scene.get()!]). It rejects when a
resource fails to load, and you can still save the scene then.
The source set entries that the engine makes are buffer:// resources that only this engine
holds. onDisallowedResourceScheme gets each of them, whatever allowedResourceSchemes holds.
The save leaves out each entry that the callback did not move to another address, and each
fill keeps them.
Parameters#
| Parameter | Type |
|---|---|
allowedResourceSchemes |
string[] |
onDisallowedResourceScheme? |
(url, dataHash) => Promise<string> |
Returns#
Promise<string>
A promise that resolves with the serialized scene.
Implementation of#
ISceneAPI.saveToStringCall Signature#
saveToString(options?): Promise<string>;Serializes the current scene into a string.
The output is compressed with Zstd by default. The compression option changes
the format and the level. A compressed string has a UBQ2 prefix followed by
base64 of the compressed bytes. With compression: { format: 'None' } the string
has a UBQ1 prefix followed by base64 of the scene JSON. Pass either back to
loadFromString to round-trip.
While a font loads, its text is laid out with another font. When the text’s size follows its
content, a scene saved before the font arrives can differ from one saved after it. To compare two
saved scenes, first await engine.block.forceLoadResources([engine.scene.get()!]). It rejects when a
resource fails to load, and you can still save the scene then.
The source set entries that the engine makes are buffer:// resources that only this engine
holds. onDisallowedResourceScheme gets each of them, whatever allowedResourceSchemes holds.
The save leaves out each entry that the callback did not move to another address, and each
fill keeps them.
Parameters#
| Parameter | Type | Description |
|---|---|---|
options? |
{ allowedResourceSchemes?: string[]; onDisallowedResourceScheme?: (url, dataHash) => Promise<string>; compression?: { format?: CompressionFormat; level?: CompressionLevel; }; abortSignal?: AbortSignal; } |
- |
options.allowedResourceSchemes? |
string[] |
- |
options.onDisallowedResourceScheme? |
(url, dataHash) => Promise<string> |
- |
options.compression? |
{ format?: CompressionFormat; level?: CompressionLevel; } |
Compression applied to the serialized scene. Defaults to Zstd. The result stays a plain string: compressed output carries a “UBQ2” prefix followed by base64 of the compressed bytes, so it is smaller but still safe to store and transmit. |
options.compression.format? |
CompressionFormat |
- |
options.compression.level? |
CompressionLevel |
- |
options.abortSignal? |
AbortSignal |
Stops a save that waits for onDisallowedResourceScheme. |
Returns#
Promise<string>
A promise that resolves with the serialized scene.
Implementation of#
ISceneAPI.saveToStringSignatures#
saveToString(allowedResourceSchemes: string[], onDisallowedResourceScheme?: (url: string, dataHash: string) => Promise<string>): Promise<string>saveToString(options?: object): Promise<string>saveToArchive()#
Saves the current scene and all of its referenced assets into an archive.
While a font loads, its text is laid out with another font. When the text’s size follows its
content, a scene archived before the font arrives can differ from one archived after it. To compare
two archives, first await engine.block.forceLoadResources([engine.scene.get()!]), then compare the
scene.scene files inside them. Each archive entry stores the time of the save.
forceLoadResources rejects when a resource fails to load, and you can still save the scene then.
Parameters#
| Parameter | Type | Description |
|---|---|---|
options? |
SaveToArchiveOptions |
Optional settings: - compression: Compression applied to the scene inside the archive. Bundled media is always stored uncompressed, because it already is in compressed formats. - abortSignal: Stops the save. |
Returns#
Promise<Blob>
A promise that resolves with a Blob.
Implementation of#
ISceneAPI.saveToArchiveSignature#
saveToArchive(options?: SaveToArchiveOptions): Promise<Blob>createFromImage()#
Loads the given image and creates a scene with a single page showing the image.
Parameters#
| Parameter | Type |
|---|---|
url |
string |
dpi? |
number |
pixelScaleFactor? |
number |
sceneLayout? |
string |
spacing? |
number |
spacingInScreenSpace? |
boolean |
options? |
AbortOptions |
Returns#
Promise<number>
Remarks#
The 4th/5th/6th args (sceneLayout, spacing,
spacingInScreenSpace) are part of @cesdk/engine’s signature and
accepted here for shape parity. The C++ binding currently hardcodes
Free/0.f/false; non-default values are not yet plumbed
through. A warning is emitted when a caller passes a non-default
value so the discrepancy is visible.
Implementation of#
ISceneAPI.createFromImageSignature#
createFromImage(url: string, dpi?: number, pixelScaleFactor?: number, sceneLayout?: string, spacing?: number, spacingInScreenSpace?: boolean, options?: AbortOptions): Promise<number>createFromVideo()#
Loads the given video and creates a scene with a single page showing the video.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The video URL. |
options? |
AbortOptions |
- |
Returns#
Promise<number>
A promise that resolves with the scene ID.
Implementation of#
ISceneAPI.createFromVideoSignature#
createFromVideo(url: string, options?: AbortOptions): Promise<number>applyTemplateFromString()#
Applies the contents of the given template scene to the currently loaded scene.
The scene keeps its variables, value sets and active set, and gains the variables and value sets of the template
that it lacks.
Parameters#
| Parameter | Type | Description |
|---|---|---|
content |
string |
The template scene file contents, a base64 string. |
Returns#
Promise<void>
A Promise that resolves once the template was applied.
Implementation of#
ISceneAPI.applyTemplateFromStringSignature#
applyTemplateFromString(content: string): Promise<void>applyTemplateFromURL()#
Applies the contents of the given template scene to the currently loaded scene.
The scene keeps its variables, value sets and active set, and gains the variables and value sets of the template
that it lacks.
Parameters#
| Parameter | Type | Description |
|---|---|---|
url |
string |
The url to the template scene file. |
options? |
AbortOptions |
An abortSignal that stops the download of the template. The current scene stays then. |
Returns#
Promise<void>
A Promise that resolves once the template was applied.
Implementation of#
ISceneAPI.applyTemplateFromURLSignature#
applyTemplateFromURL(url: string, options?: AbortOptions): Promise<void>setDesignUnit()#
Converts all values of the current scene into the given design unit.
Parameters#
| Parameter | Type | Description |
|---|---|---|
designUnit |
"Pixel" |
"Millimeter" |
Returns#
void
Implementation of#
ISceneAPI.setDesignUnitSignature#
setDesignUnit(designUnit: "Pixel" | "Millimeter" | "Inch"): voidgetDesignUnit()#
Returns the design unit of the current scene.
Returns#
"Pixel" | "Millimeter" | "Inch"
The current design unit.
Implementation of#
ISceneAPI.getDesignUnitSignature#
getDesignUnit(): "Pixel" | "Millimeter" | "Inch"setFontSizeUnit()#
Sets the unit (‘Pixel’ | ‘Point’) in which the current scene’s font sizes
are interpreted at the API boundary (setTextFontSize / getTextFontSizes).
The engine stores font sizes in points internally.
Parameters#
| Parameter | Type | Description |
|---|---|---|
unit |
"Pixel" |
"Point" |
Returns#
void
Implementation of#
ISceneAPI.setFontSizeUnitSignature#
setFontSizeUnit(unit: "Pixel" | "Point"): voidgetFontSizeUnit()#
Returns the font-size unit of the current scene (‘Pixel’ | ‘Point’).
Returns#
"Pixel" | "Point"
The current font-size unit.
Implementation of#
ISceneAPI.getFontSizeUnitSignature#
getFontSizeUnit(): "Pixel" | "Point"setAngleUnit()#
Sets the unit (‘Radian’ | ‘Degree’) in which angles are interpreted on the
current scene: the values of every angle property for setFloat / getFloat
(rotation, transform/skew, effect/linear_wipe/angle, …), their keyframe
values, and setRotation / getRotation. The engine stores angles in radians
and scene files keep their format; this only affects how values are
interpreted at the API boundary. ‘Radian’ is the default.
CE.SDK uses radians for every angle property in memory and in the API. The
‘Degree’ unit is a compatibility option for older integrations, and the
CE.SDK editor UI expects radians. motionBlur/shutterAngle,
motionBlur/shutterPhase and the rotate action take degrees in either
unit. Changing the unit also converts a number variable bound only to angle
properties.
Parameters#
| Parameter | Type | Description |
|---|---|---|
unit |
"Radian" |
"Degree" |
Returns#
void
Implementation of#
ISceneAPI.setAngleUnitSignature#
setAngleUnit(unit: "Radian" | "Degree"): voidgetAngleUnit()#
Returns the angle unit of the current scene (‘Radian’ | ‘Degree’).
Returns#
"Radian" | "Degree"
The current angle unit.
Implementation of#
ISceneAPI.getAngleUnitSignature#
getAngleUnit(): "Radian" | "Degree"setPlaying()#
Start or stop playback of the current page.
Parameters#
| Parameter | Type |
|---|---|
play |
boolean |
Returns#
void
Signature#
setPlaying(play: boolean): voidgetLayout()#
Get the layout of the current scene.
Returns#
"Free" | "VerticalStack" | "HorizontalStack" | "DepthStack"
The current layout of the scene.
Implementation of#
ISceneAPI.getLayoutSignature#
getLayout(): "Free" | "VerticalStack" | "HorizontalStack" | "DepthStack"setLayout()#
Set the layout of the current scene.
Parameters#
| Parameter | Type | Description |
|---|---|---|
layout |
string |
The new layout for the scene. |
Returns#
void
Implementation of#
ISceneAPI.setLayoutSignature#
setLayout(layout: string): voidaddMarker()#
Add a marker to the end of the current scene’s marker list.
Parameters#
| Parameter | Type | Description |
|---|---|---|
name |
string |
The name of the marker. Several markers may share a name. |
time |
number |
The start of the marker in seconds. Must not be negative. |
duration? |
number |
The length of the marker in seconds. Defaults to 0, a single point. |
Returns#
void
Implementation of#
ISceneAPI.addMarkerSignature#
addMarker(name: string, time: number, duration?: number): voidgetMarkers()#
Get the markers of the current scene in the order they were added.
Returns#
The markers of the scene.
Implementation of#
ISceneAPI.getMarkersSignature#
getMarkers(): SceneMarker[]removeMarker()#
Remove a marker from the current scene.
Parameters#
| Parameter | Type | Description |
|---|---|---|
index |
number |
The index of the marker in the list that getMarkers returns. |
Returns#
void
Implementation of#
ISceneAPI.removeMarkerSignature#
removeMarker(index: number): voidgetPages()#
Get the sorted list of pages in the scene.
Returns#
number[]
The sorted list of pages in the scene.
Implementation of#
ISceneAPI.getPagesSignature#
getPages(): number[]addPage()#
Add a new page to the scene.
Parameters#
| Parameter | Type | Description |
|---|---|---|
scene? |
number |
Optional scene ID. If not provided, uses the current scene. |
Returns#
number
The ID of the newly created page.
Signature#
addPage(scene?: number): numbergetCurrentPage()#
Get the current page.
Returns#
number
The current page in the scene or null when there is no scene available or no current page is set.
Implementation of#
ISceneAPI.getCurrentPageSignature#
getCurrentPage(): numbersetCurrentPages()#
Set the pages that single page mode shows. All other pages leave the view but
stay in the document and in the saved file.
Takes visible effect while the setting features/singlePageModeEnabled is enabled.
Exporting a page holds that page, even while it is out of view. Exporting a scene holds
every page, except pages hidden with block.setVisible.
A page slice shows its page, but only inside the clip rectangle of the page slice.
The camera does not move to a shown block. Call scene.zoomToBlock to bring it into view.
A block that a move puts on a page slice out of view is not drawn and loses its selection.
Set a movement constraint on the shown page slice to keep its blocks inside it.
Parameters#
| Parameter | Type | Description |
|---|---|---|
pages |
number[] |
The pages to show. Two pages form a facing-page view. Each page must be distinct. |
Returns#
void
Implementation of#
ISceneAPI.setCurrentPagesSignature#
setCurrentPages(pages: number[]): voidgetCurrentPages()#
Get the pages that single page mode shows.
Returns#
number[]
The shown pages and page slices, or an empty list when the setting
features/singlePageModeEnabled is disabled.
Implementation of#
ISceneAPI.getCurrentPagesSignature#
getCurrentPages(): number[]findNearestToViewPortCenterByType()#
Find all blocks with the given type sorted by the distance to viewport center.
Parameters#
| Parameter | Type | Description |
|---|---|---|
type |
DesignBlockType |
The type to search for. |
Returns#
number[]
A list of block ids sorted by distance to viewport center.
Signature#
findNearestToViewPortCenterByType(type: DesignBlockType): number[]findNearestToViewPortCenterByKind()#
Find all blocks with the given kind sorted by the distance to viewport center.
Parameters#
| Parameter | Type | Description |
|---|---|---|
kind |
string |
The kind to search for. |
Returns#
number[]
A list of block ids sorted by distance to viewport center.
Signature#
findNearestToViewPortCenterByKind(kind: string): number[]setZoomLevel()#
Set the zoom level of the scene.
Parameters#
| Parameter | Type | Description |
|---|---|---|
zoomLevel? |
number |
The new zoom level. |
Returns#
void
Signature#
setZoomLevel(zoomLevel?: number): voidgetZoomLevel()#
Get the zoom level of the scene.
Returns#
number
The zoom level of the scene.
Signature#
getZoomLevel(): numberzoomToBlock()#
Sets the zoom and focus to show a block, optionally with animation.
This only shows an effect if the zoom level is not handled/overwritten by the UI.
Without padding, this results in a tight view on the block.
Parameters#
| Parameter | Type | Description |
|---|---|---|
id |
number |
The block that should be focused on. |
options? |
ZoomOptions |
Configuration for padding and animation. |
Returns#
Promise<void>
A promise that resolves once the zoom was set or rejects with an error otherwise.
Call Signature#
zoomToBlock( id, paddingLeft?, paddingTop?, paddingRight?,paddingBottom?): Promise<void>;Sets the zoom and focus to show a block.
This only shows an effect if the zoom level is not handled/overwritten by the UI. Without padding, this results in a tight view on the block.
Parameters#
| Parameter | Type | Description |
|---|---|---|
id |
number |
The block that should be focused on. |
paddingLeft? |
number |
Optional padding in screen pixels to the left of the block. |
paddingTop? |
number |
Optional padding in screen pixels to the top of the block. |
paddingRight? |
number |
Optional padding in screen pixels to the right of the block. |
paddingBottom? |
number |
Optional padding in screen pixels to the bottom of the block. |
Returns#
Promise<void>
A promise that resolves once the zoom was set or rejects with an error otherwise.
Deprecated#
Use zoomToBlock with options object instead
Signatures#
zoomToBlock(id: number, options?: ZoomOptions): Promise<void>zoomToBlock(id: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>disableZoomAutoFit()#
Disables any previously set zoom auto-fit.
Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene |
number |
The scene or a block in the scene. |
Returns#
void
Signature#
disableZoomAutoFit(blockOrScene: number): voidisZoomAutoFitEnabled()#
Queries whether zoom auto-fit is enabled for the given block.
Parameters#
| Parameter | Type | Description |
|---|---|---|
blockOrScene |
number |
The scene or a block in the scene. |
Returns#
boolean
True if auto-fit is set, false otherwise.
Signature#
isZoomAutoFitEnabled(blockOrScene: number): booleanunstable_enableCameraPositionClamping()#
Continually clamp the camera position so that the given blocks stay within view (with optional padding).
Parameters#
| Parameter | Type |
|---|---|
blocks |
number[] |
paddingLeft? |
number |
paddingTop? |
number |
paddingRight? |
number |
paddingBottom? |
number |
scaledPaddingLeft? |
number |
scaledPaddingTop? |
number |
scaledPaddingRight? |
number |
scaledPaddingBottom? |
number |
Returns#
void
unstable_enableCameraZoomClamping()#
Continually clamp the camera zoom level to the range
[minZoomLimit, maxZoomLimit] while showing the given blocks (with
optional padding).
Parameters#
| Parameter | Type |
|---|---|
blocks |
number[] |
minZoomLimit? |
number |
maxZoomLimit? |
number |
paddingLeft? |
number |
paddingTop? |
number |
paddingRight? |
number |
paddingBottom? |
number |
Returns#
void