Commit Graph

102 Commits

Author SHA1 Message Date
Benjamin Popp
bf7dc005d1 4-bit sprites should always show 16 color sprites 2021-07-28 07:41:46 -05:00
Benjamin Popp
af44d7ec90 handle edge case of having no palette run when one is expected 2021-07-27 21:29:09 -05:00
Benjamin Popp
479e8f9b92 Bring palette from SpriteTool if the sprite has no matched palette 2021-07-27 07:31:06 -05:00
Benjamin Popp
ef9e6d8842 Add boilerplate to connect view to diff commands in the viewport 2021-06-05 21:53:42 -05:00
Benjamin Popp
49b1850f2c Improve 8-bit tilemap support
* Don't show the tile palette selector for 8-bit tilemaps
* Do allow bucket fill from color 0
* Do allow 8-bit image import to include more than 16 colors in a tile
2021-04-10 21:28:51 -05:00
Benjamin Popp
425db5778d Add basic diff functionality
The current implementation of Diff just compares the file with the original version of it, and then highlights the bytes that have been changed since last save. Nothing fancy, but it should allow us to test the current thumb routines.
2021-03-21 20:21:21 -05:00
Benjamin Popp
de58416004 Fix failing tests 2021-02-26 15:42:44 -06:00
Benjamin Popp
813add28d3 Finish adding support for uncompressed tilemaps 2021-02-26 14:02:58 -06:00
Benjamin Popp
ad8d2b4d6b Change the way initialization works / add pokemon icons to trainer team streams.
Initialization happens on a background thread. We want to be able to run commands when initialization is complete. The way this was done before wasn't very thread safe. The new version will always run the command.
* If initialization is complete, it runs the command right away.
* If initialization is not complete, it defers execution until initialization is done.
* Initialization is measured in scopes. An inner scope will not run initialization work when it's done, since there's still more initialization work that needs to be completed.
* Things like "goto" will now defer execution until initialization is complete. For most users, this won't matter. For speed users, it means that goto will now work the way they expect.

Streams now have the ability to express a "visualization" of the stream, which is a list of PixelViewModels. The table tool will display those in the background of the textbox, over to the right.
2021-02-26 09:14:19 -06:00
Benjamin Popp
65b017476b Initial refactor to add uncompressed tilemap format
New tilemap format doesn't actually work yet. But nothing broke as we added the new class.
2021-02-23 09:54:12 -06:00
Benjamin Popp
4efbcb2e18 Bugfix: don't allow selection to start out of bounds 2021-02-21 22:33:22 -06:00
Benjamin Popp
0e075a34b7 Allow dragging in a PNG to the image editor to paste it in. 2021-02-20 21:04:34 -06:00
Benjamin Popp
b8a9686d57 Fix bugs in 2-palette sprites
When sprite has multiple palettes that it can render with, the image editor didn't quite work right.
2021-02-19 22:48:38 -06:00
Benjamin Popp
36bf79e91b Add ability for to import content to the current tab.
Planned uses:
* Import an ips/ups into a ViewPort
* Import a .hma paste script into a ViewPort
* Import an image into the image editor
2021-02-18 21:25:47 -06:00
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