Change Settings
In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to control with the editor
API.
A list of all available settings can be found on the Settings page.
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.
Exploration#
findAllSettings(): string[]
Returns a list of all the settings available.
- Returns A list of settings keypaths.
getSettingType(keypath: string): SettingType
Returns the type of a setting.
keypath
: The settings keypath, e.g.role
.- Returns The setting type.
Functions#
onSettingsChanged: (callback: () => void) => (() => void)
Subscribe to changes to the editor settings.
callback
: This function is called at the end of the engine update, if the editor settings have changed.- Returns A method to unsubscribe.
setSettingBool(keypath: SettingsBool, value: boolean): void
Set a boolean setting.
keypath
: The settings keypath, e.g.doubleClickToCropEnabled
value
: The value to set.- Throws An error, if the keypath is invalid.
getSettingBool(keypath: SettingsBool): boolean
Get a boolean setting.
keypath
: The settings keypath, e.g.doubleClickToCropEnabled
- Throws An error, if the keypath is invalid.
setSettingInt(keypath: string, value: number): void
Set an integer setting.
keypath
: The settings keypath.value
: The value to set.- Throws An error, if the keypath is invalid.
getSettingInt(keypath: string): number
Get an integer setting.
keypath
: The settings keypath.- Throws An error, if the keypath is invalid.
setSettingFloat(keypath: SettingsFloat, value: number): void
Set a float setting.
keypath
: The settings keypath, e.g.positionSnappingThreshold
value
: The value to set.- Throws An error, if the keypath is invalid.
getSettingFloat(keypath: SettingsFloat): number
Get a float setting.
keypath
: The settings keypath, e.g.positionSnappingThreshold
- Throws An error, if the keypath is invalid.
setSettingString(keypath: SettingsString, value: string): void
Set a string setting.
keypath
: The settings keypath, e.g.license
value
: The value to set.- Throws An error, if the keypath is invalid.
getSettingString(keypath: SettingsString): string
Get a string setting.
keypath
: The settings keypath, e.g.license
- Throws An error, if the keypath is invalid.
setSettingColor(keypath: SettingsColor, value: Color): void
Set a color setting.
keypath
: The settings keypath, e.g.highlightColor
.value
: The The value to set.
getSettingColor(keypath: SettingsColor): Color
Get a color setting.
keypath
: The settings keypath, e.g.highlightColor
.- Throws An error, if the keypath is invalid.
setSettingEnum<T extends keyof SettingsEnum>(keypath: T, value: SettingsEnum[T]): void
Set an enum setting.
keypath
: The settings keypath, e.g.role
.value
: The enum value as string.
getSettingEnum<T extends keyof SettingsEnum>(keypath: T): SettingsEnum[T]
Get an enum setting.
keypath
: The settings keypath, e.g.role
.- Returns The value as string.
getSettingEnumOptions<T extends keyof SettingsEnum>(keypath: T): string[]
Get the possible enum options for a given enum setting.
keypath
: The settings keypath, e.g.role
.- Returns The possible enum options as strings.