Fix metatile status not updating while pasting/swapping in Tileset Editor

This commit is contained in:
GriffinR
2025-08-08 15:06:37 -04:00
parent edabed0105
commit 3ae1e404f8
4 changed files with 15 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
- Fix Undo/Redo ignoring the automatic resizing that occurs if a layout/border was an unexpected size.
- Fix Undo/Redo in the Tileset and Palette Editors and Paste in the Tileset Editor appearing enabled even when they don't do anything.
- Fix `Ctrl+Shift+Z` not being set as a default shortcut for Redo in the Palette Editor like it is for other windows.
- Fix the Tileset Editor's status bar not updating while selecting tiles in the metatile layer view.
- Fix the Tileset Editor's status bar not updating while selecting tiles in the metatile layer view, or when pasting metatiles.
- Fix the main window's status bar not immediately reflecting changes made while painting metatiles / movement permissions.
- Fix cleared metatile labels not updating until the project is reloaded.
- Fix some changes in the Tileset Editor being discarded if the window is closed too quickly.

View File

@@ -75,7 +75,6 @@ public slots:
private slots:
void onWindowActivated();
void onHoveredMetatileChanged(uint16_t);
void onHoveredMetatileCleared();
void onHoveredTileCleared();
void onMetatileLayerSelectionChanged(const QPoint&, const QSize&);
@@ -160,6 +159,8 @@ private:
void updateLayerTileStatus();
void showTileStatus(const Tile &tile);
void showTileStatus(uint16_t tileId);
void updateMetatileStatus();
void showMetatileStatus(uint16_t metatileId);
Ui::TilesetEditor *ui;
History<MetatileHistoryItem*> metatileHistory;

View File

@@ -26,6 +26,9 @@ public:
void removeFromSwapSelection(uint16_t metatileId);
void clearSwapSelection();
bool hasCursor() const { return this->prevCellPos != QPoint(-1,-1); }
uint16_t metatileIdUnderCursor() const { return this->lastHoveredMetatileId; }
QVector<uint16_t> usedMetatiles;
bool selectorShowUnused = false;
bool selectorShowCounts = false;

View File

@@ -213,7 +213,7 @@ void TilesetEditor::setRawAttributesVisible(bool visible) {
void TilesetEditor::initMetatileSelector()
{
this->metatileSelector = new TilesetEditorMetatileSelector(projectConfig.metatileSelectorWidth, this->primaryTileset, this->secondaryTileset, this->layout);
connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileChanged, this, &TilesetEditor::onHoveredMetatileChanged);
connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileChanged, this, &TilesetEditor::showMetatileStatus);
connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileCleared, this, &TilesetEditor::onHoveredMetatileCleared);
connect(this->metatileSelector, &TilesetEditorMetatileSelector::selectedMetatileChanged, this, &TilesetEditor::onSelectedMetatileChanged);
connect(this->metatileSelector, &TilesetEditorMetatileSelector::swapRequested, this, &TilesetEditor::commitMetatileSwap);
@@ -473,7 +473,13 @@ void TilesetEditor::drawSelectedTiles() {
this->ui->graphicsView_selectedTile->setSceneRect(0, 0, size.width(), size.height());
}
void TilesetEditor::onHoveredMetatileChanged(uint16_t metatileId) {
void TilesetEditor::updateMetatileStatus() {
if (this->metatileSelector->hasCursor()) {
showMetatileStatus(this->metatileSelector->metatileIdUnderCursor());
}
}
void TilesetEditor::showMetatileStatus(uint16_t metatileId) {
QString label = Tileset::getMetatileLabel(metatileId, this->primaryTileset, this->secondaryTileset);
QString message = QString("Metatile: %1").arg(Metatile::getMetatileIdString(metatileId));
if (label.size() != 0) {
@@ -959,6 +965,7 @@ bool TilesetEditor::replaceMetatile(uint16_t metatileId, const Metatile &src, QS
*this->metatile = src;
this->metatileSelector->select(metatileId);
this->metatileSelector->drawMetatile(metatileId);
updateMetatileStatus();
this->metatileLayersItem->draw();
updateLayerTileStatus();
return true;