Commit Graph

114 Commits

Author SHA1 Message Date
Christian Kaiser af349ce7ee [lua] Fix new layers not going to the top when selected (fix #5364) 2025-09-04 12:02:10 -03:00
Martín Capello 85997a08cf Add slices copy&paste and duplication (fix #4466) 2025-08-27 12:16:35 -03:00
Christian Kaiser 80fa065bd5 [lua] Add sprite.undoHistory
build / build (Debug, macos-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, macos-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, noscripts, cli) (push) Has been cancelled Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Has been cancelled Details
2025-07-25 13:58:52 -03:00
David Capello 68bf0839aa Don't use userConfigPath to output automated test files 2025-06-23 09:08:02 -03:00
Necronomison e5917389cb
Export user & extension defined properties (fix #5186, #5187) 2025-06-23 09:06:05 -03:00
Christian Kaiser 5596c3270d Add blendMode, name, opacity and visibility Sprite layer events 2025-06-20 09:58:09 -03:00
Christian Kaiser 54ea61fe58 Re-add os.rename and os.remove support 2025-06-07 12:05:34 -03:00
Gaspar Capello 5d0214a89d Fix wrong export of tileset (fix #5053)
Before this fix, when a sprite's color mode was set to Grayscale and
a tileset was exported, the resulting sheet was full of broken
tile images due to a misinterpretation of the pixel format in
the samples.

An unnecessary conversion of the original sprite was also observed
during the "Export Sprite Sheet" command. Specifically,
in the DocExporter::renderTexture function (fix #5088).
2025-06-03 13:19:56 -03:00
Martín Capello ba5adcaa7d Change uuidsForLayers by useLayerUuids 2025-04-22 12:42:12 -03:00
Martín Capello 9e35fd817a [lua] Add uuid field to layers (fix #5033) 2025-04-22 12:42:12 -03:00
Gaspar Capello 7f07becd74 Fix cel.image:clear() cannot be undone (fix #5015) 2025-04-21 19:39:32 -03:00
David Capello be6d2251aa Merge branch 'main' into beta 2025-02-26 10:26:09 -03:00
Gaspar Capello f2b870a17f Fix image:drawImage+BlendMode.SRC doesn't draw mask pixels (fix #5001)
Also added tests for Image:drawImage + BlendMode::SRC + ColorMode.RGBA
2025-02-20 12:14:04 -03:00
Martín Capello 91b3603193 Add fitCriteria parameter test 2025-02-10 17:37:57 -03:00
Christian Kaiser 4b2d98506f Renamed "mask" to "selection" for Lua consistency, fixes 2025-01-08 12:35:20 -03:00
Christian Kaiser d7aa121b29 Fix accepting bad arguments, tests, avoid crashing when copying tilesets 2025-01-08 12:35:20 -03:00
Christian Kaiser 4359b835ab Fix test failures (WIP), content error when trying to add image & text 2025-01-08 12:35:20 -03:00
Christian Kaiser 55b3e3c41c Clipboard access check, content 2025-01-08 12:35:20 -03:00
Christian Kaiser 7331398203 Add app.clipboard Lua API 2025-01-08 12:35:20 -03:00
Christian Kaiser 21ec694822 Enable and improve beforesitechange event (fix #4785) 2025-01-02 18:05:15 -03:00
David Capello 09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
David Capello b2e4f78b69 clang-format all files 2024-12-16 10:10:34 -03:00
David Capello 9a7ce8604b Merge branch 'main' into beta 2024-12-11 08:34:33 -03:00
David Capello df19b09c23 Avoid using tabs in run-tests.sh expected output 2024-12-10 22:42:22 -03:00
David Capello f62b5eafb1 Merge branch 'main' into beta 2024-12-10 16:16:16 -03:00
Martín Capello a99161a2d2 Add MaskByColor command lua tests 2024-12-09 19:26:46 -03:00
David Capello b03dffb5cd [lua] Disable 'beforesitechange' event (#4569, #4780, #4785) 2024-11-19 21:18:21 -03:00
Christian Kaiser a43841f8b7 Add 'beforesitechange' event (fix #4569) 2024-11-13 15:17:02 -03:00
Gaspar Capello bb567444cc Add diagonal and 8-quadrant symmetry tests 2024-11-01 15:19:23 -03:00
David Capello 8fd882d90b Merge branch 'main' into beta 2024-10-08 15:06:57 -03:00
David Capello e5faac07b5 Fix regression breaking linked cels on "Merge Down" (fix #4685) 2024-10-03 12:43:26 -03:00
David Capello e700cce987 Merge branch 'main' into beta 2024-09-23 15:03:11 -03:00
دانتي باولا b40614ca36
Use FlattenLayers for MergeDownLayerCommand (#4643)
Rework of the cmd::FlattenLayers implementation to accommodates the
'Merge Down' command as a special case.
2024-09-20 17:25:09 -03:00
Gaspar Capello 0f7cac0f0c [lua] Add get/set the foreground/background tile (fix #4403)
It's now possible to get/set the selected foreground/background tile
index. Example of use:

  app.fgTile = 1    -- the primary tile is '1'
  print(app.fgTile) -- this will show '1'
  app.fgTile = 0    -- the primery tile is 'no tile'
  print(app.fgTile) -- this will show '0'
  app.bgTile = 2    -- the secondary tile is '2'
2024-09-16 16:19:29 -03:00
Martín Capello 100ce10618 Add Image.context lua tests 2024-09-16 16:03:41 -03:00
Gaspar Capello e70bbbd369 Add 'x' and 'y' as input parameters to app.command.Paste() 2024-09-05 17:22:12 -03:00
Gaspar Capello de1fc581f2 Fix app.command.Cut/Paste does not work in --batch mode (fix #4354)
This fix adds support for cut/copy/paste selected areas during
script execution when there isn't UI.
2024-09-05 17:22:12 -03:00
Gaspar Capello 5798e27993 Fix mask color turns to opaque on RGBA->INDEXED conversion (fix #4438)
Original issue title: When using a background layer, switching to
Indexed Color Mode fills all layer bounding rectangles with
Color 0.
Conditions to reproduce the original issue:
- Opaque RGBA sprite, i.e. the bottom layer is 'Background'.
- There is a second layer with an ellipse (for example).
- There is a mask color #000000 alpha=0 is in the palette.
- The mask color index is greater and not equal than 0.
- Go to Sprite > Color Mode > Indexed.
Result: the transparent color of the second layer will change to
index color = 0 (usually black).

Also added test for RGBA->INDEXED conversion
2024-09-04 13:48:56 -03:00
Gaspar Capello c8f018f2f1
Fix exporting a Sprite Sheet with Group name has different functionality between CLI and Scripting (fix #4456) (#4475)
Before this fix, the lua command:
app.command.ExportSpriteSheet
could not process a layer within a group when the layer name
was expressed using the layer hierarchy path, for example:
layer = "Group1/Layer1"
2024-09-03 20:20:36 -03:00
David Capello afb8a3d94a [lua] Minor change app.pixelColor -> pc in test 2024-09-03 19:11:14 -03:00
Gaspar Capello 4a91d150af Fix transparent color is possible on opaque sprites (fix #4370)
To reproduce the error before this fix on RGBA/Grayscale Color Mode:
- New 100x100 RGBA/Grayscale opaque sprite (white background).
- Draw something with some gray color in the palette.
- Keep the selected gray color as primary color.
- Configure as secondary color the mask color (#000000 alpha=0).
- Pick 'eraser' tool and erase over the gray color with right click.
- Result: The sprite doesn't look more opaque, which is wrong. Also,
  if we export this sprite, the transparent parts will turn black.

A similar problem occurs in Indexed Color Mode, but getting a
transparent color in a Background sprite is inevitable if the color of
a palette entry is transparent or semi-transparent, since the index
must be set as is. This could be fixed in the future at the
render stage, however, this could lead to other perceived
inconsistencies. For now it'll be left as is.

Original issue description:
Downloaded PNG in RGB mode fails to support transparency: erase
uses secondary color and export PNG replaces transparent color
with black

Added tests for 'eraser' in 'Replace Color Mode'
To make the eraser work in 'Replace Color Mode' within the tests,
was implemented the possibility of using the right button in
the creation of the point vector.

During testing with UI available it was observed that the 'bg' color
was copied from the 'fg'. Changed this to be compatible with the way
the default value of 'fg' is assigned when it is not specified.
This last modification resulted in errors during 'tilemap.lua' due to
incompatibility of the type of 'bg' color. This was corrected
considering the color type of 'fg' color.
Furthermore, it was found that the command 'app.range.tiles = { 1 }'
did not finish assigning the tile picks to the activeSite,
then 'assert(1, #app.range.tiles)' was failing. This was fixed too.
2024-09-03 19:08:15 -03:00
Guilherme Belchior ffc3684b1b Compose groups separately from all other layers
Maintain hierarchical structure of sprite groups instead of flattening.
Allows opacity and blend mode to be applied correctly to groups.
Sets the foundation for future features like mask layers.

Note:
Requires full image rendering and impacts performance in some scenarios.
Avoids complex code changes for minor performance gains.

Co-authored-by: Guilherme Marcondes <guilherme.marcondes@tecnico.ulisboa.pt>
2024-06-24 18:16:42 -03:00
David Capello 8f7bf09263 Fix doc::blend_image() to support different color modes (fix #4530, fix #4531)
The code was refactored moving the BlenderHelper class from "render"
to "doc", and now doc::blend_image() supports blending different color
modes.

Some work is still needed to work with grayscale images correctly.
2024-06-11 21:48:57 -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
Martín Capello 24e72a36ba Add --play-subtags CLI test 2024-05-28 15:00:22 -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 92edd5f700 Add Brush::clone() functions to fix/simplify some Brush-related code
This refactor includes:

- In Lua now we can clone a custom brush with Brush(Image) and the new
  brush doesn't share the image with the original one (added a new test
  for this).

- Avoid creating extra images when it's not needed using
  Brush::cloneWithExistingImages() (we can inject existing images in
  the brush itself).

- Delete Brush-copy contructor & assign operator to use
  Brush::clone() functions instead (which are more explicit).

- Some code from 12d8135264 (#4023)
  reverted to avoid recreating brushes on left-click or in the brush
  preview, i.e. moving the mouse (#4013 refers only to right-click, so
  only on right-click we have to adjust the custom brush).
2024-05-03 11:35:36 -03:00
Gaspar Capello 12d8135264 Fix secondary color with custom brush paints the FgColor instead the BgColor (fix #4013)
Before this fix to change the main color of the image brush,
it was necessary to choose a new color from the palette.
The secondary color can now also be used.

Also added some tests for image brushes.
2024-04-29 17:20:56 -03:00
David Capello c64756ebde Keep testing loading/saving properties as they are in userdata_codec.lua 2024-02-26 17:44:56 -03:00
David Capello 9f75260d25 Change userdata_codec.lua test to check pre-saved user data properties 2024-02-26 17:40:15 -03:00