The asset this object is part of, or null
.
The type of this asset.
File name of the asset.
The signal emitted when fileName changes.
Its first parameter is the new file name, the second parameter is the old file name.
Whether the asset is a TileMap.
Whether the asset is a Tileset.
Whether the asset was modified after it was saved or loaded.
The signal emitted when modified changes.
Whether the object is read-only.
Creates a single undo command that wraps all changes applied to this asset by the given callback. Recommended to avoid spamming the undo stack with small steps that the user does not care about.
Example function that changes visibility of multiple layers in one step:
tileMap.macro((visible ? "Show" : "Hide") + " Selected Layers", function() {
tileMap.selectedLayers.forEach(function(layer) {
layer.visible = visible
})
})
The returned value is whatever the callback function returned.
Returns all custom properties set on this object.
Modifications to the properties will not affect the original object. Does not include inherited values (see resolvedProperties).
Returns the value of the custom property with the given name, or
undefined
if no such property is set on the object. Does not
include inherited values (see resolvedProperty).
file
properties are returned as FilePath.
object
properties are returned as MapObject when possible,
or ObjectRef when the object could not be found.
Redoes the last change that was undone.
Removes the custom property with the given name.
Returns all custom properties set on this object. Modifications to the properties will not affect the original object. Includes values inherited from object types, templates and tiles where applicable.
Returns the value of the custom property with the given name, or
undefined
if no such property is set. Includes values inherited
from object types, templates and tiles where applicable.
Save this asset to disk. Returns true if the asset was saved successfully.
Errors are reported by the UI. When an editor is open for this asset, this editor is activated when an error is reported.
Only supported with the editor running, not when running scripts on the CLI. Also, the asset should already have an associated file.
To save assets to a specific file or in a different format, use tiled.mapFormat or tiled.tilesetFormat. This is currently not supported for worlds.
Sets the value of the custom property with the given name to the given color value.
The color is specified as a string "#RGB", "#RRGGBB" or "#AARRGGBB".
Sets the value of the custom property with the given name to the given color value.
The color is specified by its red, green, blue and alpha components. Each component takes a value from 0 to 255. When not provided, the alpha defaults to 255.
Sets the value of the custom property with the given name to the given float value.
This function is provided as alternative to setProperty, since
that function will set whole numbers as int
properties.
Replaces all currently set custom properties with a new set of properties.
Sets the value of the custom property with the given name.
Supported types are bool
, number
, string
, color,
FilePath, ObjectRef, MapObject and
PropertyValue.
Sets the value of an object's property identified by the given path to the given value.
The path is a list of property names, where each name identifies a member of the previous member's value. The last name in the list identifies the property to set.
Supported types are bool
, number
, string
, color,
FilePath, ObjectRef, MapObject and
PropertyValue.
Undoes the last applied change.
Generated using TypeDoc
Represents any top-level data type that can be saved to a file.
Currently either a TileMap or a Tileset.
For assets that are loaded in the editor, all modifications and modifications to their contained parts create undo commands. This includes both modifying functions that are called as well as simply assigning to a writable property.