diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d82ff0..57898b0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/include/ui/tileseteditor.h b/include/ui/tileseteditor.h index 50ab1ce1..fc974d10 100644 --- a/include/ui/tileseteditor.h +++ b/include/ui/tileseteditor.h @@ -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 metatileHistory; diff --git a/include/ui/tileseteditormetatileselector.h b/include/ui/tileseteditormetatileselector.h index a982d219..3b38d9b2 100644 --- a/include/ui/tileseteditormetatileselector.h +++ b/include/ui/tileseteditormetatileselector.h @@ -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 usedMetatiles; bool selectorShowUnused = false; bool selectorShowCounts = false; diff --git a/src/ui/tileseteditor.cpp b/src/ui/tileseteditor.cpp index e38ef2a3..38a41bf2 100644 --- a/src/ui/tileseteditor.cpp +++ b/src/ui/tileseteditor.cpp @@ -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;