Render metatile/collision views by tab

This commit is contained in:
GriffinR 2024-12-21 17:19:31 -05:00
parent 64a9e2cacb
commit ad0b8d6794
3 changed files with 12 additions and 4 deletions

View file

@ -49,6 +49,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Fix a visual issue when quickly dragging map connections around.
- Fix map connections rendering incorrectly if their direction name was unknown.
- Fix map connections rendering incorrectly if their dimensions were smaller than the border draw distance.
- Fix metatile/collision selection images skewing off-center after opening a map from the Connections tab.
- Fix the map list filter retaining text between project open/close.
- Fix the map list mishandling value gaps when sorting by Area.
- Fix a freeze on startup if project values are defined with mismatched parentheses.

View file

@ -351,6 +351,8 @@ private:
bool userSetMap(QString);
void redrawMapScene();
void refreshMapScene();
void refreshMetatileViews();
void refreshCollisionSelector();
void setLayoutOnlyMode(bool layoutOnly);
bool checkProjectSanity();

View file

@ -948,8 +948,6 @@ void MainWindow::redrawMapScene() {
}
void MainWindow::refreshMapScene() {
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
ui->graphicsView_Map->setScene(editor->scene);
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Map->editor = editor;
@ -971,7 +969,14 @@ void MainWindow::refreshMapScene() {
//ui->graphicsView_Collision->setSceneRect(editor->scene_collision_metatiles->sceneRect());
ui->graphicsView_Collision->setFixedSize(editor->movement_permissions_selector_item->pixmap().width() + 2, editor->movement_permissions_selector_item->pixmap().height() + 2);
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
}
void MainWindow::refreshMetatileViews() {
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
}
void MainWindow::refreshCollisionSelector() {
on_horizontalSlider_CollisionZoom_valueChanged(ui->horizontalSlider_CollisionZoom->value());
}
@ -2126,8 +2131,10 @@ void MainWindow::on_mapViewTab_tabBarClicked(int index)
if (index == MapViewTab::Metatiles) {
editor->setEditingMetatiles();
refreshMetatileViews();
} else if (index == MapViewTab::Collision) {
editor->setEditingCollision();
refreshCollisionSelector();
} else if (index == MapViewTab::Prefabs) {
editor->setEditingMetatiles();
if (projectConfig.prefabFilepath.isEmpty() && !projectConfig.prefabImportPrompted) {
@ -2939,7 +2946,6 @@ void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &ti
if (editor->project->primaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
editor->updatePrimaryTileset(tilesetLabel);
redrawMapScene();
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
updateTilesetEditor();
prefab.updatePrefabUi(editor->layout);
markMapEdited();
@ -2951,7 +2957,6 @@ void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString &
if (editor->project->secondaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
editor->updateSecondaryTileset(tilesetLabel);
redrawMapScene();
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
updateTilesetEditor();
prefab.updatePrefabUi(editor->layout);
markMapEdited();