mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
add options to count metatiles to tileset editor
- count the total number of usages across all maps of specific metatiles - display the count and/or display unused metatiles - this does not account for metatiles used in code (most of these are labeled)
This commit is contained in:
@@ -35,6 +35,11 @@ public:
|
||||
Blockdata blocks;
|
||||
QSize dimensions;
|
||||
} lastCommitMapBlocks; // to track map changes
|
||||
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
int getBorderWidth();
|
||||
int getBorderHeight();
|
||||
};
|
||||
|
||||
#endif // MAPLAYOUT_H
|
||||
|
||||
@@ -95,7 +95,8 @@ public:
|
||||
QMap<QString, QStringList> tilesetLabels;
|
||||
|
||||
Blockdata readBlockdata(QString);
|
||||
bool loadBlockdata(Map*);
|
||||
bool loadBlockdata(MapLayout*);
|
||||
bool loadLayoutBorder(MapLayout*);
|
||||
|
||||
void saveTextFile(QString path, QString text);
|
||||
void appendTextFile(QString path, QString text);
|
||||
@@ -122,8 +123,9 @@ public:
|
||||
QMap<QString, bool> getTopLevelMapFields();
|
||||
bool loadMapData(Map*);
|
||||
bool readMapLayouts();
|
||||
bool loadLayout(MapLayout *);
|
||||
bool loadMapLayout(Map*);
|
||||
bool loadMapTilesets(Map*);
|
||||
bool loadLayoutTilesets(MapLayout*);
|
||||
void loadTilesetAssets(Tileset*);
|
||||
void loadTilesetTiles(Tileset*, QImage);
|
||||
void loadTilesetMetatiles(Tileset*);
|
||||
@@ -182,8 +184,6 @@ public:
|
||||
QStringList getEventScriptsFilePaths() const;
|
||||
QCompleter *getEventScriptLabelCompleter(QStringList additionalScriptLabels);
|
||||
|
||||
bool loadMapBorder(Map *map);
|
||||
|
||||
void saveMapHealEvents(Map *map);
|
||||
|
||||
static int getNumTilesPrimary();
|
||||
|
||||
@@ -75,6 +75,9 @@ private slots:
|
||||
|
||||
void on_actionChange_Palettes_triggered();
|
||||
|
||||
void on_actionShow_Unused_toggled(bool checked);
|
||||
void on_actionShow_Counts_toggled(bool checked);
|
||||
|
||||
void on_actionUndo_triggered();
|
||||
|
||||
void on_actionRedo_triggered();
|
||||
@@ -119,6 +122,7 @@ private:
|
||||
void refresh();
|
||||
void saveMetatileLabel();
|
||||
void closeEvent(QCloseEvent*);
|
||||
void countMetatileUsage();
|
||||
|
||||
Ui::TilesetEditor *ui;
|
||||
History<MetatileHistoryItem*> metatileHistory;
|
||||
|
||||
@@ -8,21 +8,20 @@
|
||||
class TilesetEditorMetatileSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TilesetEditorMetatileSelector(Tileset *primaryTileset, Tileset *secondaryTileset, Map *map): SelectablePixmapItem(32, 32, 1, 1) {
|
||||
this->primaryTileset = primaryTileset;
|
||||
this->secondaryTileset = secondaryTileset;
|
||||
this->numMetatilesWide = 8;
|
||||
this->map = map;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
TilesetEditorMetatileSelector(Tileset *primaryTileset, Tileset *secondaryTileset, Map *map);
|
||||
Map *map = nullptr;
|
||||
void draw();
|
||||
bool select(uint16_t metatileId);
|
||||
void setTilesets(Tileset*, Tileset*);
|
||||
void setTilesets(Tileset*, Tileset*, bool draw = true);
|
||||
uint16_t getSelectedMetatile();
|
||||
void updateSelectedMetatile();
|
||||
QPoint getMetatileIdCoordsOnWidget(uint16_t metatileId);
|
||||
|
||||
//
|
||||
QVector<uint16_t> usedMetatiles;
|
||||
bool selectorShowUnused = false;
|
||||
bool selectorShowCounts = false;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
@@ -39,6 +38,10 @@ private:
|
||||
QPoint getMetatileIdCoords(uint16_t);
|
||||
bool shouldAcceptEvent(QGraphicsSceneMouseEvent*);
|
||||
|
||||
void drawFilters();
|
||||
void drawUnused();
|
||||
void drawCounts();
|
||||
|
||||
signals:
|
||||
void hoveredMetatileChanged(uint16_t);
|
||||
void hoveredMetatileCleared();
|
||||
|
||||
Reference in New Issue
Block a user