Commit Graph

8900 Commits

Author SHA1 Message Date
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
David Capello
9e34656694 Fix saving the properties maps when there is an empty map
The exact number of maps specified in the header of the properties
chunk must be saved in the chunk data.
2023-01-09 15:55:09 -03:00
David Capello
0387337100 Test that saving empty property maps corrupt the .aseprite file 2023-01-09 15:54:30 -03:00
David Capello
e66985a06a Minor change in ase_file_write_property_value() to use variant type
Using a switch/case is better to decide the variant type (instead of
casting type by type).
2023-01-09 15:52:00 -03:00
David Capello
dd33cef4be Store one time each extension name in the external files chunk in .aseprite files
We've refactored the AsepriteExternalFiles struct to make it a
class (hiding members), storing maps ID -> filename per file
type (e.g. so we don't mix external tileset filenames with extensions
names, etc.), and re-using IDs for extensions names with the same
name (there is no need to store the same extension name multiple times
in the external files chunk).
2023-01-09 14:49:37 -03:00
David Capello
4232410719 Simplify AsepriteExternalFiles using one std::map for filenames/types 2023-01-09 12:53:06 -03:00
David Capello
bb3ba19fc6 Minor changes in .aseprite decoder/encoder to avoid depending on exceptions to control flow 2023-01-09 12:53:04 -03:00
David Capello
178702730b Update INSTALL instructions to install clang on Ubuntu (fix #3650) 2023-01-09 09:47:28 -03:00
David Capello
9b853fc672 Update INSTALL minimum platforms used 2023-01-09 09:47:14 -03:00
David Capello
81b2507bb6 [lua] Add Tileset:tile(tileIndex) API to get tile image/data/properties (fix #3653)
This should replace the old Tileset:getTile(tileIndex) which returns
only the image.
2023-01-06 19:50:04 -03:00
Martín Capello
6534d37b40 Add custom properties serialization/deserialization lua tests 2023-01-06 19:28:02 -03:00
David Capello
d590d3f39a Add nullptr_t to doc::UserData::Variant to fix bug when undoing an previously unexistent property 2023-01-06 14:36:51 -03:00
David Capello
8f09728105 Merge branch 'custom-properties-serialization' (fix #3632, #3645) 2023-01-06 10:03:19 -03:00
Martín Capello
b00b96877a Remove unused include 2023-01-06 10:02:14 -03:00
David Capello
f5bc573bfc Remove base::thread, we use std::thread 2023-01-05 16:43:09 -03:00
David Capello
177f42898a Replace std::stringstream() with fmt::format() 2023-01-05 16:35:24 -03:00