Commit Graph

8965 Commits

Author SHA1 Message Date
David Capello
33a6a1c97e Add some tests for all_elements_of_same_type() function 2023-02-22 15:59:03 -03:00
David Capello
8f5e8256cf Replace INT/UINT_COMPATIBLE/IS_REDUCIBLE_INT macros w/templates 2023-02-22 15:58:47 -03:00
David Capello
70a388177d Move code related to UserData::Variants to doc/user_data.cpp
Only code that is related to <iostream> IO is in _io.cpp files.
2023-02-22 15:22:35 -03:00
Martín Capello
a7b5ab24bb Add (int) cast to constant to avoid issue with MSVC jumping the condition when it shouldn't 2023-02-22 12:51:51 -03:00
Martín Capello
062d1d922c Reduce the size of integer representations when possible 2023-02-22 12:51:51 -03:00
Martín Capello
47a1c407c3 Update the way vectors are serialized to support mixed elements types 2023-02-22 12:51:51 -03:00
Martín Capello
8b547adfb7 Update vector spec to support mixed types of elements 2023-02-22 12:51:51 -03:00
Gaspar Capello
fae3c6566c Fix don't create new tiles on tilemap layer in an empty cel with hasTileManagementPlugin. 2023-02-22 12:21:36 -03:00
David Capello
02b273d933 Remove some unused member functions from Timeline 2023-02-16 17:21:39 -03:00
David Capello
c70cb0d882 Minor rewording in the .aseprite specs 2023-02-16 17:20:12 -03:00
David Capello
64ce25fae2 Add property to disable the standard tilemap UI
Added a Sprite.tileManagementPlugin property for plugins that want to
replace the standard tilemap/tileset interface. This includes a new
external file field in .aseprite files to specify that the sprite
tiles are controlled by a specific plugin.

Once this property is set, the standard tilemap/tileset modes
selectors will disappear and the only way to make then available will
be setting this property to nil/empty string again.

Fix https://github.com/aseprite/Attachment-System/issues/21
2023-02-15 18:55:21 -03:00
David Capello
9475ff67d4 Update laf module 2023-02-14 13:54:32 -03:00
David Capello
ccef9cee4f Cache compressed tileset information from .aseprite files on memory
We've added an experimental option (enabled by default) to keep the
compressed tileset data when we load/save a .aseprite file to avoid
recompressing each time we save (and only compressing the tileset if
tiles are modified).

This is an attempt to make the save operation faster when we use
sprites with several tilemap layers + large tilesets (many tiles, with
big tiles).

