You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Asset you get as an argument to MapFormat.write() and TilesetFormap.write() is read-only, which makes it difficult to make temporary last-second changes to the map/tileset. Theoretically one could try to use the assetAboutToBeSaved signals to trigger such changes instead, and undo them after the asset is saved, but no such signals fire on export (see #3984), and a script may need to do substantial changes that might not be easily Undoable, all this makes for unwieldy, overcomplicated scripts.
There are two possible solutions I see:
Make the argument Asset editable. When any export options are applied, it's already a copy, so it could safely be made editable. However, this means a copy would need to be made even when otherwise the original would be passed in, even if the export format doesn't need to make changes to it. Most likely only a minority of custom formats need to make changes to their Asset, so this seems wasteful.
Add Asset.clone(), which creates a deep clone of the Asset. This isn't as intuitive, but it would have wider applications than just export formats, and avoids making unnecessary copies of the saved Asset. If this approach is taken, the write() methods' documentation should mention it as a way to get a modifiable copy of the Asset if one is needed.
The text was updated successfully, but these errors were encountered:
The Asset you get as an argument to
MapFormat.write()
andTilesetFormap.write()
is read-only, which makes it difficult to make temporary last-second changes to the map/tileset. Theoretically one could try to use the assetAboutToBeSaved signals to trigger such changes instead, and undo them after the asset is saved, but no such signals fire on export (see #3984), and a script may need to do substantial changes that might not be easily Undoable, all this makes for unwieldy, overcomplicated scripts.There are two possible solutions I see:
Asset.clone()
, which creates a deep clone of the Asset. This isn't as intuitive, but it would have wider applications than just export formats, and avoids making unnecessary copies of the saved Asset. If this approach is taken, thewrite()
methods' documentation should mention it as a way to get a modifiable copy of the Asset if one is needed.The text was updated successfully, but these errors were encountered: