Commit Graph

113 Commits

Author SHA1 Message Date
Haven1433
fc3f8775bf Allow copy/paste to work with default palettes 2022-01-24 21:25:07 -06:00
Haven1433
dfb4ff4696 Add tile-palette-eyedropper mode 2022-01-08 20:53:12 -06:00
haven1433
c2c2670db3 Tile Palette Paint
When using the tile palette tool, you can now choose between pencil mode and bucket mode.
2021-12-25 11:11:06 -06:00
Haven1433
02bfb3e35a Use the correct palette for 1-bit and 2-bit sprites (footprints and fonts) 2021-12-16 20:04:23 -06:00
Benjamin Popp
c38e053f2c Show different save icon for metadata-only changes
Users need a way to distinguish between when a save is needed for actual data changes to their rom, vs when a save is needed because they've made changes to their metadata but not their rom.
2021-10-12 16:47:55 -05:00
Benjamin Popp
a8f8b27061 Improve sprite/palette bad compressed data behavior
When working with data that can be decoded but the end of the compressed data doesn't terminate correctly, we can still view the sprite/palette, but can't easily edit them, since the format is invalid.

When opening the image editor (or editing a palette in either the image editor or table tool), repoint invalid data as a new run and make it valid. This does a few things:
* Only the current pointer will be updated. Any other pointers to the bad data will remain the same, and the bad data will be left alone. If this is the only pointer to the bad data, it will _still_ be left alone, with only the new copy being used by the pointer. This ensures maximum compatibility, even if there's things going on that HMA doesn't know about.
* When coming from the sprite tool, nothing will be repointed upon opening the image editor, since that edit happens from the address and not from a pointer. When editing the image at this point, any required moves will update all known pointers at the same time.
* When any compressed data gets rewritten and moved, the user gets notified.
2021-10-07 15:47:29 -05:00
Benjamin Popp
bbe2f3e54f Validate that the model actually has a sprite run where expected when refreshing the image editor
If no sprite is found, then the user must've changed some stuff since the last time this tab was opened. It no longer seems valid: close the tab.
2021-08-26 19:54:43 -05:00
Benjamin Popp
409cc51c31 Undo/Redo should update correctly from Image Editor Palette change
Changing a color in the image editor's palette should enable undo
2021-08-26 16:13:02 -05:00
Benjamin Popp
ee272cc412 Edge case: make sure tile-only edits to tilemaps don't edit tilesets 2021-08-25 21:29:08 -05:00
Benjamin Popp
ac87d07a4a fix bad palette error
If the palette is expected to be page 0 but the tilemap actually uses some other page, the sprite editor would crash when editing because of the mismatch. Make it more robust.
2021-08-18 20:05:47 -05:00
Benjamin Popp
5de71b167e Allow user to duplicate the current tab
This is useful if you want to view multiple locations in the same rom at the same time. This was previously possible by following a pointer into a new tab, but often the thing you want to see isn't available from an onscreen pointer, so it makes more sense to open up a new goto.
2021-08-01 00:38:49 -05:00
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