Reference: https://github.com/aseprite/Attachment-System/issues/54
2023-02-14 13:03:06 -03:00
David Capello
6603775368 Minor refactor in .aseprite decoder/encoder
We've tested writing uncompressed tilesets, it's too slow for big
tilesets. Anyway read_raw_image/write_raw_image now support saving
uncompressed tilemaps if necessary in the future.
2023-02-14 12:29:49 -03:00
David Capello
eee79f5520 Don't access Preferences instance from dio::DecodeDelegate impl 2023-02-14 12:12:57 -03:00
David Capello
a5a1d22705 Add some tests to encode/decode tile properties 2023-02-13 17:21:42 -03:00
David Capello
1b3998af01 Minor change in doc::Tileset internal structure
Merged m_tiles and m_datas in one vector.
2023-02-13 17:20:40 -03:00
David Capello
57e43c76b8 Detect scripts that modify a sprite when we are undoing/redoing 2023-02-09 07:43:33 -03:00
David Capello
67bb8f49ea Remove unused parameter in NEED_BAR() macro 2023-02-02 11:54:13 -03:00
David Capello
28749edf10 Fix segfault with -save-as between gif -> qoi from CLI
This can happen when any fatal error happens in
createSaveDocumentOperation(). The function must return nullptr to
stop the operation and avoid the regular saving process. This is
already checked in the GUI, but we have to do the same when the fatal
error happens from the CLI.
2023-02-02 11:50:34 -03:00
Martín Capello
45ce79e594
Merge pull request #3682 from aseprite/tile-set-image
[lua] Add Tile_set_image method
2023-01-27 10:01:25 -03:00
Gaspar Capello
e56a78e0d6 [lua] Add Tile_set_image method 2023-01-25 17:12:26 -03:00
David Capello
98f2964f6f Add Widget::setMinMaxSize() to set min/max size at the same time (fix #3652) 2023-01-18 11:39:00 -03:00
David Capello
0775b0d8ba Take care of an empty tileset in doc::Tilesets collection
We cannot delete a tileset yet from Aseprite UI, but now an extension
can do it through Sprite:deleteTileset(). Deleting the non-last
tileset will create an Tilesets array with an empty (nullptr) slot on
it (so tileset indexes are not changed, and for the future, if some
external file is referencing that tileset index, the reference will be
kept).

Related to https://github.com/aseprite/Attachment-System/issues/19
2023-01-17 17:49:21 -03:00
David Capello
6080af5346 Keep/restore the timeline position for each sprite/DocView (fix #3676)
In this way the store (in memory) the exact timeline position for each
DocView. Useful when editing multiple sprites and the timeline jumps
from one side to another.
2023-01-17 17:17:57 -03:00
David Capello
f536327fc1 Add app.transaction(string, function) overload
In this way we can specify the transaction/undo-redo label from a
script.
2023-01-17 15:39:16 -03:00
Gaspar Capello
e0aaa76e9c Add warning to Sprite:newTile() and Sprite:deleteTile()
Now, if the tileset does not belong to the sprite object, the lua engine throws an error. Also added a warning when tile_index = 0 on Sprite:deleteTile()
2023-01-16 10:42:31 -03:00
David Capello
60034267e1 Merge branch 'save-restore-userdata-undo-backup' (fix #3633) 2023-01-16 10:34:43 -03:00
David Capello
faabacdd39 [lua] Fix undo/redo of tileset properties changes (name/baseIndex) 2023-01-13 19:16:15 -03:00
David Capello
11a3e634b1 Fix bug undoing tileset deletion wasn't restoring its name correctly
Actually it looks like a long-standing bug in the write/read_tileset()
functions where tileset names aren't saved (so another bug fixed with
this change is that restoring a tileset from a crashes session/file,
will restore the tileset name correctly).
2023-01-13 18:54:31 -03:00
Martín Capello
f9843ac0f9 Remove ase_file_write_properties to be consistent with decoding 2023-01-12 17:15:30 -03:00
Martín Capello
5823abd1c0 Add serialization of custom properties 2023-01-12 17:15:25 -03:00
David Capello
705cc3af50 Fix assert failing when drawing an image with empty source bounds 2023-01-12 16:20:53 -03:00
Martín Capello
6d4e699601 Fix warning because AsepriteExternalFiles is declared as a class now 2023-01-12 14:59:15 -03:00
Martín Capello
f976c9f195 Convert countNonEmptyPropertiesMaps to a global function count_nonempty_properties_maps 2023-01-12 14:59:15 -03:00
David Capello
c910efe2f4 Fix compilation on Windows, now Button::Click doesn't receive an Event& 2023-01-12 13:01:56 -03:00
David Capello
5953e93402 [lua] Add possibility to display a Dialog as a popup menu
* Added new Dialog:menuItem{} widget
* Added Dialog:showMenu{} function
2023-01-12 11:09:05 -03:00
David Capello
39d1fb56d4 Remove ui::Event& args from ui::Button::Click signal
This is to simplify code and to match ui::MenuItem::Click and
ui::Button::Click signals (so then we can write some generic code
using Button::Click or MenuItem::Click).
2023-01-12 11:00:16 -03:00
David Capello
9678cc4ac3 [lua] Alternative Sprite:deleteTile(tileset, tileIndex) syntax 2023-01-12 09:32:44 -03:00
Gaspar Capello
f82ab4f3d9 Fix tilemapMode parameter of a few useTool methods on tilemap.lua tests 2023-01-12 09:29:07 -03:00
Gaspar Capello
0ab6f9681d Tests for Sprite:newTile() and Sprite:deleteTile() methods 2023-01-12 09:28:33 -03:00
Martín Capello
7e16b49644 Add tileset creation/deletion tests in lua 2023-01-12 09:25:43 -03:00
David Capello
9c728d2cac [lua] Add Tile.index getter 2023-01-12 09:21:05 -03:00
David Capello
a6c1b2bc88 [lua] Add a way to set the tileset associated to a layer tilemap 2023-01-11 10:48:39 -03:00
Gaspar Capello
822357869a Add new/delete tiles from a tileset using Lua (fix #3663) 2023-01-11 10:23:52 -03:00
Martín Capello
c299be50a5 Add a way to create and delete tilesets using Lua 2023-01-11 10:02:20 -03:00
Martín Capello
9910ab73f0 Fix Grid creation to return the new Grid instead of the default one 2023-01-11 10:02:18 -03:00
David Capello
453d9c2168 [lua] Add possibility to create dialogs without titlebar 2023-01-11 09:46:21 -03:00
David Capello
f5a79ce3b8 [lua] Add possibility to specify parent dialog 2023-01-11 09:38:19 -03:00
David Capello
7460e5f830 [lua] Add support to paint horizontal/vertical theme parts (e.g. separators) 2023-01-10 16:58:28 -03:00