Skip to content

Commit

Permalink
Render metatile/collision views by tab
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Dec 21, 2024
1 parent 64a9e2c commit ad0b8d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions include/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ private slots:
bool userSetMap(QString);
void redrawMapScene();
void refreshMapScene();
void refreshMetatileViews();
void refreshCollisionSelector();
void setLayoutOnlyMode(bool layoutOnly);

bool checkProjectSanity();
Expand Down
13 changes: 9 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit ad0b8d6

Please sign in to comment.