Apply a Template to a Scene
In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to apply the contents of a given template scene to the currently loaded scene 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.
Applying Template Scenes#
applyTemplateFromString(content: string): Promise<void>
Applies the contents of the given template scene to the currently loaded scene. This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
content
: The template scene file contents, a base64 string.- Returns A Promise that resolves once the template was applied or rejects if there was an error.
applyTemplateFromURL(url: string): Promise<void>
Applies the contents of the given template scene to the currently loaded scene. This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
url
: The url to the template scene file.- Returns A Promise that resolves once the template was applied or rejects if there was an error.
get(): DesignBlockId | null
Return the currently active scene.
- Returns The scene or null, if none was created yet.