Commit Graph

7950 Commits

Author SHA1 Message Date
David Capello
a2b294b0fe Add final modifier to ToolLoopImpl to avoid clang-tidy warning
The warning is about using a virtual member function in the destructor
where it can be overridden by a derived class so in this case the
derived version wouldn't be called.

Just testing clang-tidy to see if we can add something in the CI.
2024-02-26 15:32:40 -03:00
David Capello
5dbaa295c5 Revert "Drop selection if we hide the layer (fix #4179)"
This reverts commit 078dac28d7.
2024-02-26 10:13:07 -03:00
Gaspar Capello
f22603caea Fix crash when trying to access a property of a Style which is nullptr (fix #4015)
Before this fix, an incomplete custom theme or an outdated official
theme could cause a crash during Aseprite startup.

This fix does not alert the artist the problem of the theme.
Simply avoid the crash.
2024-02-26 10:07:44 -03:00
Gaspar Capello
078dac28d7 Drop selection if we hide the layer (fix #4179) 2024-02-26 09:51:36 -03:00
David Capello
6ab2731fad Remove verbosity in .exe file description on Windows (fix #4333) 2024-02-23 20:00:01 -03:00
David Capello
10dda30a15 Don't write color2 chunk for files with more than 256 colors (fix #4322)
We were incorrectly saving a wrong number of entries for palettes with
more than 256 colors in color2 chunk, anyway it doesn't make sense to
use this chunks as it doesn't support more than 256 colors. So we
removed it for this case.

We've also removed the palette chunk for cases where it's not required
at all, e.g. when we have less than 256 colors and doesn't have alpha
channel, it makes sense to use the color2 chunk as it's smaller in the
output file.
2024-02-22 19:46:34 -03:00
David Capello
0d5075ff93 Add -noinapp option to disable Steam "in game" visibility (fix #4314)
Some minor changes in this commit includes the usage of
std::unique_ptr for the Pimpl-idiom in steam::SteamAPI class and
renaming the SteamAPI::initialized() to SteamAPI::isInitialized() to
avoid confusion reading the code.

Forum post:
https://steamcommunity.com/app/431730/discussions/2/7260435303111061192/
2024-02-21 12:47:27 -03:00
David Capello
5337a728be Fix platform version for Windows 10/11
Now we include the 10.0 + the build number in the version.
2024-02-20 18:08:46 -03:00
David Capello
d70801e88b Throw a bad_alloc when there is not enough memory for ImageBuffer (fix #4316)
Fix regression introduced in aeeef8e255
when we replaced the std::vector with aligned memory allocations (or
just malloc/free).
2024-02-19 11:21:53 -03:00
David Capello
0134c74926 Fix gcc error: expected primary-expression before ‘unsigned’ 2024-02-16 14:49:41 -03:00
David Capello
644b0021fb Replace ’ unicode char with ' for news description 2024-02-16 14:10:16 -03:00
David Capello
9be7c66376 Add possibility to paste as new file from clipboard on Home tab
Feature request:
https://community.aseprite.org/t/pasting-on-home-screen/21476
2024-02-16 12:40:00 -03:00
Gaspar Capello
243982ab78 Fix identify running Aseprite processes correctly to recover crashed sessions (related to #4130)
Prior to this fix, Aseprite was hiding some sessions to recover,
resulting in additional support for users.
To display available recovery sessions, Aseprite only checked if
the session belonged to any running process on the OS via the
'pid' number.
2024-02-15 12:10:09 -03:00
David Capello
14696de980 [lua] Update API version 2024-02-12 18:53:15 -03:00
David Capello
12623176bb Fix copying our en.ini file to strings.git clone 2024-02-12 16:55:31 -03:00
David Capello
749ea49185 Add link in About dialog to show the list of translators 2024-02-12 11:59:26 -03:00
Martín Capello
a7d4c23af9 Fix exporting one tag without "play subtags/repeats" and changing its anidir (fix #4297) 2024-02-09 17:31:25 -03:00
Gaspar Capello
45e74c7338 Fix HSV/HSL values on ColorSliders
Before this fix, the HSV and HSV values displayed in the ColorSliders were truncated rather than rounded to the nearest integer.
2024-02-08 19:16:08 -03:00
David Capello
916b3bf26a Fix Steam screenshots (fix #4300)
Steam API/DLL now contains a SteamAPI_InitSafe() function for backward
compatibility similar to the old SteamAPI_Init(). The official
"steam_api.h" header file contains inline-defined functions for
SteamAPI_Init() and SteamAPI_InitEx() but both use the published
SteamInternal_SteamAPI_Init() function (we don't need it, I guess, so
SteamAPI_InitSafe() is enough for us).
2024-02-08 18:43:38 -03:00
David Capello
434c262489 Merge branch 'intuitive-opacity-values' (#1544, #4262) 2024-02-08 15:22:58 -03:00
Martín Capello
f7f2c56abf [lua] Fix tabs ID handling (fix #4268) 2024-02-08 10:55:46 -03:00
Martín Capello
9ef6c4848d Avoid exposing doc::frames types to the global namespace 2024-02-07 14:04:35 -03:00
Martín Capello
fdafc585c2 Adjust alpha color slider to make it work as percentage or value as specified by the preference settings 2024-02-07 13:33:09 -03:00
Martín Capello
b10390625f Introduce AlphaEntry class and make InkOpacityField extend from it (fix #1544) 2024-02-07 13:33:09 -03:00
Martín Capello
04cf5eaa15 Introduce "alphaslider" and "opacityslider" controls. Use "opacityslider" in cel properties (fix #1544)
They work like a regular slider but use 0%-100% or 0-255 ranges depending on configuration settings.
2024-02-07 13:33:04 -03:00
David Capello
9318ce4941 Merge branch 'export-with-play-subtags' (#4173, #4211) 2024-02-07 11:58:28 -03:00
Gaspar Capello
e9706f106f Fix wrong edges on Brush Preview on Tilemap Mode (fix #4176) 2024-02-06 16:58:43 -03:00
Martín Capello
0c7759acf1 [lua] Fix how separators are added into dialog's tabs (fix #4288) 2024-02-06 16:27:24 -03:00
Gaspar Capello
024c266231 Fix deleting the "Pixel-perfect" checkbox from the "Spray Tool" (fix #4220) 2024-02-06 13:13:43 -03:00
Martín Capello
921504937c Fix Aseprite built-in file selector's file list layout to avoid horizontal scrolling (fix #4183) 2024-02-06 13:00:43 -03:00
David Capello
62599ad8b4 Fix assert in Widget::setMnemonic() for mnemonics like 'Ú'
This fixes the ASSERT((mnemonic & kMnemonicModifiersMask) == 0) in
Widget::setMnemonic() function, but as a future task we should try to
process/convert unicode chars like 'Ú' as a simplified form,
i.e. pressing 'u' should match 'ú' for mnemonics.
2024-02-06 09:38:14 -03:00
David Capello
af73adeab0 [i18n] Clone and add "strings" repo in "data/strings.git" to get updated translations
As we've moved all the translations to the strings
repo (06a852d1d4), to facilitate the
i18n work now we load translations from "data/strings" and from
"data/strings.git" folders, where "strings.git" is a clone of the
strings repo (https://github.com/aseprite/strings.git) in
"build/bin/data/strings.git".

This clone is executed automatically in the cmake configuration stage
so it's transparent for the developer and the result is like having
the translations available in the same "aseprite" repo.
2024-02-06 09:37:29 -03:00
Martín Capello
012da4da1b Add SelectedFrames.displace() tests 2024-02-02 17:53:09 -03:00
Martín Capello
982df4db1c Add FramesSequence tests 2024-02-02 17:53:09 -03:00
Martín Capello
eb45c4adf5 Add support to "play subtags & repetitions" when exporting an animation (fix #4173) 2024-02-02 17:52:58 -03:00
Martín Capello
a6556bb4f2 Fix exit frame handling for "PlayAll" playback mode
Without this when the playback cue is on the highest frame in "PlayAll"
mode it doesn't take into account the direction of the current tag that
is being played and assumes the end of the animation was reached
2024-02-02 17:52:58 -03:00
Martín Capello
0ae3a23066 Fix "ping-pong reverse" ordering of frames when exporting 2024-02-02 17:52:58 -03:00
Martín Capello
4d8fc12351 Adjust export dialog UI to support "Play Subtags & Repetitions" checkbox (fix #4173) 2024-02-02 17:52:42 -03:00
David Capello
5900605549 Fix "Too much data to uncompress" error recovering sessions (fix #4291)
This is due zlib returning Z_OK (instead of Z_STREAM_END) after
inflate() when all the output buffer was filled (avail_out = 0) but it
reports like there is still available uncompressed data (avail_in > 0).
It makes no sense but an extra inflate() call with avail_out=0
consumes the whole avail_in and the expected Z_STREAM_END is finally
reported.
2024-02-02 14:01:07 -03:00
David Capello
e0a677545e Show errors in UI when we cannot recover a specific file (related to #4291)
Internal:
Visible in: https://igarastudio.zendesk.com/agent/tickets/5772
With files from: https://igarastudio.zendesk.com/agent/tickets/5773
2024-02-02 12:49:55 -03:00
Martín Capello
799b3e1918 Add the user directory as the first path to search for the tags palette (fix #4182) 2024-02-01 10:27:11 -03:00
David Capello
40863a3a5e Copy hex text to native clipboard when copy colors from the palette (fix #4289) 2024-01-31 11:45:12 -03:00
Charlie-83
e47448ca24 Fix numerical errors in gradient tool (#4131) 2024-01-26 11:49:04 -03:00
Martín Capello
d331195c4c Add "Alpha & Opacity" section to Preferences > Color (fix #1544) 2024-01-12 14:38:04 -03:00
Martín Capello
d10f0cc054 Prevent setting slider ranges with min > max (fix #4191) 2024-01-12 12:11:59 -03:00
David Capello
da7f51ee43 Revert part of Sentry::areThereCrashesToReport() impl for macOS mainly
Revert 00894101e0 as it was suggested in
this comment:

  https://github.com/getsentry/sentry-native/issues/930#issuecomment-1883739150

Only needed for macOS, but we can still use this on Windows just in
case (and use sentry_get_crashed_last_run() as a fast path if it
works).
2024-01-10 14:50:28 -03:00
David Capello
9d69cb8dfe Possible fix for crash in Window::limitPosition() when parent is nullptr (fix #4261)
We cannot reproduce this but just adding a check here to avoid using a
nullptr parent pointer.
2024-01-08 15:07:36 -03:00
David Capello
00894101e0 Simplify Sentry::areThereCrashesToReport() using sentry_get_crashed_last_run()
Thanks for the Sentry team for the help in:
https://github.com/getsentry/sentry-native/issues/930
2024-01-08 14:08:25 -03:00
David Capello
78f5560b33 Update copyright year to 2024 2024-01-04 14:10:07 -03:00
David Capello
d6587fbf78 Add button to refresh/reload the list of palettes (fix #4258) 2024-01-04 13:51:18 -03:00
David Capello
88e89b6c38 Don't catch unhandled exceptions so Sentry can report them
If we catch all exceptions and { do nothing }, we are probably missing
some crashes from being reported.
2024-01-03 12:04:55 -03:00
David Capello
318a2c60ea Fix crash in BackupObserver::saveDocData() using destroyed docs when app is being closed due to an exception (fix #3818) 2024-01-03 12:04:14 -03:00
David Capello
d8ed4d3995 Fix crash if an exception happens in DelayedMouseMove::commitMouseMove()
Without this an exception in DelayedMouseMove::commitMouseMove() could
produce (e.g.) the crash in #3818. This same error handling was
already done for Editor::onProcessMessage() in
DocView::onProcessMessage() to avoid crashing due unhandled exceptions
in Editor message processing.
2023-12-29 17:22:10 -03:00
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
Gaspar Capello
ba9ede873c Fix Alt+T -> Alt+V instantly crashes Aseprite without warning (fix #4221) 2023-12-27 16:58:37 -03:00
Martín Capello
3f00b3e593 Avoid div by zero by preventing returning a grid bounds with zero width or height (fix #4146) 2023-12-27 15:19:22 -03:00
David Capello
d3562b140c A Tx now will always try to lock the document if possible (#2430)
With re-entrant RWLocks we can try to lock the document on each
transaction/command/modification. This fixes several problems running
scripts that weren't locking the sprite in an app.transaction() call.
2023-12-27 11:05:15 -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
e2d8db92d2 [i18n] Add support to escape more chars, like \s (fix #4236) 2023-12-22 11:37:04 -03:00
David Capello
96ef977311 Add new "shade_empty" style to paint the empty shades label (fix #4225) 2023-12-14 14:26:34 -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
a118eea3cd Check strings only from en.ini file 2023-12-06 14:57:17 -03:00
David Capello
896e7f392e Change en.ini multiline format
Instead of using the simpleini format (which is not quite common/standard):

  key = <<<END
  line1
  line2
  END

We just use:

  key = line1\nline2
2023-12-06 14:15:21 -03:00
David Capello
609aedee12 Fix Weblate parsing error with strings outside any section
Given error:

  Could not parse translation base file: File contains no section
  headers. file: '<???>', line: 10 'display_name = English\n'

It looks like a known issue: https://github.com/WeblateOrg/weblate/issues/9702
2023-12-06 13:45:10 -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
Martín Capello
01c69a4cf7 Fix recovering of old crashed sessions having sprites containing slices
Without this fix a recovering thread could get stuck in an infinite loop when reading the slices of a sprite created with a doc format version lesser than 2.
2023-12-04 10:47:35 -03:00
David Capello
046b68061a Highlight dynamics button when some sensor is being used 2023-11-30 21:24:48 -03:00
David Capello
eeb5be9bed [lua] Fix crashes setting values out of bounds in JSON objects (fix #4166) 2023-11-30 18:40:02 -03:00
David Capello
82375462ae [lua] Fix reported crash setting nil as user data (fix #4187) 2023-11-30 16:10:59 -03:00
David Capello
10738b32c3 Use dynamics for brush preview only for freehand tools (fix #4178)
This fixes a problem where the smaller brush size of the dynamics was
used for tools like line/rectangle/etc. where the dynamics option
aren't used.

We've added some comments for a possible future #4186 too,
implementing dynamics for the contour tool (which is freehand, but the
result is filled).
2023-11-30 12:56:46 -03:00
David Capello
5ae2e444f2 Replace asserts limiting values directly in Entry::selectedRange()
There are some cases where these asserts failed (mainly in the
dithering matrix selection combobox).
2023-11-30 11:23:15 -03:00
David Capello
60b4524e41 Fix dithering matrix selection in Gradient tool (fix #4184)
Regression introduced in 8d435e02d8
2023-11-30 11:04:32 -03:00
David Capello
29b76353ef Fix "Select > Color Range" selection buttons visibility (fix #4177)
Reported in the forum: https://community.aseprite.org/t/20752
2023-11-28 15:28:31 -03:00
David Capello
f46ac5e807 Fix selection movement offset without fine control (fix #4175)
Cherry-picked this fix from the reverted commit 456113d015
2023-11-28 14:52:13 -03:00
David Capello
8d435e02d8 Fix performance regression drawing/showing brush preview (fix #4174)
We were loading the whole list of dithering matrices on each mouse
move now just by chance. As a future refactor we should improve the
handling of dynamics options, e.g. avoid accessing preferences/
rebuilding the tools::DynamicsOptions object on each mouse movement.
2023-11-28 12:47:24 -03:00
David Capello
a8885105e9 Move rows array back to the beginning of ImageImpl buffer
We are not sure, but due to new bug reports about a lagging mouse
movement (#4174), it might be because some memory cache issues: having
the rows array at the end of the pixels data might not be the best
decision.

It was moved at the end because we didn't need that rows array to be
aligned, only the pixels data. But with this patch we're trying to see
if this fixes the issue. So now we moved back the rows array at the
beginning of the image buffer as it was before aeeef8e255
2023-11-28 11:34:50 -03:00
David Capello
6f3e9e21ad Fix crash reading corrupted files with invalid compressed data (fix #4171) 2023-11-26 22:27:14 -03:00
David Capello
7e331d95e2 Simplify main window title bar removing common suffixes
On Apple Silicon we can hide "-arm64", and on PCs we can hide "-x64".
For Intel chips on Mac we'll show "(x64)" suffix, and on PCs we'll
show "(x86)" for 32-bit version.
2023-11-26 22:13:08 -03:00
David Capello
700217c413 Remove cmake policies that aren't used anymore 2023-11-26 21:46:20 -03:00
David Capello
28a140f736 Add missing #includes to use ASSERT() macro 2023-11-26 21:44:16 -03:00
David Capello
3486dcca7e Add minor comment in DocExporter::createEmptyTexture() (#4127, #4135) 2023-11-23 09:47:12 -03:00
Gaspar Capello
9f0cac32b3 Fix palette is not generated from RGB sprite sheet file after Export Sprite Sheet (fix #4127) 2023-11-23 09:42:19 -03:00
Gaspar Capello
8226e5285a Fix Dialog.bounds doesn't work as expected (fix #3898)
Prior to this fix, the 'Dialog:show()' function overrode bounds when
they were defined before the 'show' command.
2023-11-22 18:22:20 -03:00
David Capello
aeb7157277 Fix possibility to edit tileset base index (fix #4163)
Regression from 242555ab06
2023-11-22 16:11:49 -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
David Capello
eafb779ef0 Possible fix to some RotSprite crashes (#2780) 2023-11-21 12:58:31 -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
cbe14089af Enable FineControl for selection transformation only if we press the Ctrl key again (fix #3977)
Reimplement #3977 and #3990
2023-11-20 20:02:24 -03:00
David Capello
a27ea04f7d Revert "Fix after dropping a selection via Copy (Selection + Ctrl), handlers are not positioned correctly (fix #3977)"
This reverts commit 456113d015.
2023-11-20 16:38:12 -03:00
David Capello
fee543f9e1 Add option to disable Snap to Grid by default when we move the selection (fix #4153) 2023-11-20 15:19:38 -03:00
David Capello
8af4747635 Use configured dynamics of active tool w/o opening dynamics popup (fix #4151) 2023-11-20 14:50:52 -03:00
David Capello
cc0f8d0dc4 [lua] Fix crash calling io.open() without argument (fix #4159) 2023-11-20 14:34:50 -03:00
David Capello
340ed3f68f Fix crash making a tileset bigger and pressing Remap (fix #4144)
This happens only if the tilemap already has tile references outside
the valid range of the tileset (and even bigger than the new tileset
size).
2023-11-15 20:58:00 -03:00
David Capello
1311944667 Add option to enable the Snap to Grid option for the brush preview (fix #4137) 2023-11-15 20:30:58 -03:00
David Capello
f92f14f261 Fix possible crash adding reference layer (fix #3949) 2023-11-13 10:51:19 -03:00
David Capello
d39a656bb4 Merge branch 'flip' (fix #3603)
Implemented a specific item of tilemap feature (#977) to allow flipped
tiles in X/Y/Diagonal axes.
2023-11-13 09:31:20 -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
a56c801041 Move the timeline button in the toolbar to the bottom 2023-11-10 15:42:52 -03:00
David Capello
dd5fb871b5 Remap tiles with flags correctly 2023-11-10 11:55:23 -03:00