Fix tileset editor desyncing with API changes

This commit is contained in:
GriffinR
2024-01-02 00:54:54 -05:00
parent ecfc521a87
commit 6682233079
3 changed files with 25 additions and 3 deletions

View File

@@ -585,9 +585,15 @@ void MainWindow::saveMetatileAttributesByMetatileId(int metatileId) {
if (this->editor->project && tileset)
this->editor->project->saveTilesetMetatileAttributes(tileset);
// If the Tileset Editor is currently displaying the updated metatile, refresh it
if (this->tilesetEditor && this->tilesetEditor->getSelectedMetatileId() == metatileId)
this->tilesetEditor->onSelectedMetatileChanged(metatileId);
// If the tileset editor is open it needs to be refreshed with the new changes.
// Rather than do a full refresh (which is costly) we tell the editor it will need
// to reload the metatile from the project next time it's displayed.
// If it's currently being displayed, trigger this reload immediately.
if (this->tilesetEditor) {
this->tilesetEditor->queueMetatileReload(metatileId);
if (this->tilesetEditor->getSelectedMetatileId() == metatileId)
this->tilesetEditor->onSelectedMetatileChanged(metatileId);
}
}
Metatile * MainWindow::getMetatile(int metatileId) {