Commit Graph

88 Commits

Author SHA1 Message Date
Benjamin Popp
ba9af90bf0 Fix sprite scale during very tall block selections 2021-02-12 21:33:53 -06:00
Benjamin Popp
9d308dd8f2 Eyedropper click-drag should select based on the current block size 2021-02-12 21:29:49 -06:00
Benjamin Popp
7a6b386b2e Image Paste now pastes based on cursor position
Instead of just blindly pasting into the middle of the canvas, paste now cares about where the cursor is.
2021-01-27 15:01:32 -06:00
Benjamin Popp
ff45fd64c8 Bugfix
* Don't crash when backspace on an anchor
* Don't crash when using eyedropper tool on tileset
2021-01-18 23:15:05 -06:00
Benjamin Popp
604b84fcd5 Add ability for Ctrl+Drag to copy a selection 2021-01-16 21:33:02 -06:00
Benjamin Popp
5dd018710b Allow the user to grab single-width lines 2021-01-16 20:51:30 -06:00
Benjamin Popp
6d3e227fc1 Bugfixes
* If we serialize a bit array (for example, for tooltips in the goto menu) with an unknown source, don't crash: just show it as hex.
* Transparently save metadata after a version update.
* Don't crash if a eye-dropper selection starts out of range.
2021-01-16 20:30:29 -06:00
Benjamin Popp
ea6fe69468 Add Tooltip content for image editor
Image Editor tabs had a header tooltip that described the image loaded in them, but it only worked if the image came from a named table. Now images that are directly anchors will also have tooltips, and if the image has no anchor the original address will be used.
2021-01-01 22:53:38 -06:00
Benjamin Popp
1d4115f6f5 Bugfixes
* Show store/load as multiplied by 4
* Prevent min-more-than-max errors with selection dragging
2020-12-30 14:34:04 -06:00
Benjamin Popp
749a932260 Performance Improvements
* When checking a dictionary for a case-insensitive key, go ahead and check with matching case first, since that's a much faster check.
* Don't spam-query the palette during the swap-step while dragging pixels around with the selection tool.
2020-12-25 21:46:05 -06:00
Benjamin Popp
5cfb15065b Fix crash
Get a color from the default palette, then get a color from a palette with a page
2020-12-22 13:58:40 -06:00
Benjamin Popp
c08d2e7abe Add palettes to textboxes
Also fix a bug so that tilesets can use the fill tool correctly.
2020-12-21 09:26:16 -06:00
Benjamin Popp
21b83dbb68 Implement write for 1-byte tilemaps
There is a second format for compressed tilemaps, where each tile gets only 1 byte instead of 2. This allows for a reduced number of tiles and no h/v flipping, but can save space.

This change implements the ability to import tilemaps with that format, as well as allowing the image editor to work with tilemaps of that format.
2020-12-20 21:24:56 -06:00
Benjamin Popp
80f4fe961d Add support for reading Emerald townmap
Emerald's townmap's tilemap uses only one byte per tile instead of the usual 2 bytes per tile. HMA can now read this format, but I can't write it yet. That'll be the next change hopefully.
2020-12-18 23:08:03 -06:00
Benjamin Popp
3d073e06ec Include palettes from other elements in same table
If a sprite is being edited and the same sprite is used elsewhere in the same table, allow update using the palettes of the other elements as well. Example: potion, super potion, and hyper potion all share the same sprite.

If a palette is reordered, reorder other palettes used by the same sprite as well. This matters because all the palettes need to be updated or the edited sprite will look wrong.
2020-12-13 22:52:49 -06:00
Benjamin Popp
7a5d944cc0 fix crash when filling with 2-bit image 2020-12-10 22:46:42 -06:00
Benjamin Popp
226cbe937d Tilemap image editor improvements
Don't allow editing default palette
Keep palette collection palette page in sync as the page changes
Keep palette collection has-multiple-pages in sync with image editor
Fix bugs in Fill for non-0 pages
2020-12-09 10:15:17 -06:00
Benjamin Popp
0352116514 Better handling of palettes that don't include page 0 2020-12-07 22:32:07 -06:00
Benjamin Popp
fa9343d019 Don't crash when dragging selections into areas with unknown palettes 2020-12-06 20:34:16 -06:00
Benjamin Popp
0d1d4d6b0e Make image editor have access to palette 0 for tilemaps
Some tilemaps have a page-offset that means that they don't use palette 0 for colors. But they may still use palette 0 for transparency. Allow tilemaps to always set a tile to palette 0.
2020-12-03 22:39:29 -06:00
Benjamin Popp
05ad65cd63 Update tilemap tileset link when tilemap repoints 2020-11-30 21:43:18 -06:00
Benjamin Popp
0a30da0b30 Fix assert
If the user tries to fill with a color from a different palette, fail.
2020-11-30 21:24:10 -06:00
Benjamin Popp
1804cd990b Don't crash if trying to show selection outside the selectedPixels size 2020-11-29 19:59:43 -06:00
Benjamin Popp
e0e0ec23c8 Add "Export Backup" button 2020-11-28 22:53:09 -06:00
Benjamin Popp
c3d3d76e71 Add Undo/Redo buttons
They were already available via shortcuts and in the menu, but it makes sense to put them here too.
2020-11-28 13:39:02 -06:00
Benjamin Popp
27cb272a1c Fix clipping / zooming
Also, allow right-click to work correctly for 2-bit images
2020-11-27 13:21:47 -06:00
Benjamin Popp
4404f0a65b Change default sprite scale
I notice that I always zoom in basically as soon as I start using the image editor. With this change, that will still be true, but less so: the default size won't be silly.
2020-11-26 23:19:22 -06:00
Benjamin Popp
4a47d3ecad Show footprints in the EditOptions 2020-11-26 23:11:28 -06:00
Benjamin Popp
20cd8988be Support editing for 1-bit images 2020-11-26 22:29:32 -06:00
Benjamin Popp
8b5c460d6f Tileset editing
Allow editing tilesets. This matters because some tiles in tilesets are used dynamically, such as the change-map button in the townmap. This isn't part of the initial image, but instead some tiles are swapped out dynamically.
2020-11-25 22:29:50 -06:00
Benjamin Popp
08e748bab2 Implement Delete Selection 2020-11-25 14:22:43 -06:00
Benjamin Popp
807d276d34 Implement flipping
Also make dragging / copy / paste work correctly for 16-bit images (like intro-oak)
2020-11-25 12:12:19 -06:00
Benjamin Popp
cf60efb5cd Allow image editor to edit shiny palettes 2020-11-24 22:16:42 -06:00
Benjamin Popp
92751d5812 Add support for selection movement in tilemaps
When moving blocks around within a tilemap, there's no easy way to guarantee that the user is moving in tile increments, and multilpe tiles may employ different palettes.

