set_properties
Store custom properties on sprite, layer, cel, tag, slice, or tile objects to embed game metadata like hitboxes directly in the .aseprite file.
Instructions
Store a custom property on an object inside the sprite, in the .aseprite file.
This is where game metadata belongs: a hitbox on a slice, an anchor point on a layer,
"this frame deals damage" on a cel, a surface kind on a tile. It travels with the art
instead of living in a sidecar file that the next edit desynchronises, and the editor
shows it and keeps it.
Args:
target: Which kind of object: "sprite", "layer", "cel", "tag", "slice" or "tile".
key: The property name, e.g. "hitbox".
value: What to store. Text by default, so value="7" stores the two-character
string "7". Pass as_json=True to store a number, a boolean or a structure:
then "7" stores the number 7, "true" stores a boolean, and
'{"x": 8, "y": 15}' stores a table. A value that begins like a JSON object or
array is read as JSON either way, since there is no other reading of one.
layer: The layer's name. Needed for target "layer", "cel" and "tile".
frame: 1-based frame number, for target "cel" (default: the first frame).
name: The tag's or slice's name, for target "tag" and "slice".
tile: An index into the layer's tileset, for target "tile". 0 is the empty tile.
namespace: Keep the property in a named group rather than in the unnamed one the
editor's own property panel uses. Two tools can then both use the key
"anchor" without colliding. Namespaces cannot be listed back, so a caller has
to know the name to read one again.
as_json: Parse `value` as JSON before storing it (see `value`).
delete: Remove the property instead of setting it. `value` is then ignored, and
removing a key that was not there is not an error.
A selector the target does not use is refused rather than ignored, because the
property would otherwise land on a different object than the one that was named.
Properties live on the record that linked cels share, so setting one on a held pose
sets it on every frame of the hold. The result says which frames those were.
Returns the whole property group after the write, so the stored value is visible as
the type it was stored as.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| name | No | ||
| tile | No | ||
| frame | No | ||
| layer | No | ||
| value | No | ||
| delete | No | Default: false. | |
| target | Yes | ||
| as_json | No | Default: false. | |
| filename | Yes | ||
| namespace | No |