Commit Graph

7957 Commits

Author SHA1 Message Date
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
David Capello
f536327fc1 Add app.transaction(string, function) overload
In this way we can specify the transaction/undo-redo label from a
script.
2023-01-17 15:39:16 -03:00
Gaspar Capello
e0aaa76e9c Add warning to Sprite:newTile() and Sprite:deleteTile()
Now, if the tileset does not belong to the sprite object, the lua engine throws an error. Also added a warning when tile_index = 0 on Sprite:deleteTile()
2023-01-16 10:42:31 -03:00
David Capello
60034267e1 Merge branch 'save-restore-userdata-undo-backup' (fix #3633) 2023-01-16 10:34:43 -03:00
David Capello
faabacdd39 [lua] Fix undo/redo of tileset properties changes (name/baseIndex) 2023-01-13 19:16:15 -03:00
David Capello
11a3e634b1 Fix bug undoing tileset deletion wasn't restoring its name correctly
Actually it looks like a long-standing bug in the write/read_tileset()
functions where tileset names aren't saved (so another bug fixed with
this change is that restoring a tileset from a crashes session/file,
will restore the tileset name correctly).
2023-01-13 18:54:31 -03:00
Martín Capello
f9843ac0f9 Remove ase_file_write_properties to be consistent with decoding 2023-01-12 17:15:30 -03:00
Martín Capello
5823abd1c0 Add serialization of custom properties 2023-01-12 17:15:25 -03:00
David Capello
705cc3af50 Fix assert failing when drawing an image with empty source bounds 2023-01-12 16:20:53 -03:00
Martín Capello
6d4e699601 Fix warning because AsepriteExternalFiles is declared as a class now 2023-01-12 14:59:15 -03:00
Martín Capello
f976c9f195 Convert countNonEmptyPropertiesMaps to a global function count_nonempty_properties_maps 2023-01-12 14:59:15 -03:00
David Capello
c910efe2f4 Fix compilation on Windows, now Button::Click doesn't receive an Event& 2023-01-12 13:01:56 -03:00
David Capello
5953e93402 [lua] Add possibility to display a Dialog as a popup menu
* Added new Dialog:menuItem{} widget
* Added Dialog:showMenu{} function
2023-01-12 11:09:05 -03:00
David Capello
39d1fb56d4 Remove ui::Event& args from ui::Button::Click signal
This is to simplify code and to match ui::MenuItem::Click and
ui::Button::Click signals (so then we can write some generic code
using Button::Click or MenuItem::Click).
2023-01-12 11:00:16 -03:00
David Capello
9678cc4ac3 [lua] Alternative Sprite:deleteTile(tileset, tileIndex) syntax 2023-01-12 09:32:44 -03:00
David Capello
9c728d2cac [lua] Add Tile.index getter 2023-01-12 09:21:05 -03:00
David Capello
a6c1b2bc88 [lua] Add a way to set the tileset associated to a layer tilemap 2023-01-11 10:48:39 -03:00
Gaspar Capello
822357869a Add new/delete tiles from a tileset using Lua (fix #3663) 2023-01-11 10:23:52 -03:00
Martín Capello
c299be50a5 Add a way to create and delete tilesets using Lua 2023-01-11 10:02:20 -03:00
Martín Capello
9910ab73f0 Fix Grid creation to return the new Grid instead of the default one 2023-01-11 10:02:18 -03:00
David Capello
453d9c2168 [lua] Add possibility to create dialogs without titlebar 2023-01-11 09:46:21 -03:00
David Capello
f5a79ce3b8 [lua] Add possibility to specify parent dialog 2023-01-11 09:38:19 -03:00
David Capello
7460e5f830 [lua] Add support to paint horizontal/vertical theme parts (e.g. separators) 2023-01-10 16:58:28 -03:00
David Capello
9e34656694 Fix saving the properties maps when there is an empty map
The exact number of maps specified in the header of the properties
chunk must be saved in the chunk data.
2023-01-09 15:55:09 -03:00
David Capello
e66985a06a Minor change in ase_file_write_property_value() to use variant type
Using a switch/case is better to decide the variant type (instead of
casting type by type).
2023-01-09 15:52:00 -03:00
David Capello
dd33cef4be Store one time each extension name in the external files chunk in .aseprite files
We've refactored the AsepriteExternalFiles struct to make it a
class (hiding members), storing maps ID -> filename per file
type (e.g. so we don't mix external tileset filenames with extensions
names, etc.), and re-using IDs for extensions names with the same
name (there is no need to store the same extension name multiple times
in the external files chunk).
2023-01-09 14:49:37 -03:00
David Capello
4232410719 Simplify AsepriteExternalFiles using one std::map for filenames/types 2023-01-09 12:53:06 -03:00
David Capello
bb3ba19fc6 Minor changes in .aseprite decoder/encoder to avoid depending on exceptions to control flow 2023-01-09 12:53:04 -03:00
David Capello
81b2507bb6 [lua] Add Tileset:tile(tileIndex) API to get tile image/data/properties (fix #3653)
This should replace the old Tileset:getTile(tileIndex) which returns
only the image.
2023-01-06 19:50:04 -03:00
David Capello
d590d3f39a Add nullptr_t to doc::UserData::Variant to fix bug when undoing an previously unexistent property 2023-01-06 14:36:51 -03:00
David Capello
8f09728105 Merge branch 'custom-properties-serialization' (fix #3632, #3645) 2023-01-06 10:03:19 -03:00
Martín Capello
b00b96877a Remove unused include 2023-01-06 10:02:14 -03:00
David Capello
f5bc573bfc Remove base::thread, we use std::thread 2023-01-05 16:43:09 -03:00
David Capello
177f42898a Replace std::stringstream() with fmt::format() 2023-01-05 16:35:24 -03:00
David Capello
eaa0f5e46a Fix unintentionally fall through 2023-01-05 16:22:20 -03:00
David Capello
7ede783926 [lua] Add key modifiers to mouse and touch messages on canvas widget 2023-01-05 16:14:00 -03:00
David Capello
8aa49479b8 [lua] Add Sprite.id and Layer.id properties 2023-01-05 16:01:42 -03:00
Martín Capello
03d66aa203 Introduce FLOAT and DOUBLE types 2023-01-05 15:30:45 -03:00
Martín Capello
eebc661a56 Add serialization/deserialization tests of sprite's user data properties 2023-01-05 15:17:02 -03:00
Martín Capello
dbeec18ef5 Add operator== to Fixed type to enable Vector comparisons 2023-01-05 15:17:02 -03:00
Martín Capello
db9db191f5 Fix serialization of external files chunk 2023-01-05 15:17:02 -03:00
Martín Capello
03f0c7ff08 Replace use of new with make_unique 2023-01-05 15:17:02 -03:00
Martín Capello
6c886cfa19 Add serialization/deserialization of user data custom properties 2023-01-05 15:16:57 -03:00
David Capello
1ce3e8e392 Take care of not using UI-related stuff on Clipboard class when ENABLE_UI=0 2023-01-05 14:23:15 -03:00
David Capello
7a1d6aef21 Include Clipboard utilities even when ENABLE_UI=0 2023-01-05 14:23:15 -03:00
David Capello
988cba2c2b Add "Copy Path" option when right-clicking a sprite tab 2023-01-05 14:23:15 -03:00
David Capello
fa3bdf853c Add support for sRGB and linear color profile (none) 2023-01-05 14:23:01 -03:00
David Capello
d3aac6a1cd Add support for .qoi file format (fix #3121) 2023-01-05 14:23:01 -03:00
David Capello
2e02bd307e [lua] Add ev.fromUndo=false in Sprite change event (so the event object isn't nil) 2023-01-05 11:23:42 -03:00
David Capello
17825921e0 [lua] Add onkeydown/onkeyup events to canvas widget 2023-01-04 14:40:10 -03:00
Martín Capello
8b4b803a22 Refactor AsepriteExternalFiles usage 2023-01-03 16:59:36 -03:00
David Capello
420278d5a4 Merge branch 'lua-api-for-properties' (fix aseprite/api#88) 2023-01-03 11:34:23 -03:00
David Capello
cf776adc9a Minor formatting changes in set_user_data.h 2023-01-03 11:14:52 -03:00
David Capello
645605305f [lua] Add undo information when we modify user data properties 2023-01-03 11:14:19 -03:00
David Capello
e2024c6edd [lua] Add "properties" property to all objects with user data 2023-01-03 09:00:58 -03:00
David Capello
427efef257 [lua] Add possibility to set the whole properties object 2023-01-03 09:00:36 -03:00
David Capello
b9537dbbe0 [lua] Add object.properties("extID") syntax to get extension properties 2023-01-03 08:34:14 -03:00
David Capello
9138592e98 [lua] Add support to set/get tables (arrays/maps) into user properties 2023-01-02 19:51:07 -03:00
David Capello
11dbb22efa [lua] Correctly call PropertiesIterator destructor using its __gc
This was detected by MSVC with its _ITERATOR_DEBUG_LEVEL=2 where
orphan iterators are detected when the map/container is destroyed.
2023-01-02 17:05:08 -03:00
David Capello
9f0491ddb6 [lua] Add support to iterate properties using pairs() 2023-01-02 14:36:49 -03:00
David Capello
ef0596fd01 [lua] Add __len operator to Properties 2023-01-02 12:54:37 -03:00
David Capello
c77c95181a Fix MSVC issue converting a string literal (const char*) to bool when assigning to a variant<bool, string, ...>
More information: https://twitter.com/davidcapello/status/1609918634075226121
2023-01-02 12:54:37 -03:00
David Capello
574f583753 Add std::visit() alternative using switch/case to push_value_to_lua() 2023-01-02 12:54:37 -03:00
David Capello
76a398b162 [lua] Add access to user data properties in Sprite object (aseprite/api#88)
This is a basic implementation where we can only access basic
properties (not maps or vectors yet).
2023-01-02 12:54:37 -03:00
David Capello
c7864c9fac Avoid MSVC issue converting implicitly a string literal (const char*) to bool when assigning to a variant<bool, string, ...>
More information:
https://twitter.com/davidcapello/status/1609918634075226121
https://developercommunity.visualstudio.com/t/10242620
2023-01-02 12:42:22 -03:00
Martín Capello
3167f8836c Add custom properties types constants 2022-12-30 17:23:31 -03:00
David Capello
dc0e57728a Minor changes to improve the UserData::Variant/Properties API
Mainly added ways to forward operator= and the default copy
constructor to the std::variant so we don't have to assign values
creating new Variant{}s.
2022-12-30 14:01:07 -03:00
David Capello
1830e5343f [lua] Add onwheel and ontouchmagnify events to Dialog:canvas() 2022-12-29 15:12:15 -03:00
Martín Capello
95a195b99b Fix how string properties are set to avoid tests failures in windows 2022-12-28 13:51:53 -03:00
Martín Capello
49ae010c7a Add UserData tests 2022-12-28 11:40:23 -03:00
David Capello
28c26aa62c [lua] Add ev.tileset value to remaptileset event 2022-12-27 15:54:41 -03:00
David Capello
c8d4c60f07 [osx] Fix error using std::any_cast() without a pointer as argument (not available in macOS 10.9) 2022-12-27 15:53:41 -03:00
Martín Capello
8568390306 Add a map of custom properties to be used by extensions (#3631) 2022-12-27 14:24:48 -03:00
David Capello
25a4e67aaa [lua] Add remaptileset event for sprites 2022-12-27 14:11:05 -03:00
David Capello
d683aaf437 [lua] Rename MouseCursor.HIDDEN -> MouseCursor.NONE 2022-12-26 18:31:37 -03:00
David Capello
8447a097c6 [lua] Add Image.id and Image.version getters 2022-12-26 17:20:27 -03:00
David Capello
a6a7519178 [lua] Add possibility to modify the mouseCursor of a canvas 2022-12-26 15:33:14 -03:00
David Capello
ae6f9c22ba Add support to save multiple files with -save-as {title} etc.
Fixes #2442, fixes #3629, and https://community.aseprite.org/t/16491
2022-12-23 12:09:05 -03:00
David Capello
5309991d0d Remove CliOpenFile argument from CliDelegate::loadPalette()
It wasn't used.
2022-12-23 12:07:04 -03:00
anGie44
4dc579c386 Update save-as option to use format elements (#2442) 2022-12-23 11:30:49 -03:00
David Capello
822a309724 Several fixes/rewording for --tagnames-format CLI and GUI 2022-12-23 09:59:01 -03:00
David Capello
658a583c7b Assign default/restore tagname format in Export Sprite Sheet UI 2022-12-23 09:53:04 -03:00
Nathan Pannell
bc9e201255 Added cli option --tagname-format 2022-12-23 09:11:58 -03:00
David Capello
8eacee4c98 [lua] Dialog:canvas() will capture the mouse on mousedown/up by default 2022-12-21 19:09:34 -03:00
David Capello
cdab75beed [lua] Add GraphicsContext:drawImage(image, srcRect, dstRect) 2022-12-21 19:08:46 -03:00
David Capello
f23adb0b1a [lua] Add GraphicsContext:clip()/rect()/roundedRect() functions 2022-12-21 19:07:43 -03:00
David Capello
909ebd6dcb [lua] New Rectangle(point, size) constructor 2022-12-21 13:01:03 -03:00
David Capello
4d880bd5b7 [lua] Add Rectangle.origin and Rectangle.size properties 2022-12-20 18:04:51 -03:00
David Capello
39109793a9 [lua] Add GraphicsContext:drawImage(img, x, y, w, h, dx, dy, dw, dh) 2022-12-19 16:39:59 -03:00
David Capello
914e14377c [lua] Add Image.bounds and Image:shrinkBounds() 2022-12-19 12:27:30 -03:00
David Capello
810aefaeab Add TODO note to improve shrink_bounds_templ() performance 2022-12-19 12:26:41 -03:00
Gaspar Capello
6d6dfb96a9 Add user data to tiles (fix #3626)
Co-authored-by: David Capello <david@igara.com>
2022-12-17 14:13:49 -03:00
David Capello
ea17eae524 Fix several bugs copying name/userData when we clone tilesets
Found on #3630

Co-authored-by: Gaspar Capello <gaspar@igara.com>
2022-12-17 13:42:51 -03:00
David Capello
3d9021d717 [lua] Add app.theme.dimension/color.id to access theme values 2022-12-16 10:55:11 -03:00
David Capello
a98f81288d [lua] Add GraphicsContext:drawThemeImage/Rect() functions
Maybe not the best API, but the simplest, in the future we could cache
the part using its ID with something like: app.theme.parts.part_id
2022-12-15 19:41:13 -03:00
David Capello
d4cefb8ba6 Fix crash double clicking a Dialog:canvas()
There were missing some setRecipient() when some messages are
converted to other kind of message (e.g. DoubleClick -> MouseDown)
2022-12-15 19:29:28 -03:00
David Capello
789e857d98 [lua] Add path functions to GraphicsContext object 2022-12-15 16:22:22 -03:00
David Capello
8b390d56fd [lua] Fix mouse position to client coordinates on mouse events 2022-12-15 16:21:24 -03:00
David Capello
b42a8b7ecf [lua] Add fillText() and measureText() functions to GraphicsContext 2022-12-15 10:01:13 -03:00
David Capello
0aaa9fdddf [lua] Add onmousemove/down/up events to canvas widget
At the moment very basic properties were added to the received event:
x, y, and button.
2022-12-14 22:13:49 -03:00
David Capello
25682a44d8 [lua] Add Dialog:repaint() function 2022-12-14 21:17:51 -03:00
David Capello
2cb526a19b [lua] Add new GraphicsContext type for Canvas onpaint event
We include a simple initial API for the GraphicsContext (like
stroking/filling rectangles and images).
2022-12-14 18:59:44 -03:00
David Capello
6e13e59aff [lua] Add initial version Dialog:canvas() (aseprite/api#87)
Right now it just creates a plain widget, but now we can specify
hexpand/vexpand arguments too so we can create a canvas with a fixed
size or with dynamic size (e.g. to use the whole dialog client area).

The onpaint event is not functional yet.
2022-12-14 17:33:29 -03:00
David Capello
c25649d865 [osx] Fix shortcuts for Edit actions when a native file dialog is displayed
Fixes #2719, related to #3615
2022-12-09 13:55:44 -03:00
David Capello
3a8596d02b [osx] Add QuickLook plugin to generate thumbnails and previews (#834, #3615) 2022-12-08 12:05:17 -03:00
David Capello
01967be53c Don't put the color indicator in normal map outside the wheel (fix #3595) 2022-11-17 17:50:17 -03:00
David Capello
d8c1b19c80 Update all editors after pasting cels/frames/layers in timeline (fix #2215, #3434) 2022-11-17 11:56:01 -03:00
Martín Capello
04e095bbd5 Fix clamp limit to avoid assertion in debug mode on visual studio on windows 2022-11-16 12:14:21 -03:00
David Capello
8cda612be5 Update shader for color wheel for normal map to match #3114 behavior 2022-11-16 11:50:15 -03:00
David Capello
b2973f71d7 Remove unneeded code for ColorWheel 2022-11-16 11:03:19 -03:00
Gaspar Capello
6ccf3f2385 Simplify if-elseif-else statements to calculate discrete steps in normal map 2022-11-15 16:00:01 -03:00
Christophe SAUVEUR
f240545020 Fixed color picking in normal map mode 2022-11-15 14:13:08 -03:00
Christophe SAUVEUR
0c490dff96 Fixed normal color wheel generation 2022-11-15 14:12:03 -03:00
David Capello
8149e4fa45 Fix timeline conf popup is not closed when we switch between docs 2022-11-09 09:03:21 -03:00
David Capello
551aae36c4 Destroy overlay in ~DraggableWidget destructor
There is an issue where we can drag a recent item and load a file
(using Alt+F or Ctrl+O) while dragging the recent item. With this
commit the overlay is destroyed after the file is open (without this
the overlay is kept floating).

Probably related to #3504 but we're not sure.
2022-11-08 21:14:12 -03:00
David Capello
4643aa6a1b Fix possible crash calling View::getView() with a nullptr widget (#3504) 2022-11-08 21:13:26 -03:00
David Capello
0eb9e17caf Fix clang error on macOS
note: 'operator<<' should be declared prior to the call site or in namespace 'doc'
2022-11-08 19:54:24 -03:00
David Capello
7f8df8a08d Fix compare_docs() to compare cels correctly + added more comparisons 2022-11-08 19:26:27 -03:00
David Capello
bd674dcb31 Add user data to tilesets (only logic side + scripting properties)
There is no UI yet to set Tileset user data (color and text).
2022-11-08 19:23:56 -03:00
David Capello
4dfa3ca0eb Add doc::rgba_seta/graya_seta() functions 2022-11-04 11:28:47 -03:00
David Capello
1f71286960 Minor change in convert_pixel_format() using "auto" keyword 2022-11-03 19:43:31 -03:00
David Capello
66496bdcd2 Replace unique_ptr w/std::optional for optional values in doc::Brush 2022-11-03 08:26:10 -03:00
David Capello
d029efbcc0 Merge branch 'saved-undo-state' (#3578) 2022-11-03 07:53:04 -03:00
David Capello
683954b8fd Enable DeselectMask and MaskAll commands when ENABLE_UI=off 2022-11-02 10:26:51 -03:00
David Capello
38c0400927 Fix Doc::isModified() when we are in a similar UndoState to the saved one
If the current UndoState doesn't modify the "saved state" (e.g. there
is a sequence of undoes/redoes that doesn't modify the saved version
of the sprite compared to the current one), we can indicate that we
are in the saved state anyway (!Doc::isModified).
2022-11-02 09:58:18 -03:00
David Capello
e703de535e Show saved undo state in Edit > Undo History window (fix #3578)
Some extra changes introduced:
* DocUndo & CmdTransaction were simplified: removing the saved
  counter, and storing a specific UndoState pointing to the state that
  matches the version in the disk
* DocUndo::onDeleteUndoState() can generate a
  impossibleToBackToSavedState() if the saved state is deleted. This
  might fix some bugs where a "save changes" dialog weren't displayed
  after undoing and making changes (probably related to #3542, but not
  sure)

Some extra work is needed to avoid showing the "save changes" dialog
if we are close to the saved state and only non-modification undo
states separate us from there. E.g. if we open a file, select the
canvas, and close it, Aseprite now shows the "save changes" dialog,
this wasn't true in previous versions.
2022-11-02 09:57:52 -03:00
David Capello
ebdf535ec8 Remove unused member function Timeline::celBoxSize() 2022-10-31 13:11:57 -03:00
Gaspar Capello
e1caf39887 Fix Marquee Tool becomes invisible in the grayscale mode (fix #3274)
Before this fix, during the action of selecting an area (with any selection tool), the preview of the selection edge in grayscale Color Mode was not displayed (fix #3274).
2022-10-27 15:39:16 -03:00
David Capello
49e4e10311 Fix bug where Layer > Open Group didn't update the Timeline rows 2022-10-24 17:17:06 -03:00
David Capello
69d3ada204 Avoid setting invalid frame on Editor in certain cases
Playback is still buggy, and we need to fix some test cases, but this
is useful to fix a crash/assert fail if we try to set as active frame
something outside the valid range.
2022-10-24 16:19:25 -03:00
David Capello
b21831561a [lua] Add Tag.repeats field 2022-10-24 14:03:05 -03:00
David Capello
3691b9a16c Merge branch 'repeat-tag' 2022-10-24 11:05:24 -03:00
David Capello
fafaf85b29 Simplify onion skinning ignoring subtags 2022-10-20 16:00:03 -03:00
David Capello
6c2d2f6f79 Fix crash if we remove a tag when we're playing the animation 2022-10-20 14:51:42 -03:00
David Capello
9601c02812 Add option to play/preview with subtags & repetitions 2022-10-20 14:41:24 -03:00
David Capello
e78e1e9a54 Remove current_editor, replace with Editor::activeEditor()
Finally removed src/app/modules/editors.h file.
2022-10-20 12:31:22 -03:00
David Capello
4f96d37b1f Add repeat field to animation tags (#1275, #1740) 2022-10-19 12:25:06 -03:00
David Capello
17a5b3f3fc Replace base::mutex with std::mutex
* Removed base::mutex & base::scoped_lock
* We can use std::lock_guard with deduced template args (as we're
  using C++17 now)
2022-10-18 16:20:34 -03:00
David Capello
616f74ae2d Minor changes when accessing "properties_grid" widget 2022-10-13 09:40:54 -03:00
Joshua Ogunyinka
ed26fdd806 Add missing language strings in other uncategorized sections 2022-10-12 14:57:23 -03:00
Joshua Ogunyinka
6c55847151 Add more missing language strings for filtering/editing 2022-10-12 14:54:50 -03:00
Joshua Ogunyinka
aaa69a3d81 Add more missing language strings when importing/exporting sprite sheets 2022-10-12 14:40:01 -03:00
Joshua Ogunyinka
a4bc897f76 Add missing language strings for preview editor/new brush/inks/mask by color 2022-10-12 14:36:31 -03:00
Joshua Ogunyinka
3cdb187487 Add more missing language strings for colorbar's wheel properties 2022-10-12 14:24:20 -03:00
Joshua Ogunyinka
a6aa84981f Add more missing language strings when changing sprite's pixel format 2022-10-12 14:23:40 -03:00
Joshua Ogunyinka
05c4326ada Add missing language strings for all components using the status bar 2022-10-12 14:23:30 -03:00
Joshua Ogunyinka
bf88fa2bd1 Add missing language strings when loading/saving components 2022-10-12 14:21:21 -03:00
Joshua Ogunyinka
05ece3fad1 Add missing language strings in sprite size command 2022-10-12 13:49:24 -03:00
Joshua Ogunyinka
9105642dbf Add missing language strings for layer/frame/anidir comboboxes 2022-10-12 13:46:29 -03:00
Joshua Ogunyinka
dd2efe28d2 Add missing language strings for dithering selector 2022-10-12 13:41:19 -03:00
Joshua Ogunyinka
974c13dd33 Add missing language strings in sprite properties & import sprite sheet 2022-10-12 13:38:22 -03:00
Joshua Ogunyinka
6bc0d312d2 Add missing language strings in the layer properties 2022-10-12 13:24:09 -03:00
Joshua Ogunyinka
ab56186d79 Update commands strings when language change 2022-10-12 13:22:26 -03:00
Joshua Ogunyinka
bbfae36d8f Add missing language strings for preference window 2022-10-12 13:20:41 -03:00
Joshua Ogunyinka
de44545930 Add missing language strings for keyboard shortcuts
Co-authored-by: David Capello <david@igara.com>
2022-10-12 13:20:35 -03:00
Joshua Ogunyinka
797f8db2fa Add missing language strings for the file selector 2022-10-12 13:20:23 -03:00
Joshua Ogunyinka
60b5df4030 Add missing language strings for the color bar 2022-10-12 13:19:32 -03:00
Joshua Ogunyinka
3c815ac1bd Add missing language strings for the timeline/context bar 2022-10-12 13:19:20 -03:00
David Capello
a5ac9ada27 Merge branch 'main' into beta 2022-10-11 18:50:09 -03:00
David Capello
c253bfbedd Simplify FilenameInfo initialization 2022-10-06 11:49:05 -03:00
Gaspar Capello
16362cc511 Fix {duration} file format always gives an incorrect number (fix #2998)
Before this fix, the string '{duration}' in the file format gave an incorrect/random and constant number across all frames. This happened in Save-AS, Export File, CLI, Json on Export Sprite Sheet.
2022-10-06 11:28:16 -03:00
Jeremy Behreandt
1133f4cc0f Floor Mod in Shift Image Mask
Changed shift image with mask routine to use floor modulo (or Euclidean remainder). Switched from two nested for loops to one for loop.

In response to bug report at https://community.aseprite.org/t/app-command-movemask-error-when-wrapping-with-a-value-higher-than-sprite-width/10437 .
2022-09-30 11:11:02 -03:00
David Capello
ba3452b059 Merge branch 'main' into beta 2022-09-29 17:23:11 -03:00
David Capello
6b21fec417 [lua] Add "ev" args to "change" sprite event, to ask for "ev.fromUndo"
In this way we can know if the event was generated from a
undo/redo/undo history change and not from the direct user
manipulation of the sprite.

Useful for scripts like in #3539
2022-09-29 12:10:09 -03:00
David Capello
5c4024c44f Replicate same changes from c0dfb832d8 for redo (#3539) 2022-09-29 11:04:05 -03:00
David Capello
c0dfb832d8 Fix crash if a script modifies the sprite when we're undoing/redoing (fix #3539)
To do this the script must be listening the sprite changes (which are
generated on undo/redo commands too).
2022-09-29 10:57:40 -03:00
Gaspar Capello
022c0c38df Fix dynamics + gradient + no dithering + fg or bg is mask color results in an opaque stroke.
Before this fix, dynamic + gradient (pressure or velocity) + no dithering + fg or bg = mask color results in an opaque stroke.
2022-09-28 18:50:01 -03:00
Martín Capello
4ff4274deb Refactor some conditional expressions to fix a compiler warning 2022-09-28 17:08:11 -03:00
David Capello
88594bfa0e Merge branch 'main' into beta 2022-09-28 16:20:03 -03:00
David Capello
00be9afcea Avoid warning about use of uninitialized variable 2022-09-28 15:56:26 -03:00
David Capello
008df4d03a Add ui::Paint = os::Paint = SkPaint
So now we can have access to Skia SkPaint instance directly from
Aseprite UI code (and set the shader, and other properties that are
not yet well-wrapped in laf-os).

We've simplified ui::CheckeredDrawMode with
ui::set_checkered_paint_mode() function, as now the checkered
background shader is stored in ui::Paint (SkPaint) instead of
ui::Graphics state.
2022-09-28 15:49:30 -03:00
David Capello
9c09a55487 Avoid warning in Release mode in View::updateView() 2022-09-26 19:49:26 -03:00
Gaspar Capello
59fff4ba9c Fix bmp file and bitmap size are incorrectly set during save command (fix #3534)
Before this fix, file and image sizes were calculated incorrectly. This caused problems for some viewers/browsers/engines to load BMPs created in Aseprite.
2022-09-23 18:07:23 -03:00
David Capello
896c02c67f Fix several bugs converting layers (copy user data, blend mode and opacity) 2022-09-23 12:30:22 -03:00
Martín Capello
d53f2f75a5 Fix Advanced Mode disables Tilemap tool (fix #3478) 2022-09-22 15:47:06 -03:00
Gaspar Capello
877ae9eeec Fix uninstalling (or updating) an extensions that has subdirectories results in an error (fix #3385)
Prior to this fix, any additional external files or directories within the Extension's directory tree, break the subdirectory removal iteration, resulting in empty subdirectories and a console error.
2022-09-22 11:30:48 -03:00
Martín Capello
fecfbb1145 Fix icon's Y position when the item is in the last row of a ButtonSet with more than one row (fix #2676) 2022-09-20 17:51:54 -03:00
Martín Capello
6e57546aa9 Fix text Y position when the item is in the last row of a ButtonSet.
The last row of items are a bit taller to make room for the button border, so this compensates that.
2022-09-20 17:51:52 -03:00
Martín Capello
8d5f281998 Fix index mode spray not handling masked color as expected (fix #3063) 2022-09-20 14:35:21 -03:00