Commit Graph

7059 Commits

Author SHA1 Message Date
David Capello
4c583c2619 Fix new bounds of tilemap after Edit > Clear or Edit > Cut 2020-02-17 09:06:01 -03:00
David Capello
26139c4ae2 Add tilemap layers (#977)
This is the first commit with a simple tilemap editor. Still buggy but
functional in several ways. Several changes were made:

* NewLayer command can receive a tilemap=true to create a new tilemap
  layer
* New ToggleTilesMode command added to switch between the palette and
  the tileset in the ColorBar (the ColorBar was expanded to show
  colors or tilesets with a generic AbstractPaletteViewAdapter)
* All commands to create new layers were moved to Layer >
  New... submenu
* There are a new tileset chunk to save tilesets in .aseprite files,
  and a new kind of cels to save tilemaps
* Added doc::LayerTilemap, doc::Tileset, etc. and several other types
  to handle tilesets/tilemaps in the doc layer.
* Added doc::Grid class with grid specifications that indicates how a
  tilemap <-> tileset must be drawn
* Added and expanded cel operations to work with tilemaps and
  conversions between regular LayerImage cels <-> LayerTilemap cels
  (e.g. copy cels in the timeline between layer types)
2020-02-17 09:06:00 -03:00
David Capello
9fe05a5dd5 Fix crash double-clicking a moving selection (fix regression in 7b07f29f0b)
Here we avoid two ExpandCelCanvas at the same time with
MovingPixelsState + DrawingState. Double-clicking inside the selection
when we are moving it (MovingPixelsState) could start a new
DrawingState which creates a new ToolLoopImpl that needs a new
ExpandCelCanvas. So we have to drop the pixels before.
2020-02-17 08:28:30 -03:00
David Capello
7b07f29f0b Add possibility to select multiple tiles with double-click + dragging mouse (fix #1988)
Fixes: https://community.aseprite.org/t/1929
Related to #939
2020-02-16 12:42:29 -03:00
David Capello
6b7a593858 Minor formatting change in SelectTileCommand 2020-02-14 14:32:28 -03:00
David Capello
a1317eaede Show some extra debug info if Object::setId() assert fails 2020-02-12 23:07:00 -03:00
David Capello
294401b18a Select the correct tile when we double-click on negative coordinates of the grid 2020-02-11 12:43:29 -03:00
Gaspar Capello
f8cca1eba4 Removed unnecessary lines in remap.cpp 2020-02-11 09:24:24 -03:00
David Capello
47a568ee86 Resize selection correctly on "Sprite Size" even when the Bilinear method is used 2020-02-07 15:11:03 -03:00
David Capello
59fa7d956b DocExporter: Don't share the original size between samples
If we use two sprites with different canvas sizes, and both sprites
have a similar cel, they can share the inTextureBounds, but not the
original size (which is the original sprite canvas size of each cel).
This can be reproduced using the CLI and creating a texture
atlas (-sheet) with two or more sprites.
2020-02-06 15:07:40 -03:00
David Capello
a7f1f4bd64 DocExporter: render samples with trimmed size
This fix an issue merging similar cels from different sprites with
different canvas sizes.
2020-02-06 14:23:33 -03:00
David Capello
00cdda7b85 Minor change in DocExporter 2020-02-06 12:01:29 -03:00
David Capello
1c39d907cb Fix bug genering "spriteSourceSize" for similar cels but with different positions in the canvas
This can happen when we use -trim (Trim Cels) + -merge-duplicates
options together. The trimmed bounds are unique to each sample, and
only the position in the texture (inTextureBounds) can be shared.

Fixes: https://igarastudio.zendesk.com/agent/tickets/407
2020-02-06 11:59:29 -03:00
David Capello
df74444347 Now ContextWriter will always wait 1/2 second to unlock the backup thread 2020-02-05 17:50:17 -03:00
David Capello
d316781e8a Remove usage of ContextWriter from all Command::onEnabled() impls 2020-02-05 17:39:56 -03:00
David Capello
7306a685f8 Fix random bug showing disabled menu items right-clicking the timeline
When the backup thread is running, the upgradeToWrite() needed some
extra time to lock the document to check if we can write or not in the
sprite. Now we just check the ability to write the sprite with the new
RWLock::canWriteLockFromRead() function.
2020-02-05 17:03:48 -03:00
David Capello
28969d968c Finally removing a problematic assert from ~UIContext() 2020-02-05 12:23:11 -03:00
David Capello
66864beb77 lua: Fix crash calling app.refresh() from a script using -b -script from CLI 2020-02-05 12:18:12 -03:00
David Capello
7507c2e4eb Minor change in BrushLockAlphaInkProcessing<IndexedTraits>::processPixel()
We can use m_transparentColor directly (as in other inks) and ask for
the transparent color before pre-processing the pixel if it's not
needed.
2020-02-04 12:51:02 -03:00
David Capello
1bb126fade Fix pasting text on empty cel when the timeline range is enabled
Bug report: https://community.aseprite.org/t/4489
2020-01-30 19:47:23 -03:00
David Capello
d5f0e3189c Fix bug drawing and zooming with the mouse wheel or pinch gesture
The mouse position jumps from one side to other when we zoom because
there were an intermediate scroll change event where the mouse
position is converted using the old zoom.

Fixed regressiong from 951fb7c357
Fixed bug https://community.aseprite.org/t/4587
2020-01-13 15:01:45 -03:00
David Capello
cd598e5539 lua: Add Image:saveAs{ filename, palette } function 2020-01-13 12:27:32 -03:00
David Capello
df63fb9388 Update copyright year on Windows properties and About dialog 2020-01-08 17:44:59 -03:00
David Capello
70a211d978 Fix Palette:setColor() and Color Range command when alpha != 255
Use the app::Color alpha property to create the color for an
image (app::color_utils::color_for_image()) in several cases.

Fixed https://community.aseprite.org/t/4548
2020-01-08 17:40:43 -03:00
David Capello
e68cc7dbf9 Fix crash exporting sprite sheets into .gif or .jpg files (formats with onAskUserForFormatOptions()) 2020-01-03 10:48:52 -03:00
David Capello
8efb11915f Fix usage of freed memory after check_flood_line() returns true when 8-connectivity is used 2020-01-02 18:39:23 -03:00
David Capello
c1d5f8eb0a Move AnimatedWidget from app to ui 2019-12-23 11:14:23 -03:00
David Capello
78353199bb Remove UI_FOREACH_WIDGET_*() macros 2019-12-20 15:24:41 -03:00
David Capello
34ec123ecc Remove MIN/MAX/MID macros from ui library 2019-12-20 15:08:34 -03:00
David Capello
87c754a11c Fix Alt+arrow keys to move selection borders on selection-like tools 2019-12-18 18:00:11 -03:00
David Capello
9d818e0304 lua: Update scripting API number to 9 2019-12-17 15:07:59 -03:00
David Capello
c9b330ab65 lua: Added Dialog:shades{} widget
Also ColorShades is a little more generic now (doesn't depends so much
on the ColorBar).
2019-12-16 21:17:12 -03:00
David Capello
2b1903ee02 lua: Add Dialog{ title, onclose } constructor 2019-12-13 10:23:22 -03:00
David Capello
484de6bd3a lua: Fix memory leak of dialogs with callbacks pointing to itself
Now we store the callbacks in a table that depends of the lifetime of
the dialog (instead of the global registry), so when the dialog is not
used anymore/closed, the whole "island" of objects (dialog +
callbacks) is GC'd.
2019-12-12 09:13:21 -03:00
David Capello
45fc74f596 lua: Fix crash on program exit if some metatable.__gc calls print() 2019-12-11 23:46:33 -03:00
David Capello
ff2af4f3e8 lua: Add app.fs object with some functions/properties for file names 2019-12-11 15:39:40 -03:00
David Capello
8139b8a1d4 Move Preferences instance to app::Context
With this change we fix some tests when !ENABLE_UI and we start using
less Preferences::instance() (maybe in the future we could exclusively
access the preferences from the new Context::preferences() function).
2019-12-11 12:27:56 -03:00
David Capello
e553777d24 Fix warnings of unused varisables when !ENABLE_UI 2019-12-11 12:22:01 -03:00
David Capello
fa013f4b63 Preferences can be used in non-UI contexts
Fixed bug running app_preferences.lua from tests repository.
2019-12-10 19:10:47 -03:00
David Capello
b7f41b811a Add Screenshot command 2019-12-05 12:05:18 -03:00
David Capello
70ff67e890 Clear save_copy preference values of saved copies (related to #1964) 2019-12-03 17:38:28 -03:00
David Capello
b190cc985e Save the whole group of grid/bg/pixel grid settings when these elements are displayed in the Editor
https://community.aseprite.org/t/3303/10
2019-12-03 17:37:54 -03:00
David Capello
d8b933c3f1 Load GIF files w/pixels outside the canvas bounds anyway (fix #2211) 2019-12-03 09:33:30 -03:00
David Capello
6cab7b208c Fix using default preferences on new documents (fix #2198)
Fixed regression introduced in 002abc9245.
Bug reports:
* https://github.com/aseprite/aseprite/issues/2198
* https://steamcommunity.com/app/431730/discussions/2/1657817111845334892/
* https://community.aseprite.org/t/grid-size-for-new-documents-not-applied/4305

Added new ASEPRITE_USER_FOLDER environment variable to test
preferences from a clean folder.
2019-12-02 19:13:27 -03:00
David Capello
f53ecab282 lua: Add support for app.preferences.document(nil) to get default preferences for new documents 2019-12-02 18:51:43 -03:00
David Capello
1584cc59ac Update fmt library to v6.1.0 2019-12-02 15:27:28 -03:00
David Capello
f500929ab4 win: Include user fonts directory from AppData 2019-11-29 17:42:33 -03:00
David Capello
ea0e51e82d Export Sprite Sheet: Fixed exporting selected layers when Split Layers is not checked
Bug reported here: https://community.aseprite.org/t/4248/6
2019-11-29 11:50:33 -03:00
David Capello
48c4e49d67 Fix Layer.stackIndex setter when we use a stackIndex greater than the current one 2019-11-29 11:08:18 -03:00
David Capello
116420f978 Put the button to delete backup sessions far away from the button to recover sessions 2019-11-29 11:07:17 -03:00