As such, conisder that moving a block around moves the *index* of the palette being used, not the color. This will mostly work as expected, but can cause colors to change as they enter or exit regions that use different palettes.
2020-11-24 22:13:36 -06:00
Benjamin Popp
7387a45374 Implement eyedropper behavior for tilemaps
* Only allow eyedropper to do 1x1, 2x2, 4x4, or 8x8 regions.
* If eyedropper does a region smaller than 8x8, only allow it to work on tiles that use that palette.
* If eyedropper does a region 8x8 (or 8x8 tile is selected), allow it to work on tiles that use any palette.
2020-11-23 20:13:33 -06:00
Benjamin Popp
cbf52e4eb5 Implement more tilemap editing support
* can edit palettes for tiles
* can draw in valid tiles only (can't draw if the tile has a different palette)
* can bucket in valid tiles only
* eyedropper switches to the correct palette
2020-11-15 22:32:04 -06:00
Benjamin Popp
a1591219eb Draft support for tilemap palette editing
Doesn't actually work yet, but this includes the core tests, logic, and UI.
2020-11-14 21:21:33 -06:00
Benjamin Popp
28603e4ae7 Fix bug in fill algorithm
Fill needs to use the palette-index-plus-palette-page value to set the parent.pixels, but needs to use just palette-index when picking the color to fill the parent.PixelData.
2020-11-10 22:09:39 -06:00
Benjamin Popp
2bf3792b2f Implement multi-page sprite import
Import now works for wide/tall images, where all the pages of an image are stored in the same image.
2020-11-07 22:29:39 -06:00
Benjamin Popp
3476e4d98f Usability improvements
Update mini-sprite when palette changes
Update tooltips in palette tool
Update icon colors in image editor
2020-11-04 21:52:21 -06:00
Benjamin Popp
e417496c20 Fix some image editor bugs
Also add some tables / scripts found by Fred / Phoenix
2020-11-04 21:05:49 -06:00
Benjamin Popp
90253ac3ea Add color mixer
* Fix a few crashes
* Provide a tooltip for the image editor tab header (the name of the first element in the dropdown)
* Add a color mixer into the image editor, which is a free palette that you can use for whatever you want. It's not tied to the game data, it isn't saved anywhere when you exit, but you can play with the colors freely and it's shared between all image editors for the life of the app.
* If you open the mixer in one tab, it'll be open in other tabs.
* Press delete to clear a color
2020-10-30 23:26:13 -05:00
Benjamin Popp
77a5383471 Add support for editing multiple images in the image editor 2020-10-23 22:32:37 -05:00
Benjamin Popp
f5f79385d0 Fix right-click during fill tool 2020-10-22 21:18:16 -05:00
Benjamin Popp
296598c9df Allow disjoint selection
This changes the way we handle selection. Thing can no longer only care about the selection start/end: they have to check each element to see if it's selected.
2020-10-17 22:49:59 -05:00
Benjamin Popp
b7889abcd2 Allow for copying blocks using grab tool
You can now select larger regions to copy at will, whether with the draw or the grab tool.
2020-10-17 21:59:19 -05:00
Benjamin Popp
83c458cb0f Allow non-square selections from eyedropper 2020-10-17 00:24:13 -05:00
Benjamin Popp
a48ed064fc Make palette control more aware of repoints
This requires that the palette control recognize a pointer to the current palette, instead of just the address of the current palette. But since palettes can't be used by the game without a pointer, it's reasonable that there will always be a pointer for any palette being edited.
* Update table tool / sprite tool / image editor palette addresses when palettes get repointed.
2020-10-15 22:21:43 -05:00
Benjamin Popp
b0b7a769d9 Updates from usability testing
Fix zoom limits
Fix selection move limits
Fix issue with 0 draw size when hovering with draw tool
Add tooltip for lz compression start token
Import from default TOML files on version upgrade.
Goto -> potion -> should work
File -> Save -> should work from image editor
Don't double-include the current table as a "related table" when searching for palette tables for a sprite.
2020-10-13 20:51:16 -05:00
Benjamin Popp
958f8d5432 Make buttons for horizontal / vertical flip 2020-10-10 20:24:05 -05:00