Commit Graph

1379 Commits

Author SHA1 Message Date
David Capello
f178941f2c Fix crash copying, pasting, and transforming selection (fix #4249)
Regression introduced with 8722c8ec16
and d3562b140c.

Our re-entrant RWLock implementation is tricky because it doesn't
support to unlock in different order than it was locked.

E.g. If we create a DocWriter (e.g. paste command), and try to create
a DocReader (e.g. PixelsMovement) inside the DocWriter scope, the
reader will return a LockResult::Reentrant, but if we unlock the
write, then the reader cannot be used to upgradeToWrite() because the
lock will have just 0 locks (the re-entrant one didn't modify the
count of the RWLock). This is because it was thought that the
DocReader was going to be unlocked before the writer lock (in the
exact inverse order).

Basically these re-entrant RWLocks will not work fine if we mix up the
order of locks/unlocks in the same thread.
2023-12-29 17:22:10 -03:00
David Capello
8722c8ec16 Lock document in Tx() ctor (part of #2430)
This already fixes a lot of possible problems that can happen when a
script is running and modifying some part of a sprite that is being
backed up in a background thread.

We still need some work to being able to lock a sprite two or more
times in the same thread to write it. E.g. an app.transaction() should
lock the sprite for write access, but the script transaction function
could call a command, and that command could use a ContextWriter to
lock the sprite again. At the moment this is not possible because we
need a re-entrant RWLock implementation.
2023-12-27 11:05:15 -03:00
David Capello
e87fdbb3af [i18n] Add some hardcoded strings to en.ini (fix #4237) 2023-12-22 15:03:07 -03:00
David Capello
84187ad1ec Simplify strings for PaletteEditor command removing leading blanks
This issue was brought up here:
https://github.com/aseprite/aseprite/pull/4207#issuecomment-1845334373
2023-12-07 12:11:00 -03:00
David Capello
abba4684a7 Fix error messages about locked sprite when deleting multiple cels (fix #4204)
This is a combination when we modify a layer property and then
modify/delete several cels/frames/layers.
2023-12-06 12:47:52 -03:00
David Capello
0cc8769e29 Add tileset options when we convert a layer to a tilemap (fix #4158) 2023-11-22 14:37:27 -03:00
TakWolf
77ea4d40b8 Fix strings spelling typo: Difussion -> Diffusion. Notice, this is not compatible for translations. 2023-11-20 20:10:59 -03:00
David Capello
f92f14f261 Fix possible crash adding reference layer (fix #3949) 2023-11-13 10:51:19 -03:00
David Capello
62bdd8af9f Add "Advanced Options" checkbox in Tileset selector
To hide "Base Index" & "Allowed Flips" options by default.
2023-11-10 17:19:41 -03:00
David Capello
302d998218 Add support to match flipped tiles automatically in Auto/Stack modes
By default Aseprite will not try to match flipped versions of the
tiles (as it requires more CPU), but when we create a tileset we can
specify which flips can be matched automatically (new
Tileset::matchFlags() property).

These flags are just for the Auto mode, if we manually insert a
flipped tile, that is always supported, even when the matchFlags() are
not specified.
2023-11-09 16:44:46 -03:00
David Capello
78cda70ab6 Add support to flip/rotate tiles to ChangeBrush command (like #1222) 2023-11-09 16:44:46 -03:00
Dariy Guzairov
9772534ca5 Fix error message when attempting to delete layer in a group (fix #4083)
If the sprite contained only one layer group, and we tried to delete
one child, we got an error message about "You cannot delete all
layers". This fixes this (the error message is only when we delete the
last top level layer).
2023-11-06 16:23:59 -03:00
David Capello
ae3b2dd144 Revert timeline behavior to the v1.2 default (#4024)
This change was introduced in dd7e27a098
as a possible fix for #4024, but the change is too disruptive to be
introduced at this stage, we need some extra UI elements to make the
drag & drop accessible in both modes: the default v1.2 behavior, and
a possible new selection mode, e.g. #1498
2023-10-25 08:36:54 -03:00
Dariy Guzairov
ea35725c85 Fix disable delete layer button when only one layer exists (fix #3649) 2023-10-23 19:16:35 -03:00
David Capello
3f101d48d4 Add more accessible option to re-enable the Aseprite file dialog (fix #4051)
As now the native file selector is the default one, we moved the
option to re-enable the previous file selector to Edit > Preferences >
General > Show Aseprite file dialog option.

Related to #3615 and added as a simple alternative to #2745 which
require native widgets on each native file dialog.
2023-10-04 16:57:11 -03:00
David Capello
63fb39e0e8 Fix sprintf() warnings using snprintf() or fmt::format() 2023-09-27 19:57:41 -03:00
David Capello
5e34ae0ce2 Fix unused variable warnings 2023-09-27 19:57:41 -03:00
Gaspar Capello
a0331743de Fix Color Range uses last active selection instead of active selection (fix #4045) 2023-09-20 11:44:23 -03:00
Gaspar Capello
db0bc5c6bb Fix F6 shortcut to show the timeline thumbnail by default (fix #4020)
Before this fix, when the thumbnail size was 1, the "Toggle Timeline
Thumbnails" command (F6 key) seemed to not work until we changed
the timeline thumbnail size to 2 or more.
2023-09-20 11:43:43 -03:00
David Capello
d8814fa2f9 Add option to avoid drag & drop timeline range from edges
Related to #1498 in some way to start enabling new selection modes in
the timeline.
2023-09-19 12:07:14 -03:00
David Capello
e2d8ffab54 Add reset buttons + tooltips to timeline range options (#4024) 2023-09-18 17:33:38 -03:00
David Capello
7358626859 Add flip/rotate brush support to ChangeBrush command (#1222)
Implement part of:
https://github.com/aseprite/aseprite/issues/1222
https://steamcommunity.com/app/431730/discussions/1/1479856439033920884/
https://community.aseprite.org/t/flipping-rotating-the-current-brush/1854
2023-08-09 21:56:55 -03:00
David Capello
11644a7d16 Add Shift+F7 to toggle other layers visibility on Preview window 2023-07-19 10:56:16 -03:00
Martín Capello
242555ab06 Allow changing the tileset assigned to a tilemap layer 2023-07-18 18:50:57 -03:00
Martín Capello
4926f4c1fc Show, duplicate and delete tilesets in Sprite Properties dialog (fix #3875) 2023-07-18 18:50:57 -03:00
Gaspar Capello
0c3d78b4ce Fix unexpected behavior during multiple cel selection + cel property changes (fix aseprite/aseprite#3886)
Prior to this fix, if a field was modified, all fields were overwritten with the values from the Cel Properties dialog.
2023-07-18 10:39:13 -03:00
David Capello
e84bee0f99 Minor changes removing "using namespace doc" from app/color.h 2023-07-17 15:02:15 -03:00
David Capello
00b75a76a8 Add displayName property for language extensions (fix #3964)
The default language (en.ini) has a new "display_name" property, but
probably we should remove it and transform the English language in an
extension (just as the default Aseprite theme).
2023-07-12 12:25:30 -03:00
David Capello
35e64ad2f3 Fix exporting selection to gif/fli/webp files (fix #3827) 2023-07-11 13:33:45 -03:00
Gaspar Capello
f7bc918926 Fix crash when loading an extension with invalid dithering matrices (fix #3914)
Before this fix, when installing dithering matrices if Aseprite
couldn't find the file of some matrix described in the json, Aseprite
would crash (this happened during the installation of an erroneous
dithering matrices extension, and after every reboot of Aseprite).

The cause of the crash was the absence of the MainWindow instance
during the ContextBar creation. When an error occurs, the console is
called, but since MainWindows is not yet available, aseprite crashes.
2023-07-06 11:07:39 -03:00
Martín Capello
204ee881be Prevent executing the logic for showing an alert when removing all sprite's layers and the UI is unavailable 2023-06-27 15:26:11 -03:00
Martín Capello
5bc432f289 Delete unused tilesets after deleting tilemaps (fix #3876) 2023-06-27 15:24:13 -03:00
Martín Capello
872267dc9b Avoid crash if the "New Layer" menu item is configured to ask the layer name 2023-06-27 15:24:13 -03:00
David Capello
a6ccc45d5b Fix crash calling app.command.LoadPalette() when the UI is not available (fix #3847)
E.g.

  aseprite -b -script load.lua

When load.lua is:

  app.command.LoadPalette()

Was crashing the program.
2023-05-15 17:31:46 -03:00
David Capello
7a26281ce3 Change all selected cel properties when we select frames/layers (fix #3807)
The Cel Properties dialog wasn't working right when we selected a
range of layers or frames.
2023-05-15 15:20:16 -03:00
David Capello
691f99a291 Delay filter preview start to group several mouse events/param changes in one
This is needed on X11/Linux as we received a lot of mouse events at
the same time when the user drag the mouse. In this way we avoid
restarting the preview and making a high CPU usage just to stop/start
the filter without any kind of UI feedback.
2023-05-15 14:31:08 -03:00
David Capello
59f6b78e4f Use a task_token to cancel a filter when we are processing a row
Added FILTER_LOOP_THROUGH_ROW_BEGIN/END macros to simplify some
boilerplate code for each filter.

In this way if processing just one row takes too much time, canceling
the operation is faster.
2023-05-15 13:23:24 -03:00
David Capello
87075296ed Use app::Task instead of raw threads on FilterPreview
We can use a thread pool (avoid creating/destroying threads) and we
can continue the same task running when the filter restart (there is
no need to stop/wait and restart, because the filter task keeps
calling the applyStep() function anyway).
2023-05-12 10:22:10 -03:00
Gaspar Capello
2369f36322 Enable panning and zooming for filter window (fix #2563)
Now we can zoom and pan on Replace Color, Color Curve, Outline,
Convolution Matrix, etc. which are Filter Windows.
2023-05-11 18:01:36 -03:00
David Capello
c32b9b07a8 Centralize the warning message for incompatible files/forward compatibility (#3811, #3812)
Several changes were included:
- Fixes in TextBox widget to show it with proper size hint when it's
  outside a viewport
- Added the IncompatFileWindow with a message + link to know how to
  update Aseprite and solve the situation
- Moved CannotModifyWhenReadOnlyException from app/doc.h to
  app/transaction.h
2023-05-11 12:18:31 -03:00
Martín Capello
3f581a5dfa Add warning when loading unsupported property type and mark the file as read-only (fix #3812, fix #3811) 2023-05-08 17:37:05 -03:00
David Capello
6cbde57470 Add gridBounds parameter to NewLayer command 2023-04-19 13:25:54 -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
b28550faf5 Use new ScopedValue w/o old arg + C++17 class template argument deduction (CTAD) 2023-04-14 13:43:36 -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
David Capello
da9f334214 Fix FullscreenPreview for SimpleRenderer
The SimpleRenderer outputs unpremultiplied RGB values when we render
in a transparent background, we have to indicate that to Skia now that
we're compositing os::Surfaces (SkiaSurfaces) directly in this
FullscreenPreview command.
2023-04-07 20:26:16 -03:00
David Capello
da0a8b7916 Show GPU option only in DEVMODE
We've update the label "GPU acceleration" to avoid confusion between
developers so they know that this option is not enabled in the final
release.
2023-04-03 16:09:26 -03:00
David Capello
8c7b94a934 Add support to render the background directly on screen
Renderer::renderCheckeredBackground() function was used only for the
FullscreenPreviewCommand, but now we use
ShaderRenderer::renderCheckeredBackground() to render the background
in the Editor too. So the sprite is painted in a backbuffer and then
composited with the already painted background using
Graphics::drawSurface().
2023-04-03 15:59:29 -03:00
Martín Capello
a7e155a391 Hide small preview window when going full screen preview (fix #3762) 2023-04-03 15:36:04 -03:00
David Capello
8247d53642 Enable several ShowSomething commands in non-UI environments
This is to allow using ShowGrid in test cases when the UI is not
available (most of these commands only modify the preferences).
2023-03-28 13:42:34 -03:00