Commit Graph

35 Commits

Author SHA1 Message Date
David Capello
622b02294a [lua] Add short field names (fix #3815, fix #3816) 2023-04-19 13:48:15 -03:00
David Capello
1c6e583c87 [lua] Add require() function (fix aseprite/api#10)
This is the first attempt to finally implement the require() function
on Lua. The main problem was how to solve conflicts between plugins
that use the same library name. Here we separate each plugin like in a
namespace, so require(name) inside a plugin will save the module in
_LOADED["pluginName/libraryName"] to avoid conflicts with other
libraryName from other plugins.
2023-04-18 19:41:01 -03:00
David Capello
8ff62f7a5f [lua] Add Uuid tests
Missing file from 636cce6f0d commit
2023-04-18 07:41:32 -03:00
Gaspar Capello
d4d18c99be [lua] Add Image:clear(Rectangle, color) overload (fix #3799)
We can use:

  Image:clear()
  Image:clear(color)
  Image:clear(rectangle)
  Image:clear(rectangle, color)

If the color is not specified it will be the transparent color of the
image.

Co-authored-by: David Capello <david@igara.com>
2023-04-12 15:30:12 -03:00
David Capello
24846eae10 Add z-index property to cels (fix aseprite/Attachment-System#88)
* Now a Cel has a z-index property to change the order of layers per frame
* A new doc::RenderPlan class can calculate the order of cels to be rendered
* z-index is saved as a int16_t in the .aseprite files
* This new field can be set/get from Lua with Cel.zIndex
2023-04-10 19:23:16 -03:00
Gaspar Capello
8f515da9f0 Fix 8 Connected Fill escapes grid with "Stop At Grid" checked (fix #3564) 2023-03-28 13:45:33 -03:00
Gaspar Capello
637632eafb [lua] Add blend modes to Image:drawImage() 2023-03-27 20:31:58 -03:00
David Capello
88296340a6 [lua] Add Size:union() function 2023-03-13 16:03:03 -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
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
a5a1d22705 Add some tests to encode/decode tile properties 2023-02-13 17:21:42 -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
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
0387337100 Test that saving empty property maps corrupt the .aseprite file 2023-01-09 15:54:30 -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
645605305f [lua] Add undo information when we modify user data properties 2023-01-03 11:14:19 -03:00
David Capello
427efef257 [lua] Add possibility to set the whole properties object 2023-01-03 09:00:36 -03:00
David Capello
b9537dbbe0 [lua] Add object.properties("extID") syntax to get extension properties 2023-01-03 08:34:14 -03:00
David Capello
9138592e98 [lua] Add support to set/get tables (arrays/maps) into user properties 2023-01-02 19:51:07 -03:00
David Capello
9f0491ddb6 [lua] Add support to iterate properties using pairs() 2023-01-02 14:36:49 -03:00
David Capello
ef0596fd01 [lua] Add __len operator to Properties 2023-01-02 12:54:37 -03:00
David Capello
76a398b162 [lua] Add access to user data properties in Sprite object (aseprite/api#88)
This is a basic implementation where we can only access basic
properties (not maps or vectors yet).
2023-01-02 12:54:37 -03:00
David Capello
8447a097c6 [lua] Add Image.id and Image.version getters 2022-12-26 17:20:27 -03:00
David Capello
909ebd6dcb [lua] New Rectangle(point, size) constructor 2022-12-21 13:01:03 -03:00
David Capello
4d880bd5b7 [lua] Add Rectangle.origin and Rectangle.size properties 2022-12-20 18:04:51 -03:00
David Capello
f50bbff5d4 Minor formatting in rectangle.lua tests 2022-12-20 17:52:16 -03:00
David Capello
914e14377c [lua] Add Image.bounds and Image:shrinkBounds() 2022-12-19 12:27:30 -03:00
David Capello
bd674dcb31 Add user data to tilesets (only logic side + scripting properties)
There is no UI yet to set Tileset user data (color and text).
2022-11-08 19:23:56 -03:00
David Capello
38c0400927 Fix Doc::isModified() when we are in a similar UndoState to the saved one
If the current UndoState doesn't modify the "saved state" (e.g. there
is a sequence of undoes/redoes that doesn't modify the saved version
of the sprite compared to the current one), we can indicate that we
are in the saved state anyway (!Doc::isModified).
2022-11-02 09:58:18 -03:00
David Capello
c7cafca69a Merge remote-tracking branch 'tests/main' 2022-10-25 15:30:38 -03:00