mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 17:05:43 -05:00
Add edit-undo history to tileset metatile editing
This commit is contained in:
@@ -13,14 +13,18 @@ public:
|
||||
this->metatile = metatile;
|
||||
this->primaryTileset = primaryTileset;
|
||||
this->secondaryTileset = secondaryTileset;
|
||||
this->clearLastModifiedCoords();
|
||||
}
|
||||
void draw();
|
||||
void setTilesets(Tileset*, Tileset*);
|
||||
void setMetatile(Metatile*);
|
||||
void clearLastModifiedCoords();
|
||||
private:
|
||||
Metatile* metatile;
|
||||
Tileset *primaryTileset;
|
||||
Tileset *secondaryTileset;
|
||||
QPoint prevChangedTile;
|
||||
void getBoundedCoords(QPointF, int*, int*);
|
||||
signals:
|
||||
void tileChanged(int, int);
|
||||
void selectedTilesChanged(QPoint, int, int);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "project.h"
|
||||
#include "history.h"
|
||||
#include "paletteeditor.h"
|
||||
#include "tileseteditormetatileselector.h"
|
||||
#include "tileseteditortileselector.h"
|
||||
@@ -12,6 +13,22 @@ namespace Ui {
|
||||
class TilesetEditor;
|
||||
}
|
||||
|
||||
class MetatileHistoryItem {
|
||||
public:
|
||||
MetatileHistoryItem(uint16_t metatileId, Metatile *prevMetatile, Metatile *newMetatile) {
|
||||
this->metatileId = metatileId;
|
||||
this->prevMetatile = prevMetatile;
|
||||
this->newMetatile = newMetatile;
|
||||
}
|
||||
~MetatileHistoryItem() {
|
||||
delete this->prevMetatile;
|
||||
delete this->newMetatile;
|
||||
}
|
||||
uint16_t metatileId;
|
||||
Metatile *prevMetatile;
|
||||
Metatile *newMetatile;
|
||||
};
|
||||
|
||||
class TilesetEditor : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -41,10 +58,6 @@ private slots:
|
||||
|
||||
void on_checkBox_yFlip_stateChanged(int arg1);
|
||||
|
||||
void on_comboBox_metatileBehaviors_currentIndexChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_layerType_currentIndexChanged(int index);
|
||||
|
||||
void on_actionSave_Tileset_triggered();
|
||||
|
||||
void on_actionImport_Primary_Tiles_triggered();
|
||||
@@ -55,6 +68,14 @@ private slots:
|
||||
|
||||
void on_actionChange_Palettes_triggered();
|
||||
|
||||
void on_actionUndo_triggered();
|
||||
|
||||
void on_actionRedo_triggered();
|
||||
|
||||
void on_comboBox_metatileBehaviors_activated(const QString &arg1);
|
||||
|
||||
void on_comboBox_layerType_activated(int arg1);
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent*);
|
||||
void initMetatileSelector();
|
||||
@@ -65,6 +86,7 @@ private:
|
||||
void importTilesetTiles(Tileset*, bool);
|
||||
void refresh();
|
||||
Ui::TilesetEditor *ui;
|
||||
History<MetatileHistoryItem*> metatileHistory;
|
||||
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
||||
TilesetEditorTileSelector *tileSelector = nullptr;
|
||||
MetatileLayersItem *metatileLayersItem = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user