Commit Graph

7935 Commits

Author SHA1 Message Date
Gaspar Capello
7b302794f9 Fix incorrect brush preview when Snap to Grid is active (fix #3743) 2023-09-14 12:33:21 -03:00
Gaspar Capello
6c34be5eb6 Fix initial folder for File > Save with the last one visited (fix #3996)
Regression added in 056073b3f1 in the
custom file selector. Every time you saved a new sprite the dialog
started at the root path (e.g. Desktop) instead of the last used
directory.
2023-09-14 12:31:28 -03:00
Martín Capello
815366d385 [lua] Add support to modify tabs buttons via Dialog:modify 2023-09-12 17:21:00 -03:00
Martín Capello
6010748f81 [lua] Add tabs onclick and ontabchange events support 2023-09-12 17:21:00 -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
David Capello
0ae408fe4e [osx] Disable native file selector by default on macOS 10.11 (fix #3984) 2023-09-12 16:14:56 -03:00
David Capello
84bd6b69f5 [win] Fix bug pasting 8bpp images (fix #4029)
Fixes a bug copying 8bpp images (e.g. from YY-CHR program).
Regression introduced in 282b040b52

Related thread: https://community.aseprite.org/t/6842
2023-09-01 17:37:11 -03:00
David Capello
f4aa19ad8c Add names to threads (#3729)
This is useful for Sentry crash reports, so we can identify threads by
name.
2023-08-29 13:55:40 -03:00
David Capello
702a7d5265 [lua] Rename Dialog:canvas{ autoScaling -> autoscaling } (fix #4011) 2023-08-21 21:10:51 -03:00
David Capello
75d7834609 [lua] Add decorate={rulers, dimmed} params to app.editor:askPoint{} 2023-08-21 20:49:58 -03:00
David Capello
922ebf3039 [lua] Increment scripting API version 2023-08-21 20:49:58 -03:00
Gaspar Capello
572cdf2b0e Add check box "Same in all tools" in the Dynamics options window (fix #4003)
Now each tool has independent 'dynamic options'. A global configuration
for all tools is also possible via the 'Same in all tools' option.

ALso this fix, solves a regression inserted in:
2cc15cda9e
(bug inserted: stabilizer is always active)
2023-08-18 15:35:15 -03:00
Martín Capello
115e20d2a5 Add tab widget to lua api 2023-08-14 18:08:33 -03:00
Gaspar Capello
456113d015 Fix after dropping a selection via Copy (Selection + Ctrl), handlers are not positioned correctly (fix #3977)
This fix disables the fine control when the transformation doesn't
include rotation, skew and/or fine scaling (so just translating doesn't
allow fine control until we rotate/skew/scaling, this might change in
the future if we add a new anti-aliasing rotation algorithm).
Also this fix improves the regular movement of the selected image.
2023-08-14 18:08:20 -03:00
Gaspar Capello
2cc15cda9e Add save dynamics options between sessions (fix #3933) 2023-08-14 18:07:46 -03:00
David Capello
9755efece4 Add note to remove duplicated code incorporated in aebb370906 2023-08-14 18:06:55 -03:00
Martín Capello
aebb370906 Add autoscrollbars feature to Lua API Dialog:show function 2023-08-14 18:04:24 -03:00
Martín Capello
1143e3bb4f Limit window position to prevent hiding its title bar when using single-window UI (fix #3839) 2023-08-14 18:04:24 -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
2406e2b197 Add FlipDiagonal algorithm 2023-08-09 16:12:02 -03:00
David Capello
aeeef8e255 Add suppor for doc::Image row stride size > width size
This patch solves several problems introducing the possibility to
specify a row stride bigger than the width (visible pixels) on each
image row. Useful in case that we want to align the initial pixel
address of each row (if DOC_USE_ALIGNED_PIXELS is defined).

This allows us to use some SIMD intrinsics (e.g. SSE2) for some image
functions in the future (right now implemented only in the new
is_same_image_simd_templ() for is_same_image()).

Anyway to avoid breaking some existing code, by default we'll still
keep the old behavior: row stride bytes = width bytes (so
DOC_USE_ALIGNED_PIXELS is undefined).
2023-08-07 15:27:39 -03:00
David Capello
ce37fbc8e3 Minor fix in doc_range_tests in the internal image used 2023-08-04 14:45:31 -03:00
David Capello
558ff54cb0 [lua] Add traceback info when a doc object is deleted and we try to use it
A reference to a doc object (Sprite, Layer, Cel, etc.) is done through
its ID in the scripting engine, when we try to access it from a script
that element might be already deleted. Previously we displayed the a
message like "Using a nil 'Cel' object". With this change we show the
traceback and a "Tried to access a deleted 'Cel'" message.
2023-08-03 20:45:44 -03:00
David Capello
413288a014 Improve flip_image() performance (x10 from old impl, x2 from new slow impl)
The old impl was using get/put_pixel(), the new slow one is using the
get/put_pixel_fast(), and the new default flip_image() is using just
raw pointers.

Added some utilites like random_image() for testing purposes, and
DOC_DISPATCH_BY_COLOR_MODE() macros to avoid switch/case for each
color mode. In a future these might use generic lambdas.
2023-08-02 17:35:20 -03:00
David Capello
2e1d50bf33 Fix some std::clamp() calls: max value cannot be less than min value 2023-07-31 10:31:08 -03:00
Gaspar Capello
ab2d7f79a3 Fix Magic Wand should "refer to visible layers" anyway when the active layer is hidden (fix #3939) 2023-07-25 10:27:06 -03:00
Gaspar Capello
a2e3ab44bd Don't rotate rectangular selection when we're in "subtract mode" and touch editor edges (fix #3976)
As Shift+Alt enables the subtract mode, if we touch an editor edges
and receive a MouseEnter message, we cannot update the selection
modifiers with the pressed Alt key because that will start rotating the
rectangular marquee automatically. We've to start rotating only if we
release the Alt key and then press it again (not by just moving the
mouse).

Recent regression introduced in bd91a6430f
when the ordering of MouseEnter/Move/Leave message order was fixed.
2023-07-25 10:18:46 -03:00
David Capello
056073b3f1 Fix regression w/initial folder on file selector (fix #3979)
Regression introduced in 556c621eeb
2023-07-24 16:19:59 -03:00
David Capello
400456cbec Right-clicking a tileset mode button gives the possibility to set it as the default one
Feature request: https://community.aseprite.org/t/19487
2023-07-19 11:27:00 -03:00
David Capello
11644a7d16 Add Shift+F7 to toggle other layers visibility on Preview window 2023-07-19 10:56:16 -03:00
David Capello
32009723c5 [lua] Ask for access for package.loadlib() function 2023-07-19 09:15:15 -03:00
David Capello
890ed91d81 [x11] Disable the native file selector on X11 (#3974)
It looks like the mouse got captured by the Aseprite window if we
start the Zenity command using the mouse in certain way (e.g. when we
click the Open File link from the Home tab). The same doesn't happen
if we press Ctrl+O or click the File > Open menu.
2023-07-18 21:42:49 -03:00
Gaspar Capello
e9f078e66e Fix error decoding pico-8 GIFs (fix #3922) 2023-07-18 20:55:32 -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
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
lampysprites
7ee866643b [lua] Add width and height properties to app 2023-07-18 15:50:22 -03:00
lampysprites
30b858d89e [lua] Add "resize" to app events 2023-07-18 15:50:19 -03:00
Gaspar Capello
98366d3dee Fix layer name cell resizing in timeline during gui scaling or theme change. 2023-07-18 15:39:59 -03:00
Gaspar Capello
264cd98ab4 Fix menu items that don't respect UI scale (fix #3843) 2023-07-18 15:39:59 -03:00
Gaspar Capello
081f1e535b Fix ButtonSet widget with icons resizing when UIScale is changed 2023-07-18 15:39:59 -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
daf3e70e9d Fix warning about undefined blend mode conversions
This was added to avoid the "control reaches end of non-void function"
warning.
2023-07-17 19:29:07 -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
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
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
David Capello
bd91a6430f Process os::Event::MouseEnter/Leave in correct order
When we received a MouseEnter/Leave, we were processing those laf-os
events immediately without taking care of all the MouseMove/Down/Up
events in the middle. Now we enqueue all the events as
messages (MouseEnter -> MouseMove/Down/Up -> MouseLeave).

This is important because when we process MouseLeave we are calling
setMouse(nullptr), which resets the mouse widget HAS_MOUSE flag, and
some widgets needs to know if they have the mouse above before the
MouseUp event. With this change we can remove the
Widget::hasMouseOver() function (that was checking the global
ui::get_mouse_position() instead of the HAS_MOUSE flag directly).

Another change was introduced to keep the old behavior now that
hasMouseOver() is not available: the ui::Manager doesn't assign the
HAS_MOUSE flag if the mouse is captured (it only assign the HAS_MOUSE
to the widget with the mouse captured, or to no widget, at least until
the capture is released).
2023-07-10 10:54:37 -03:00
David Capello
48275d51c2 [lua] Add new AfterAddTile event for tile management plugins
Replaced the App BeforePaintEmptyTilemap event (introduced in
c26351712a) with the new Sprite
AfterAddTile event triggered by draw_image_into_new_tilemap_cel().
This new event handles two cases:

1) When the user paints on an empty tilemap cel, a new tile is
   created, so the tile management plugin can handle AfterAddTile
   to know the existence of this new tile.  (This case was disabled
   with fae3c6566c, then handled with
   c26351712a, now handled with this
   patch).

2) When we copy & paste cels (or drag & drop cels) in the timeline
   between layers, if a new tile is created, the AfterAddTile is
   called and the plugin can associate tiles with its internal
   information (e.g. folders)

Related to: https://github.com/aseprite/Attachment-System/issues/135
2023-07-07 18:40:06 -03:00
Martín Capello
9db01bf82f Fix crash accessing theme dimensions/info in a plugin's init() function (fix #3913) 2023-07-06 18:21:36 -03:00
Martín Capello
b0b2fb378e Fix direction reset after scrolling the editor while playing an animation with "ping-pong" direction (fix #3903) 2023-07-06 17:54:06 -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
Zephyr Lykos
2f6655f57e Fix compilation on GCC13
See: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Bug: https://bugs.gentoo.org/865117
Bug: https://bugs.gentoo.org/895616

Signed-off-by: Zephyr Lykos <self@mochaa.ws>
2023-06-29 14:19:43 -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
556c621eeb Add native file dialog for Linux using zenity (fix #1953, fix #2354)
The Zenity utility is not perfect, there are several issues to improve
the UX, but it's good enough to offer a native file dialog on Linux
without depending on huge dynamic GUI libraries (GTK+, Qt, etc.).
2023-06-27 14:28:32 -03:00
Akylzhan
3e171d0f6a Change ColorEntry base to ExprEntry to support math expressions (fix #3900) 2023-06-23 13:11:07 -03:00
Gaspar Capello
da90a57ce0 Fix selected image is modified by moving the pivot point in certain positions (fix #3901)
Prior to this fix, there was a spurious movement on a selected image
simply by moving the pivot point. Steps to reproduce it:

- Select a canvas area
- Zoom at 300%
- Make the pivot visible and move it to a negative coordinate
  position (less than the origin 0,0)
- If you rotate/skew the image this problem cannot be reproduced
2023-06-14 12:04:00 -03:00
Gaspar Capello
a628bbb58b Fix changing brush size w/drag value when multiple editors are opened (fix #3884)
This fixes unnecessary propagation of kKeyDownMessage/kKeyUpMessage
messages across all open editors. The pressed key should be sent to
the active editor or the one with the mouse over it.
2023-06-06 10:02:37 -03:00
David Capello
fc24613b81 Add compatibility check for future tilemaps w/unsupported tile formats 2023-06-01 13:02:35 -03:00
David Capello
2f54bcaf37 Fix crash (using freed memory) changing Screen/UI Scaling/Theme for a very specific ColorBar/PaletteView case (fix #3906)
We were able to reproduce this putting the black border of the
ColorBar's PaletteView touching its viewport, and changing from Screen
Scaling=200% & UI Scaling=100% to Screen Scaling=100% & UI
Scaling=200% (with the memory sanitizer on).
2023-05-31 14:57:37 -03:00
David Capello
637d71a276 [lua] Test Image:flip() with sprite and without sprite (#3854) 2023-05-18 13:20:41 -03:00
David Capello
ccc57800a8 [lua] Add support to use app.sprite = nil 2023-05-18 13:20:10 -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
66ac837305 Fix brush and pasted image preview on empty cels (fix #3882)
Fix regression introduced in 24846eae10
using the new RenderPlan structure. We have to include empty/nullptr
cels in the plan to paint the preview image in the selected
layer/frame (the preview image is the one used for the brush preview,
and for the transformation preview when we paste the clipboard content
on the canvas).
2023-05-18 12:56:09 -03:00
David Capello
da70dd3892 Increment scripting API version 2023-05-18 12:42:35 -03:00
David Capello
c26351712a [lua] Add new 'beforepaintemptytilemap' app event
Now a tileManagementPlugin can customize the creation of empty tiles
when the user starts drawing on an empty cel.

To implement: https://github.com/aseprite/Attachment-System/issues/119
Related to: https://github.com/aseprite/Attachment-System/issues/127
2023-05-18 12:40:12 -03:00
David Capello
d329f38075 [lua] Add stopPropagation function to the beforecommand event
Related to:
https://github.com/aseprite/Attachment-System/issues/121
https://github.com/aseprite/Attachment-System/issues/127
2023-05-18 11:49:04 -03:00
David Capello
961dee4354 [lua] Add 'beforecommand' and 'aftercommand' app events
This will allow to implement custom horizontal/vertical flip:
https://github.com/aseprite/Attachment-System/issues/121

Related to:
https://github.com/aseprite/Attachment-System/issues/127
2023-05-18 11:29:23 -03:00
David Capello
d5406cbc55 Fix bug reading UUID property from backup data/undo data 2023-05-17 12:36:17 -03:00
Gaspar Capello
398ca95392 Fix timeline is not repainted/invalidated when we switch onion skin option (F3 key) (fix #3806) 2023-05-16 14:30:08 -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
Martín Capello
c902c563e3 Fix crash in app::tools::BaseInk::prepareForPointShape (fix #3338) 2023-05-15 14:38:58 -03:00
Martín Capello
6ab1b2c653 Revert "Fix crash in app::tools::BaseInk::prepareForPointShape" because it breaks other tools functionality (fix #3869) 2023-05-15 14:35:39 -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
Martín Capello
72d518c5e2 Fix crash in app::tools::BaseInk::prepareForPointShape (fix #3338) 2023-05-11 12:35:51 -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
David Capello
77cdbf4739 Fix Widget::setTransparent(false) 2023-05-10 14:54:21 -03:00
David Capello
10cdad9c58 Avoid crashes in the Timeline if the sprite hasn't any layer
Given 32ed6622d4, now we could be in a
situation where the sprite is loaded without layers because all layers
are incompatible with the current version. So we have to take care of
this situation in the Timeline UI.
2023-05-09 22:08:37 -03:00
David Capello
32ed6622d4 Mark unknown layer/cel/chunk/color profile types as incompatibility errors 2023-05-09 22:06:13 -03:00
David Capello
387b46d72b Minor formatting changes
Don't call fmd::format() or c_str() when it's not needed.
2023-05-09 21:58:54 -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
Martín Capello
da80192d0f Add UUID type to user properties (fix #3810) 2023-05-08 17:13:34 -03:00
David Capello
948bf98b86 Saving a non-sequence file type (aseprite/gif/webp/fli/etc.) must create all required directories too 2023-05-08 16:22:42 -03:00
David Capello
d75424fe87 Simplify iteration of frames in WebPFormat::onSave() 2023-05-08 16:22:41 -03:00
Gaspar Capello
afbede3eae Fix webp export to export one tag correctly instead of all frames (fix #3622) 2023-05-08 16:22:31 -03:00
David Capello
8e91d22b70 Fix experimental "nonactive-layers opacity" mode for the SimpleRenderer
Regression introduced in 24846eae10
2023-05-05 22:11:19 -03:00
David Capello
8cdb4edcac Fix bug where we were able to click a non-foreground window
With multiple windows on, if a modal/foreground window like Canvas
Size (which has a special onBroadcastMouseMessage()) were running, and
there was a script dialog also opened on the background, the
non-foreground dialog could receive clicks. This patch fixes this
particular scenario (no other window than the actual foreground window
can receive mouse clicks).
2023-05-05 20:08:39 -03:00
David Capello
25cb258f76 Wrap all TRACE() calls in data recovery functions with RECO_TRACE()
In this way we can completely disable the log of data recovery events.
In a future we might offer a way to log all these events in a log file
(probably included in crash reports).
2023-05-01 19:22:53 -03:00
David Capello
b7f06c1366 [devmode] Ctrl+Shift+R shortcut is available in devmode (debug can be on or off) 2023-05-01 19:18:23 -03:00
David Capello
10ea91cb52 Fix crash saving user brushes in unknown situations (fix #3728)
We've received crash reports where save_xml() throws an Exception()
because the user brushes file cannot be saved (open_file(..., "wb")
returns nlulptr). We're not sure why (probably privileges?) but at
least we fixed the exception.
2023-05-01 10:57:37 -03:00
David Capello
4d3575f4ce Fix crash when an extension adds a command in a non-existent menu group (fix #3835) 2023-05-01 10:50:53 -03:00
David Capello
bfe4669c0e [devmode] F1 key switches the renderer only when pressed w/o modifiers 2023-04-27 11:44:11 -03:00
Martín Capello
0958573cac Add canvas autoScaling feature (fix #3748) 2023-04-27 11:07:26 -03:00
David Capello
067309f776 Fix crash decoding huge .aseprite files
Now we don't allocate an huge temporal array of width x height x bytes
per pixel to store uncompressed data per image.

Reported by an user editing a 35000x35000 canvas. Similar to
https://community.aseprite.org/t/vector-too-long-empty-file-and-lost-work/6844

Internal report: https://igarastudio.zendesk.com/agent/tickets/4703
2023-04-26 16:30:04 -03:00
David Capello
1c75092e13 Fix crash w/double backToPreviousState() when the state after app.editor:askPoint() is canceled from the script 2023-04-25 19:55:32 -03:00
David Capello
9b76f95b15 Fix Left/Right keys to move through frames in FramesSelection context (fix #3821) 2023-04-25 10:38:49 -03:00
David Capello
a9207524ff Minor refactor in code to handle keys
Added CustomizedGuiManager::processKey() member function.
2023-04-25 10:30:39 -03:00
David Capello
f655d57069 [lua] Add app.editor.spritePos/mousePos and app.editor:cancel()
Added properties needed to know where the mouse position is on the
editor canvas + a method to cancel app.editor:askPoint() from Lua.

Related to aseprite/Attachment-System#102
2023-04-25 09:03:20 -03:00
David Capello
2baf291b4a [lua] Add "point" argument to app.editor:askPoint() for initial point
Related to aseprite/Attachment-System#102 and could be used for
aseprite/Attachment-System#103
2023-04-24 23:11:09 -03:00
David Capello
72dbcf51d1 [lua] Add onchange event to app.editor:askPoint()
Related to aseprite/Attachment-System#102
2023-04-24 22:48:30 -03:00
David Capello
ff4d60bd09 [lua] Add app.editor:askPoint() (fix aseprite/Attachment-System#102) 2023-04-20 11:14:14 -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
622b02294a [lua] Add short field names (fix #3815, fix #3816) 2023-04-19 13:48:15 -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
f0e80f1b5a Fix failing ASSERT(i >= 0 && i < int(m_states.size())) in ListBox::selectChild()
We receive kMouseMoveMessage as the first message of a multiselect
message in a ListBox when the kMouseDownMessage message is received by
a separator first e.g. if we click a separator from the Recover Files
tab and start dragging the mouse this assert was failing.
2023-04-17 22:32:22 -03:00
David Capello
79745756ef Fix bug removing submenu-groups inside menu-groups created by plugins
Before this the ASSERT(group.items.empty()) in
AppMenus::removeMenuGroup() was failing when a plugin created
subgroups/submenus inside groups.

We have to remove plugins items in the reverse order that they were
added to uninstall them correctly.
2023-04-17 20:12:31 -03:00
David Capello
172e1a615b Respect z-index layer ordering when there are empty cels
An empty cel must be counted as a layer for the z-index ordering, so
the z-index refers to number of layers to move back/front, but number
of non-empty cels in the specific frame.

A this fix, a new issue appears: #3820
2023-04-17 19:24:20 -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
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
Gaspar Capello
17b976b3aa Fix regression {slice} format on CLI doesn't work (fix #3801) 2023-04-12 15:00:40 -03:00
Martín Capello
8841f3da32 Move window relayout before inserting the window to the manager (fix #3746)
This is necessary to prevent the manager to invalidate a window whose relayout is not finished. This can happen when a script opens a new window when another is currently opening. For instance a script whose canvas.onpaint handler opens another dialog.
2023-04-12 14:10:45 -03:00
David Capello
636cce6f0d [lua] Add Uuid type (fix #3809) 2023-04-12 13:51:37 -03:00
David Capello
7104a1a449 F2 renames the layer if a range of frames is not selected (fix #2326)
In this way we can use F2 to:

1. Set the Loop section if two or more frames are selected
2. Remove the loop section if only one frame is selected
3. Rename the active layer if the layer is selected (or no frames are selected)
2023-04-11 19:04:45 -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
e38398d7aa Fix compilation when ENABLE_DEVMODE is disabled
We don't compile ShaderRenderer in production yet.
2023-04-07 21:36:04 -03:00
David Capello
538219f655 Fix warnings about unused members w/ImageIteratorT
Mainly when compiling src/doc/algorithm/rotate.cpp
2023-04-07 21:11:56 -03:00
David Capello
4f80008ea7 Merge branch 'gpu' (#3516, #3523)
An initial implementation (not yet ready for production) of the
ShaderRenderer to use SkSL shaders to convert indexed -> RGB, and draw
SkImages directly on SkCanvases (this will enable future GPU
acceleration).
2023-04-07 20:35:07 -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
be11e3b324 Recreate console window to print log messages if it was closed by the user
Regression introduced cc7da16691 when
the Console was converted to a non-modal window. If a script prints
something, the console is displayed, then the user can close the
console, and if the script tried to print something else the console
window wasn't displayed again until some other command was
executed (any command that called the Console::Console() constructor
which would create the ConsoleWindow again).

With this fix the console window is recreated/displayed again on the
screen.

This bug was well-known (but I think never reported yet) and probably
the possible source of the #3787 issue.
2023-04-05 18:26:15 -03:00
David Capello
264ee71b00 Add comment to improve Image_drawImage/convert_args_into_point() interaction in the future 2023-04-05 12:43:24 -03:00
Gaspar Capello
2b3372df0e Fix backward compatibility with Image:drawImage(image, x, y) was broken (fix #3788) 2023-04-05 12:00:42 -03:00
Martín Capello
e577852eb4 Improve message error when loading a sequence of png files whose color modes don't match (fix #3751) 2023-04-05 11:57:34 -03:00
Martín Capello
7422abf490 Ignore empty tiles when exporting tilesets and the "Ignore Empty" checkbox is checked (fix #3789) 2023-04-04 11:12:28 -03:00
David Capello
7b6187ada3 Minor changes before the merge with main
Added some extra comments + compile ShaderRenderer only when
ENABLE_DEVMODE is enabled.
2023-04-03 20:15:38 -03:00
David Capello
4fedc59f29 Fix render_tests setting the new BgOptions::colorPixelFormat field 2023-04-03 20:00:45 -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
7781ff69a1 Add support to render grayscale sprites with ShaderRenderer 2023-04-03 15:59:29 -03:00
David Capello
9e08386a28 Add support to render indexed images
For this we need a new SkSL shader that receives the palette and the
indexed image data and outputs the RGBA values for each fragment.
2023-04-03 15:59:29 -03:00
David Capello
af074fd6bf Add support to render tilemaps 2023-04-03 15:59:29 -03:00
David Capello
ef6f80221e Add preview image support in ShaderRenderer
In this way we can see the real-time feedback when we're drawing when
we use the ShaderRenderer.
2023-04-03 15:59:29 -03:00
David Capello
3dbf88c9cd Ignore hidden layers in ShaderRenderer 2023-04-03 15:59:29 -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
David Capello
3c099dc4dc Add support to cel/layer opacity + some blend modes 2023-04-03 15:59:29 -03:00
David Capello
f621472b7c Draw cels creating a SkShader from SkImage directly from the doc::Image data 2023-04-03 15:59:29 -03:00
David Capello
be583f8149 Add initial (incomplete) version of ShaderRenderer
This new renderer uses a shader to paint only the checkered
background. It can be tested only in ENABLE_DEVMODE and pressing F1
key to switch between the renderers (which is a devmode special key
for testing purposes only)

We've changed the Renderer::renderSprite(Image*, ...) member function
to renderSprite(os::Surface*, ...) so we receive the os::Surface
directly to paint the SkCanvas with a SkShader. Probably more
refactors will be needed.
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
83ddb6018e Minor change in FileOp::createSaveDocumentOperation() 2023-04-03 14:08:21 -03:00
Gaspar Capello
b83afb4daa Fix scrolling through tile entries without tilemap layer selected crashes the program (fix #3712) 2023-03-30 11:06:59 -03:00
Martín Capello
961dc46066 Avoid dialog's window relayout during an ongoing window's size change 2023-03-28 14:09:03 -03:00
Martín Capello
5fb0b72c73 Fix hexpand and vexpand setting 2023-03-28 13:54:02 -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
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
David Capello
668a3d8159 Remove the marching ants effect from Timeline after paste
This is a simple fix for a recurrent problem where users don't know
how to remove/deselect the copied selection from the timeline after
pressing Ctrl+C. Generally the solution is pressing the Escape key,
but just pasting with Ctrl+V in some destination will disable the
effect now (just like spreadsheet apps work).

Related to:
https://community.aseprite.org/t/3941
https://community.aseprite.org/t/5038
https://community.aseprite.org/t/17281
https://github.com/aseprite/aseprite/issues/1498
2023-03-27 20:46:52 -03:00
Gaspar Capello
637632eafb [lua] Add blend modes to Image:drawImage() 2023-03-27 20:31:58 -03:00
David Capello
af9f7288ee [lua] Add 'ondblclick' event for canvas widget 2023-03-27 14:22:10 -03:00
David Capello
11abe10c20 Add ability to use mnemonic without modifiers in alerts
Requested in https://community.aseprite.org/t/16845
2023-03-23 16:15:51 -03:00
David Capello
53c851c547 [lua] Add GraphicsContext:oval() function 2023-03-23 14:56:01 -03:00
David Capello
44729b27a7 Fix compilation when !ENABLE_UI 2023-03-23 14:48:30 -03:00
David Capello
78de8dfa56 [lua] Add app.theme:styleMetrics() function 2023-03-23 14:11:51 -03:00
David Capello
0c092cc37c Fix changing playback speed shouldn't stop the animation playback
Regression introduced in 30a88c8e3d
2023-03-22 18:39:29 -03:00
David Capello
1f7f3677f2 Play subtags + repeat field by default to avoid surprises
If we start playing from a tag with a repeat field, we'll just play
the tag as many times it says and continue with the regular animation
of the sprite. Users expect the repeat field to be useful with the
default configuration of the program.
2023-03-22 15:14:41 -03:00
David Capello
63a387d804 Fix crash right-clicking play button in the preview window is hidden
Regression introduced in 30a88c8e3d
2023-03-22 15:05:29 -03:00
David Capello
e865374805 Fix bug saving tags in file sequences using -save-as "{tag}_1.png"
Now the equivalent was "{tag}_{frame1}.png", but it looks like a
regression reported here https://community.aseprite.org/t/17253 were
it was possible to just specify the frame number as in "{tag}_1.png"
2023-03-22 14:35:52 -03:00
David Capello
30a88c8e3d Put playback options into Frame > Playback submenu
This menu was accessible right-clicking the Play button in the
Timeline (and in the Preview window, with specific options for the
Preview).

This change includes some changes:

1. Now if a menu <item> in gui.xml doesn't specify a text field, the
   text of the command is used (to avoid double translation, the bad
   side is that we don't have a mnemonic specified).
2. Menu::showPopup() can be used with submenus from the root menu, to
   do this we have to remove the menu item owner temporarily before we
   show the menu as popup (see the change in Menu::showPopup())
3. We can specify a special active DocView for commands with
   UIContext::SetTargetView, this is used to set the Preview editor as
   active view for commands like TogglePlayOnce, etc.
2023-03-21 17:18:05 -03:00
David Capello
0dbcdc8159 [lua] Add app.uiScale property 2023-03-20 18:26:44 -03:00
David Capello
d2fc1ae7b8 [lua] Add Plugin:newMenuSeparator() function 2023-03-20 18:25:21 -03:00
David Capello
f6df07ada6 [lua] Change GraphicsContext.opacity to an integer value from 0..255
To match the opacity of Layer and Cel.
2023-03-20 15:51:30 -03:00
David Capello
de307ba6b0 Minor changes in FileOp::createSaveDocumentOperation() 2023-03-20 12:55:43 -03:00
Gaspar Capello
18c56ae638 Add frame duration warnings saving animated GIF files (fix #1504) 2023-03-20 12:55:34 -03:00
David Capello
298981732e Don't change grid settings from Preferences if they aren't modified (fix #3479) 2023-03-16 18:08:40 -03:00
Martín Capello
7b63651775 Fix rotation inaccuracy (fix #3041) 2023-03-16 17:48:26 -03:00
David Capello
1d3be8c2fa Merge branch 'fix-onion-skin-loop-tag' 2023-03-16 17:47:12 -03:00
David Capello
17687d4012 Moving through the Undo History states must behave as we are redoing/undoing changes in the sprite
This "undoing" state (introduced in b43f2a3428)
is used in the scripting AppEvents (a ContextObserver) onActiveSiteChange()
impl to trigger a 'sitechange' event for scripts/plugins so they know
if the change was from a undo or from the regular user interaction
(some scripts will add more actions to the transaction if the change
is from the user, not from a undo/redo, or now with this fix,
navigating the history)

This was a source of crashes for the Attachment System when using the
Undo History (e.g. https://github.com/aseprite/Attachment-System/issues/83
+ using the Undo History window)
2023-03-16 17:10:17 -03:00
David Capello
b7770f5fac [lua] Add KeyEvent.repeatCount (fix aseprite/api#95)
As "repeat" is a keyword on Lua, it makes things complicated.
2023-03-16 14:55:30 -03:00
David Capello
87251e52be Fix assert() when reading a LayerTilemap() from undo where a nullptr tileset is set temporarily 2023-03-16 10:44:55 -03:00
Martín Capello
6a827890ab Fix to make TwoLoopsInCascadeReverse test work 2023-03-15 17:56:07 -03:00
Martín Capello
b1335c2c00 Fix onion skin rendering (fix #3739) 2023-03-15 17:56:07 -03:00
Martín Capello
6702844314 Minor code simplifications 2023-03-15 17:56:07 -03:00
David Capello
eb82bd6ce5 Set display parent of menu boxes correctly (fix #3754) 2023-03-15 16:37:28 -03:00
David Capello
5831cda066 Fix std::clamp() assert fail in ui::fit_bounds() 2023-03-15 16:32:56 -03:00
Martín Capello
e6cd13d7e1 Allow recovering of sessions generated in previous Aseprite versions (fix #3727) 2023-03-14 19:10:11 -03:00
David Capello
e79907dae3 Add missing src/app/script/blend_mode.h file for 17c66181ae 2023-03-13 21:40:20 -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
87cd81b9f6 [lua] Cache temporal surface in GraphicsContext::drawImage() 2023-03-13 17:10:25 -03:00
David Capello
c280732fb1 [lua] Use SrcOver blend mode for GraphicsContext::drawImage() 2023-03-13 17:10:09 -03:00
David Capello
e4d3e7d4cf Add info about installed extensions w/Sentry breadcrumbs (#3729) 2023-03-13 16:12:03 -03:00
David Capello
88296340a6 [lua] Add Size:union() function 2023-03-13 16:03:03 -03:00
David Capello
3280b87a53 Minor change: replace macro with inline function
Always prefer functions or template functions instead of macros.
2023-03-13 11:11:05 -03:00
Martín Capello
b72d498070 Introduce a "combobox" style to replace the way combobox entries are painted 2023-03-13 10:52:01 -03:00
Martín Capello
7a338250a3 Fix alignment of several controls when UI scaling is 200% and Screen scaling is 100% to make them look the same as when US scaling is 100% and Screen scaling is 200% 2023-03-13 10:52:01 -03:00
David Capello
af043a0c9f Update clip module 2023-03-13 10:50:58 -03:00
David Capello
23557a190b [lua] Add Plugin:newMenuGroup() to add submenus (fix #3731) 2023-03-09 16:41:37 -03:00
David Capello
b43f2a3428 Fix order of cmds added when a new layer is created (fix #3736)
As creating a new layer was generating a onActiveSiteChange() event,
if a script was listening that event and adding new
actions (e.g. changing the layer properties), the order of cmds was
incorrectly created (e.g. cmd::SetUserDataProperty for the layer, and
then the cmd::AddLayer).

With this change we first add the cmd::AddLayer and then any extra
cmd::SetUserDataProperty (or any other action) that can be added in
the sitechange event.

We've created ev.fromUndo flag to the app 'sitechange' Lua event so
scripts can detect if we are undoing/redoing in a site change event,
and avoid adding new properties/actions when this happens.

And we have added a new exception (CannotModifyWhenUndoingException)
to detect if a new action/cmd is added (incorrectly) when we are
undoing/redoing.

Related to #3720
2023-03-07 20:41:15 -03:00
Martín Capello
b34a50a87e Fix regression pasting images outside the canvas limits (fix #3725) 2023-03-07 17:44:18 -03:00
Martín Capello
ff14066d1f Use coordinates of type double to calculate grid lines positions 2023-03-07 17:18:11 -03:00
David Capello
232131122e Fix crash/assert painting a RecentFileItem (or any ui::Widget) without parents (fix #3504)
We were finally able to reproduce #3504 (an assert fail) and it looks
like a bug in the Widget::removeChild() function, where kPaintMessage
messages weren't removed from the queue after the widget is removed
from its parent.
2023-03-04 12:07:28 -03:00
Gaspar Capello
31ca1b6350 Removed alpha threshold in octree map algorithm (fix #3715) 2023-03-03 15:44:14 -03:00
David Capello
5d543fe463 Don't notify about the CPU architecture in the Sentry release version
So we can group all crash reports by version number (the architecture
is informed by Sentry).
2023-03-03 15:07:12 -03:00
David Capello
355ceacff4 Merge branch 'buttonset-issues' (fix #3554, merge #3565) 2023-02-28 15:08:54 -03:00
David Capello
c2b7eaf97f Fix compilation with clang-10 + libstdc++ 7.5.0
It looks like the std::variant impl doesn't convert from long long to
int64_t type automatically, but we might be wrong. Anyway this patch
does fix this.
2023-02-28 15:06:26 -03:00
David Capello
0ae8bc9b10 Improve backward compatibility with old themes
We have to copy all missing <style> into the new theme, so these
styles are re-loaded using colors and parts from the new
theme (instead of using the data of the default theme).
2023-02-28 14:28:09 -03:00
David Capello
33c92dd218 Fix some warnings
- Added missing override
- Removed some unused captures for lambdas
- Removed some unused local/member variables
2023-02-28 13:05:02 -03:00
David Capello
c9470472af Don't use string literal in lambda inside ButtonSet::addItem() 2023-02-27 19:21:02 -03:00
David Capello
21a63b9fdf Minor change in formatting of conditional ternary operator 2023-02-27 19:18:25 -03:00
David Capello
ff1211bc84 Minor changes in theme.xml/style names 2023-02-27 18:02:10 -03:00
David Capello
0491bf60d7 Show the Tiles button highlighted ("button_selected_text") when it's in tiles mode
It was planned to use this color for this button when it's on.
2023-02-27 16:58:31 -03:00
David Capello
5ea89141fd Fix regression with Pal Edit button
The icon/stylus was inverted. We've also moved the icon for each state
to the theme xml (so we don't need to use setIcon() manually anymore
for this button).
2023-02-27 16:48:50 -03:00
David Capello
fa4f0d1fa9 Limit the brush size for preview to an odd-size to align the center correctly for big brushes
As now the BrushType button has an odd number width (15px), it's
better to limit the brush size to an odd number size (9px instead of
10px). In previous versions the BrushType button had an even number
width (16px) so the 10px brush size was correctly centered.
2023-02-27 12:06:23 -03:00
David Capello
672f371622 Add warning to ButtonSet::addItem() which is not safe to use w/a non-string literal 2023-02-27 12:06:23 -03:00
Martín Capello
d88eb80fe6 Fix theme initialization for theme variants widget 2023-02-27 11:59:20 -03:00
Martín Capello
b2365b557d Fix theme initialization for paint bucket settings menu 2023-02-27 11:04:07 -03:00
Martín Capello
f481d9c0e7 Fix timeline's animation buttons size 2023-02-27 10:21:50 -03:00
Martín Capello
029e520f81 Add styles for ink type and dynamics buttons 2023-02-27 09:44:42 -03:00
Martín Capello
ea43c5f6c8 Adjust styles to make them work with the new buttonset 2023-02-27 09:44:42 -03:00
Martín Capello
cc3c421391 Initialize theme for HueSaturationWindow 2023-02-27 09:43:48 -03:00
Martín Capello
3ab993d1d6 Update ButtonSet to use theme's styles 2023-02-27 09:43:48 -03:00
Martín Capello
40426075f2 Add gap, gap-rows, and gap-columns style attributes 2023-02-27 09:43:48 -03:00
Martín Capello
5325f56f67 Allow overriding the icon part used by icon layers with the icon provided by a widget 2023-02-27 09:43:48 -03:00
Martín Capello
1783704a53 Fix positioning of text and icon layers to avoid setting values that are not a multiple of the gui scale 2023-02-27 09:43:48 -03:00
Martín Capello
d3f01ebe17 Add width, height, minwidth, minheight, maxwidth, and maxheight attributes to styles 2023-02-27 09:43:48 -03:00
Martín Capello
e002316466 Take into account padding when painting text and icon layers 2023-02-27 09:43:48 -03:00
Martín Capello
dded1f6eae Add mnemonics attribute for font and styles to enable/disable accelerators underlining 2023-02-27 09:43:48 -03:00
Martín Capello
195a8d0e92 Fix border, margin, and padding attributes inheritance 2023-02-27 09:43:48 -03:00
Martín Capello
11dc816878 Add "capture" state to style layer states 2023-02-27 09:43:48 -03:00
Martín Capello
598e50be1d Fix brush icon scale for brush size button when guiscale is greater than 1 2023-02-27 09:43:48 -03:00
David Capello
c900327675 Add switch for "multiple windows" in Edit > Preferences > General
As the "multiple windows" feature is still buggy (#3556) and we've
disabled it by default, it's nice to make this option more visible (in
the General section) so users reliant on this will find the switch
quickly.
2023-02-24 17:11:51 -03:00
David Capello
24b273f806 [lua] Remove "remaptileset" sprite event
It's not safe to listen this event from a script because it can be
called from a background thread. We keep the code for a future
solution (in case that it can be found).

In other case, consider to finally delete this code.
2023-02-24 12:50:33 -03:00
David Capello
c3c1d29739 Update laf and clip submodules 2023-02-24 12:23:16 -03:00
David Capello
c2f8335891 [lua] Add Timer() type (fix #3251) 2023-02-22 20:00:07 -03:00
David Capello
835aa3f83d Use std::nullptr_t defined in <cstddef> 2023-02-22 19:55:32 -03:00
David Capello
cef84ad113 [lua] Fix regression, Dialog() must create a window with titlebar
Added a new Dialog{ notitlebar=true } parameter to avoid showing a
title bar explicitly. So we can continue using Dialog() to create
dialogs with the default "Script" title.

Regression introduced in 453d9c2168
2023-02-22 18:17:26 -03:00
David Capello
33a6a1c97e Add some tests for all_elements_of_same_type() function 2023-02-22 15:59:03 -03:00
David Capello
8f5e8256cf Replace INT/UINT_COMPATIBLE/IS_REDUCIBLE_INT macros w/templates 2023-02-22 15:58:47 -03:00
David Capello
70a388177d Move code related to UserData::Variants to doc/user_data.cpp
Only code that is related to <iostream> IO is in _io.cpp files.
2023-02-22 15:22:35 -03:00
Martín Capello
a7b5ab24bb Add (int) cast to constant to avoid issue with MSVC jumping the condition when it shouldn't 2023-02-22 12:51:51 -03:00
Martín Capello
062d1d922c Reduce the size of integer representations when possible 2023-02-22 12:51:51 -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
Gaspar Capello
fae3c6566c Fix don't create new tiles on tilemap layer in an empty cel with hasTileManagementPlugin. 2023-02-22 12:21:36 -03:00
David Capello
02b273d933 Remove some unused member functions from Timeline 2023-02-16 17:21:39 -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
ccef9cee4f Cache compressed tileset information from .aseprite files on memory
We've added an experimental option (enabled by default) to keep the
compressed tileset data when we load/save a .aseprite file to avoid
recompressing each time we save (and only compressing the tileset if
tiles are modified).

This is an attempt to make the save operation faster when we use
sprites with several tilemap layers + large tilesets (many tiles, with
big tiles).

Reference: https://github.com/aseprite/Attachment-System/issues/54
2023-02-14 13:03:06 -03:00
David Capello
6603775368 Minor refactor in .aseprite decoder/encoder
We've tested writing uncompressed tilesets, it's too slow for big
tilesets. Anyway read_raw_image/write_raw_image now support saving
uncompressed tilemaps if necessary in the future.
2023-02-14 12:29:49 -03:00
David Capello
eee79f5520 Don't access Preferences instance from dio::DecodeDelegate impl 2023-02-14 12:12:57 -03:00
David Capello
1b3998af01 Minor change in doc::Tileset internal structure
Merged m_tiles and m_datas in one vector.
2023-02-13 17:20:40 -03:00
David Capello
57e43c76b8 Detect scripts that modify a sprite when we are undoing/redoing 2023-02-09 07:43:33 -03:00
David Capello
67bb8f49ea Remove unused parameter in NEED_BAR() macro 2023-02-02 11:54:13 -03:00
David Capello
28749edf10 Fix segfault with -save-as between gif -> qoi from CLI
This can happen when any fatal error happens in
createSaveDocumentOperation(). The function must return nullptr to
stop the operation and avoid the regular saving process. This is
already checked in the GUI, but we have to do the same when the fatal
error happens from the CLI.
2023-02-02 11:50:34 -03:00
Gaspar Capello
e56a78e0d6 [lua] Add Tile_set_image method 2023-01-25 17:12:26 -03:00
David Capello
98f2964f6f Add Widget::setMinMaxSize() to set min/max size at the same time (fix #3652) 2023-01-18 11:39:00 -03:00
David Capello
0775b0d8ba Take care of an empty tileset in doc::Tilesets collection
We cannot delete a tileset yet from Aseprite UI, but now an extension
can do it through Sprite:deleteTileset(). Deleting the non-last
tileset will create an Tilesets array with an empty (nullptr) slot on
it (so tileset indexes are not changed, and for the future, if some
external file is referencing that tileset index, the reference will be
kept).

Related to https://github.com/aseprite/Attachment-System/issues/19
2023-01-17 17:49:21 -03:00
David Capello
6080af5346 Keep/restore the timeline position for each sprite/DocView (fix #3676)
In this way the store (in memory) the exact timeline position for each
DocView. Useful when editing multiple sprites and the timeline jumps
from one side to another.
2023-01-17 17:17:57 -03:00