Eliminate unnecessary expensive map redraws when saving or changing tilesets
This commit is contained in:
parent
f6c86e0eed
commit
81cd43933b
4 changed files with 11 additions and 12 deletions
|
@ -194,7 +194,6 @@ signals:
|
||||||
void objectsChanged();
|
void objectsChanged();
|
||||||
void selectedObjectsChanged();
|
void selectedObjectsChanged();
|
||||||
void loadMapRequested(QString, QString);
|
void loadMapRequested(QString, QString);
|
||||||
void tilesetChanged(QString);
|
|
||||||
void wildMonDataChanged();
|
void wildMonDataChanged();
|
||||||
void warpEventDoubleClicked(QString mapName, QString warpNum);
|
void warpEventDoubleClicked(QString mapName, QString warpNum);
|
||||||
void currentMetatilesSelectionChanged();
|
void currentMetatilesSelectionChanged();
|
||||||
|
|
|
@ -183,7 +183,6 @@ private slots:
|
||||||
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
||||||
void onAddNewMapToAreaClick(QAction* triggeredAction);
|
void onAddNewMapToAreaClick(QAction* triggeredAction);
|
||||||
void onAddNewMapToLayoutClick(QAction* triggeredAction);
|
void onAddNewMapToLayoutClick(QAction* triggeredAction);
|
||||||
void onTilesetChanged(QString);
|
|
||||||
void currentMetatilesSelectionChanged();
|
void currentMetatilesSelectionChanged();
|
||||||
|
|
||||||
void on_action_Export_Map_Image_triggered();
|
void on_action_Export_Map_Image_triggered();
|
||||||
|
|
|
@ -1718,7 +1718,6 @@ void Editor::updatePrimaryTileset(QString tilesetLabel, bool forceLoad)
|
||||||
{
|
{
|
||||||
map->layout->tileset_primary_label = tilesetLabel;
|
map->layout->tileset_primary_label = tilesetLabel;
|
||||||
map->layout->tileset_primary = project->getTileset(tilesetLabel, forceLoad);
|
map->layout->tileset_primary = project->getTileset(tilesetLabel, forceLoad);
|
||||||
emit tilesetChanged(map->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1728,7 +1727,6 @@ void Editor::updateSecondaryTileset(QString tilesetLabel, bool forceLoad)
|
||||||
{
|
{
|
||||||
map->layout->tileset_secondary_label = tilesetLabel;
|
map->layout->tileset_secondary_label = tilesetLabel;
|
||||||
map->layout->tileset_secondary = project->getTileset(tilesetLabel, forceLoad);
|
map->layout->tileset_secondary = project->getTileset(tilesetLabel, forceLoad);
|
||||||
emit tilesetChanged(map->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ void MainWindow::initEditor() {
|
||||||
connect(this->editor, SIGNAL(objectsChanged()), this, SLOT(updateObjects()));
|
connect(this->editor, SIGNAL(objectsChanged()), this, SLOT(updateObjects()));
|
||||||
connect(this->editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
|
connect(this->editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
|
||||||
connect(this->editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
|
connect(this->editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
|
||||||
connect(this->editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
|
|
||||||
connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
||||||
connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
|
connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
|
||||||
connect(this->editor, SIGNAL(wildMonDataChanged()), this, SLOT(onWildMonDataChanged()));
|
connect(this->editor, SIGNAL(wildMonDataChanged()), this, SLOT(onWildMonDataChanged()));
|
||||||
|
@ -564,13 +563,19 @@ void MainWindow::displayMapProperties() {
|
||||||
ui->frame_3->setEnabled(false);
|
ui->frame_3->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->frame_3->setEnabled(true);
|
ui->frame_3->setEnabled(true);
|
||||||
Map *map = editor->map;
|
Map *map = editor->map;
|
||||||
|
|
||||||
ui->comboBox_Song->setCurrentText(map->song);
|
ui->comboBox_PrimaryTileset->blockSignals(true);
|
||||||
ui->comboBox_Location->setCurrentText(map->location);
|
ui->comboBox_SecondaryTileset->blockSignals(true);
|
||||||
ui->comboBox_PrimaryTileset->setCurrentText(map->layout->tileset_primary_label);
|
ui->comboBox_PrimaryTileset->setCurrentText(map->layout->tileset_primary_label);
|
||||||
ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label);
|
ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label);
|
||||||
|
ui->comboBox_PrimaryTileset->blockSignals(false);
|
||||||
|
ui->comboBox_SecondaryTileset->blockSignals(false);
|
||||||
|
|
||||||
|
ui->comboBox_Song->setCurrentText(map->song);
|
||||||
|
ui->comboBox_Location->setCurrentText(map->location);
|
||||||
ui->checkBox_Visibility->setChecked(map->requiresFlash.toInt() > 0 || map->requiresFlash == "TRUE");
|
ui->checkBox_Visibility->setChecked(map->requiresFlash.toInt() > 0 || map->requiresFlash == "TRUE");
|
||||||
ui->comboBox_Weather->setCurrentText(map->weather);
|
ui->comboBox_Weather->setCurrentText(map->weather);
|
||||||
ui->comboBox_Type->setCurrentText(map->type);
|
ui->comboBox_Type->setCurrentText(map->type);
|
||||||
|
@ -1117,11 +1122,6 @@ void MainWindow::on_actionNew_Tileset_triggered() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onTilesetChanged(QString mapName)
|
|
||||||
{
|
|
||||||
setMap(mapName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateTilesetEditor() {
|
void MainWindow::updateTilesetEditor() {
|
||||||
if (this->tilesetEditor) {
|
if (this->tilesetEditor) {
|
||||||
this->tilesetEditor->setTilesets(editor->ui->comboBox_PrimaryTileset->currentText(), editor->ui->comboBox_SecondaryTileset->currentText());
|
this->tilesetEditor->setTilesets(editor->ui->comboBox_PrimaryTileset->currentText(), editor->ui->comboBox_SecondaryTileset->currentText());
|
||||||
|
@ -2217,6 +2217,7 @@ void MainWindow::onMapNeedsRedrawing() {
|
||||||
void MainWindow::onTilesetsSaved(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
void MainWindow::onTilesetsSaved(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
||||||
this->editor->updatePrimaryTileset(primaryTilesetLabel, true);
|
this->editor->updatePrimaryTileset(primaryTilesetLabel, true);
|
||||||
this->editor->updateSecondaryTileset(secondaryTilesetLabel, true);
|
this->editor->updateSecondaryTileset(secondaryTilesetLabel, true);
|
||||||
|
redrawMapScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onWildMonDataChanged() {
|
void MainWindow::onWildMonDataChanged() {
|
||||||
|
@ -2298,6 +2299,7 @@ void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &ti
|
||||||
{
|
{
|
||||||
if (editor->project->tilesetLabels["primary"].contains(tilesetLabel) && editor->map) {
|
if (editor->project->tilesetLabels["primary"].contains(tilesetLabel) && editor->map) {
|
||||||
editor->updatePrimaryTileset(tilesetLabel);
|
editor->updatePrimaryTileset(tilesetLabel);
|
||||||
|
redrawMapScene();
|
||||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2306,6 +2308,7 @@ void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString &
|
||||||
{
|
{
|
||||||
if (editor->project->tilesetLabels["secondary"].contains(tilesetLabel) && editor->map) {
|
if (editor->project->tilesetLabels["secondary"].contains(tilesetLabel) && editor->map) {
|
||||||
editor->updateSecondaryTileset(tilesetLabel);
|
editor->updateSecondaryTileset(tilesetLabel);
|
||||||
|
redrawMapScene();
|
||||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue