Variable Api
Functions
Create an empty value set in the scene. A value set holds alternative values for some scene variables. Write them with the target parameter of the setters. The scene saves its sets, and undo reverts their changes. Experimental: this API may change in a minor release.
Destroy a value set and its values. When the set is active, no set is active afterwards, and text and bound properties show the default values again. Experimental: this API may change in a minor release.
Get all variables of one type. Note that findAll returns only text variables. Experimental: this API may change in a minor release.
Get the value sets of the scene. Experimental: this API may change in a minor release.
Find a value set by its name. Experimental: this API may change in a minor release.
Get the active value set. Experimental: this API may change in a minor release.
Get the type of the shown value of a variable. Same as getType with no target.
Get the type of a variable. Experimental: this API may change in a minor release.
Get the shown value of a typeface variable. Same as getTypeface with no target.
Get a typeface variable. Experimental: this API may change in a minor release.
Get the name of a value set. Experimental: this API may change in a minor release.
Destroy a variable with its value in every value set. Same as remove with no target.
Destroy a variable of any type. Bound properties keep their last value and their binding, so direct writes to them still fail with BLOCK.PROPERTY_BOUND. Setting a variable with the same key and type again makes them follow it again.
Rename a variable of any type. The value, the type and the values in every value set move to the new key. Every block property bound to the variable follows the new key and keeps its value. For a text variable, every {{key}} token in text blocks and page titles is rewritten too. A key inside a longer expression or a statement, such as {% if key %}, is not renamed. Experimental: this API may change in a minor release.
Set a text variable in the layer that the scene shows. Same as set with no target.
Set a text variable. The key must not be "scene_root" or start with "ubq.", because those name the built-in placeholders. The scene saves its variables, and undo reverts their changes. A variable set while no scene exists waits for the next scene. That scene takes it when it is created or loaded, as this setter without a target writes it. A value of another type than the loaded variable is dropped.
Activate a value set, or no set. The values of the active set win over the default values in text, bound properties and getters. Exports show the active set, as the canvas does. A scene has one active set, and saves it. Undo reverts the change. Experimental: this API may change in a minor release.
Set a color variable in the layer that the scene shows. Same as setColor with no target.
Set a color variable. Creates the variable if no variable has this key. Every block property bound to the variable takes the value that the scene shows. If a bound property rejects the value, the call throws its error, but the variable and the other bound properties change anyway. Experimental: this API may change in a minor release.
Set an image variable in the layer that the scene shows. Same as setImage with no target.
Set an image variable. Creates the variable if no variable has this key. Every block property bound to the variable takes the URI that the scene shows. If a bound property rejects the value, the call throws its error, but the variable and the other bound properties change anyway. Experimental: this API may change in a minor release.
Set a number variable in the layer that the scene shows. Same as setNumber with no target.
Set a number variable. Creates the variable if no variable has this key. Every block property bound to the variable takes the value that the scene shows. If a bound property rejects the value, the call throws its error, but the variable and the other bound properties change anyway. Experimental: this API may change in a minor release.
Set a typeface variable in the layer that the scene shows. Same as setTypeface with no target.
Set a typeface variable. Creates the variable if no variable has this key. Every text block whose typeface is bound to the variable takes the typeface that the scene shows, over its whole text. Bold and italic text keeps its formatting where the typeface supports it. If a bound property rejects the value, the call throws its error, but the variable and the other bound properties change anyway. Experimental: this API may change in a minor release.
Rename a value set. The id stays, and an active set stays active. Experimental: this API may change in a minor release.