Commit Graph

89 Commits

Author SHA1 Message Date
Christian Kaiser 3129fda977 [lua] Add missing "DIAGONAL" FlipType (fix #5359) 2025-08-17 14:58:26 -03:00
Christian Kaiser 7331398203 Add app.clipboard Lua API 2025-01-08 12:35:20 -03:00
David Capello 09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
David Capello bf0a47545c Remove #if/endif ENABLE_UI conditional directives (fix #4619)
This was originated for #1279 (CLI-only Aseprite) which can be
achieved with LAF_BACKEND=none anyway.

In this way we simplify the development process, and checking for the
availability of the GUI can be done in run-time through App::isGui()
or Context::isUIAvailable().
2024-09-02 23:16:26 -03:00
David Capello 7ce9f85b39 [lua] Fix bug comparing integers and floating points (fix #4516)
This bug was introduced in:

  db8284f5fc

We've removed the patch in our updated Lua v5.4.6 branch.
2024-06-03 11:39:16 -03:00
David Capello 6f09bde511 Allow backslash (\) in filenames on Linux and macOS (fix #3936)
We required a new app.os object to skip some tests on non-Windows
platforms when we check for backslashes in app.fs functions.
2024-05-08 14:46:16 -03:00
David Capello 4d18200b0c [lua] Fix bugs handling errors inside app.transaction()
This errors was reported in #4431: The Tx wasn't rolled back correctly
in case of a Lua error inside the transaction because Lua needs to be
compiled as C++ to avoid longjmps and support stack
unwinding (i.e. calling destructors).
2024-04-22 11:13:10 -03:00
David Capello 0b55dcdb3a [lua] Close stdin handle when we start running the GUI 2024-04-21 22:37:51 -03:00
David Capello 7172de5007 [lua] Use internal variables to store ptrs to original unsecure functions
Instead of using Lua upvalues/closures.
2024-04-21 13:25:56 -03:00
David Capello 53bb6aceec [lua] Disable loadfile() without args in GUI mode
Waiting for stdin input will hang the program.
2024-04-21 13:14:09 -03:00
David Capello d886e20f6c [lua] Secure io.popen() access (and enable popen on Linux) 2024-04-10 12:01:29 -03:00
Martín Capello 26523156da Improve script engine's exception handling
More details about the implications of this change can be found
in https://github.com/aseprite/aseprite/pull/4057
2023-10-26 11:24:51 -03:00
Martín Capello d21f47f827 [lua] Add selected tab retrieval/selection through Dialog's data and possibility to set the tabs selector at the bottom 2023-09-12 17:21:00 -03:00
Martín Capello 115e20d2a5 Add tab widget to lua api 2023-08-14 18:08:33 -03:00
David Capello 32009723c5 [lua] Ask for access for package.loadlib() function 2023-07-19 09:15:15 -03:00
David Capello a2d8a080f5 [lua] Create app.window to access new main window properties (#3927)
We moved the app.width/heigth to app.window.width/height and
app.events.on('resize', ...) to app.window.events.on('resize', ...).
2023-07-18 17:54:57 -03:00
David Capello 86a50e2e9a [lua] Add native API to decode/encode JSON text (fix #3233)
New json.decode(jsonText) and json.encode(luaTable) functions.

In this way we don't depend on third-party libraries to decode/encode
JSON text which is a quite common task (in tests and export scripts).
2023-07-17 09:25:13 -03:00
David Capello a98ad46a55 Use the existent doc::algorithm::FlipType instead of a new app::script::FlipType 2023-05-18 13:14:50 -03:00
Gaspar Capello f3ed22e1a6 [lua] Add Image:flip() 2023-05-18 13:02:07 -03:00
David Capello d7af7f4312 [lua] Add new app.editor object (fix aseprite/Attachment-System#104) 2023-04-19 19:10:28 -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 636cce6f0d [lua] Add Uuid type (fix #3809) 2023-04-12 13:51:37 -03:00
David Capello 17c66181ae [lua] Replace Paint() class with GraphicsContext.blendMode/opacity properties
In some way we prefer to simplify the GraphicsContext class instead of
exposing a new Paint() class (which might be confusing with the
app.useTool() too).

Now BlendMode can be used for GraphicsContext.blendMode and
Layer.blendMode (not all modes are available in both cases).

This reverts commit 3d7c05c8f1.
2023-03-13 21:19:23 -03:00
David Capello 3d7c05c8f1 [lua] Add Paint class and argument to GraphicsContext::drawImage(img, srcRc, dstRc, paint) function 2023-03-13 18:18:44 -03:00
David Capello c2f8335891 [lua] Add Timer() type (fix #3251) 2023-02-22 20:00:07 -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
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 d683aaf437 [lua] Rename MouseCursor.HIDDEN -> MouseCursor.NONE 2022-12-26 18:31:37 -03:00
David Capello a6a7519178 [lua] Add possibility to modify the mouseCursor of a canvas 2022-12-26 15:33:14 -03:00
David Capello 3d9021d717 [lua] Add app.theme.dimension/color.id to access theme values 2022-12-16 10:55:11 -03:00
David Capello 2cb526a19b [lua] Add new GraphicsContext type for Canvas onpaint event
We include a simple initial API for the GraphicsContext (like
stroking/filling rectangles and images).
2022-12-14 18:59:44 -03:00
David Capello 4f96d37b1f Add repeat field to animation tags (#1275, #1740) 2022-10-19 12:25:06 -03:00
David Capello ab2cef1c29 Merge branch 'main' into beta 2022-04-06 00:00:44 -03:00
David Capello 2594892dd5 Fix crash when a Lua error happens in a Dialog onclose (fix #3237) 2022-04-05 23:57:36 -03:00
David Capello d077900fe5 Merge branch 'main' into beta 2021-10-13 10:15:39 -03:00
David Capello 212e9fbe6c New initial Lua debugger version (#1967)
Incomplete version of the Lua debugger.
Some available features:

* Break in next executed instruction
* Step in, over, out
* See & navigate stacktrace
* See local variables

Some missing features:

* Breakpoints
* Eval user expressions with local variables

The UX needs some improvement yet.
2021-10-12 16:52:14 -03:00
David Capello db44eeb269 Merge branch 'main' into beta 2021-10-12 10:45:33 -03:00
David Capello cd342f5630 [lua] Add events handling with Sprite.events & App.events
Added a new Events object with :on() and :off() methods to start or
stop listening to a specific event respectively. This also allows to
add several callbacks for the same event.

Replaced the temporal Site.onChange & Sprite.onChange implementations.

Related to several issues (enable more possibilities for): #138, #1403, #1949, #2965, #2980
2021-10-07 18:56:39 -03:00
lampysprites 4354be1d7a Add CMake option to disable websockets 2021-10-03 12:40:29 +07:00
lampysprites b0f10ee276 Add Websocket client API 2021-10-02 13:57:51 +07:00
David Capello ecbd845aae Merge branch 'main' into beta 2021-04-22 14:02:36 -03:00
David Capello d7a1c71df0 lua: Add support for selection tools in app.useTool()
Fix https://github.com/aseprite/api/issues/37
2021-04-22 13:51:56 -03:00
David Capello d8f6c666de Merge branch 'beta' into tilemap-editor 2020-07-30 16:49:17 -03:00
David Capello 7656627605 [lua] Fix calling onclose Dialog event when we close the app (fix https://github.com/aseprite/api/issues/28) 2020-07-28 10:35:38 -03:00
David Capello 27e2a287bf [lua] Add possibility to draw tiles w/app.useTool{ tilemapMode=TilemapMode.TILES... } 2020-07-14 17:27:40 -03:00
David Capello a10efb187b Merge branch 'master' into tilemap-editor 2020-06-01 16:21:32 -03:00
David Capello f56931a612 Add missing #include in engine.cpp 2020-05-22 11:15:15 -03:00
David Capello 1ec502d242 Add "ink" parameter to app.useTool() + minor needed refactors 2020-05-20 17:15:30 -03:00
David Capello a80af2b304 Merge branch 'master' into tilemap-editor 2020-05-18 20:24:22 -03:00
David Capello 6b6b9057bf Add support for scripts on extensions (#1949)
It still need some work to associate the command to menus easily.

Related issues:
  https://github.com/aseprite/aseprite/issues/1403
  https://github.com/aseprite/aseprite/issues/1949
  https://github.com/aseprite/api/issues/20
  https://community.aseprite.org/t/lua-script-extension-and-menu-api/5085
2020-04-02 20:21:21 -03:00