Add option to turn off checkerboard fill for new tilesets
This commit is contained in:
parent
3a4ce68232
commit
9d82a7af68
8 changed files with 55 additions and 12 deletions
|
@ -9,6 +9,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
## [Unreleased]
|
||||
### Added
|
||||
- Add `setScale` to the scripting API.
|
||||
- Add option to turn off the checkerboard fill for new tilesets.
|
||||
|
||||
## [5.0.0] - 2022-10-30
|
||||
### Breaking Changes
|
||||
|
|
|
@ -33,6 +33,7 @@ your project root as ``porymap.user.cfg``. You should add this file to your giti
|
|||
``show_player_view``, 0, global, yes, Display a rectangle for the GBA screen radius
|
||||
``show_cursor_tile``, 0, global, yes, Display a rectangle around the hovered metatile(s)
|
||||
``monitor_files``, 1, global, yes, Whether porymap will monitor changes to project files
|
||||
``tileset_checkerboard_fill``, 1, global, yes, Whether new tilesets will be filled with a checkerboard pattern of metatiles.
|
||||
``theme``, default, global, yes, The color theme for porymap windows and widgets
|
||||
``text_editor_goto_line``, , global, yes, The command that will be executed when clicking the button next the ``Script`` combo-box.
|
||||
``text_editor_open_directory``, , global, yes, The command that will be executed when clicking ``Open Project in Text Editor``.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>190</height>
|
||||
<height>216</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -25,7 +25,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>190</height>
|
||||
<height>216</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -50,7 +50,7 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -74,7 +74,7 @@
|
|||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>135</height>
|
||||
<height>161</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
|
@ -89,7 +89,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<height>129</height>
|
||||
<height>155</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
|
@ -174,11 +174,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="fillLabel">
|
||||
<property name="text">
|
||||
<string>Checkerboard Fill</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="fillCheckBox">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
this->showBorder = true;
|
||||
this->showGrid = false;
|
||||
this->monitorFiles = true;
|
||||
this->tilesetCheckerboardFill = true;
|
||||
this->theme = "default";
|
||||
this->textEditorOpenFolder = "";
|
||||
this->textEditorGotoLine = "";
|
||||
|
@ -75,6 +76,7 @@ public:
|
|||
void setShowBorder(bool enabled);
|
||||
void setShowGrid(bool enabled);
|
||||
void setMonitorFiles(bool monitor);
|
||||
void setTilesetCheckerboardFill(bool checkerboard);
|
||||
void setTheme(QString theme);
|
||||
void setTextEditorOpenFolder(const QString &command);
|
||||
void setTextEditorGotoLine(const QString &command);
|
||||
|
@ -93,6 +95,7 @@ public:
|
|||
bool getShowBorder();
|
||||
bool getShowGrid();
|
||||
bool getMonitorFiles();
|
||||
bool getTilesetCheckerboardFill();
|
||||
QString getTheme();
|
||||
QString getTextEditorOpenFolder();
|
||||
QString getTextEditorGotoLine();
|
||||
|
@ -127,6 +130,7 @@ private:
|
|||
bool showBorder;
|
||||
bool showGrid;
|
||||
bool monitorFiles;
|
||||
bool tilesetCheckerboardFill;
|
||||
QString theme;
|
||||
QString textEditorOpenFolder;
|
||||
QString textEditorGotoLine;
|
||||
|
|
|
@ -19,10 +19,12 @@ public:
|
|||
QString fullSymbolName;
|
||||
QString friendlyName;
|
||||
bool isSecondary;
|
||||
bool checkerboardFill;
|
||||
|
||||
private slots:
|
||||
void NameOrSecondaryChanged();
|
||||
void SecondaryChanged();
|
||||
void FillChanged();
|
||||
|
||||
private:
|
||||
Ui::NewTilesetDialog *ui;
|
||||
|
|
|
@ -228,6 +228,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
|||
this->showGrid = getConfigBool(key, value);
|
||||
} else if (key == "monitor_files") {
|
||||
this->monitorFiles = getConfigBool(key, value);
|
||||
} else if (key == "tileset_checkerboard_fill") {
|
||||
this->tilesetCheckerboardFill = getConfigBool(key, value);
|
||||
} else if (key == "theme") {
|
||||
this->theme = value;
|
||||
} else if (key == "text_editor_open_directory") {
|
||||
|
@ -262,6 +264,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
|||
map.insert("show_border", this->showBorder ? "1" : "0");
|
||||
map.insert("show_grid", this->showGrid ? "1" : "0");
|
||||
map.insert("monitor_files", this->monitorFiles ? "1" : "0");
|
||||
map.insert("tileset_checkerboard_fill", this->tilesetCheckerboardFill ? "1" : "0");
|
||||
map.insert("theme", this->theme);
|
||||
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
|
||||
map.insert("text_editor_goto_line", this->textEditorGotoLine);
|
||||
|
@ -311,6 +314,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
|
|||
this->save();
|
||||
}
|
||||
|
||||
void PorymapConfig::setTilesetCheckerboardFill(bool checkerboard) {
|
||||
this->tilesetCheckerboardFill = checkerboard;
|
||||
this->save();
|
||||
}
|
||||
|
||||
void PorymapConfig::setMainGeometry(QByteArray mainWindowGeometry_, QByteArray mainWindowState_,
|
||||
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
||||
this->mainWindowGeometry = mainWindowGeometry_;
|
||||
|
@ -464,6 +472,10 @@ bool PorymapConfig::getMonitorFiles() {
|
|||
return this->monitorFiles;
|
||||
}
|
||||
|
||||
bool PorymapConfig::getTilesetCheckerboardFill() {
|
||||
return this->tilesetCheckerboardFill;
|
||||
}
|
||||
|
||||
QString PorymapConfig::getTheme() {
|
||||
return this->theme;
|
||||
}
|
||||
|
|
|
@ -1277,12 +1277,14 @@ void MainWindow::on_actionNew_Tileset_triggered() {
|
|||
for(int i = 0; i < numMetaTiles; ++i) {
|
||||
Metatile *mt = new Metatile();
|
||||
for(int j = 0; j < tilesPerMetatile; ++j){
|
||||
Tile tile(0, false, false, 0);
|
||||
//Create a checkerboard-style dummy tileset
|
||||
if(((i / 8) % 2) == 0)
|
||||
tile.tileId = ((i % 2) == 0) ? 1 : 2;
|
||||
else
|
||||
tile.tileId = ((i % 2) == 1) ? 1 : 2;
|
||||
Tile tile = Tile();
|
||||
if (createTilesetDialog->checkerboardFill) {
|
||||
// Create a checkerboard-style dummy tileset
|
||||
if (((i / 8) % 2) == 0)
|
||||
tile.tileId = ((i % 2) == 0) ? 1 : 2;
|
||||
else
|
||||
tile.tileId = ((i % 2) == 1) ? 1 : 2;
|
||||
}
|
||||
mt->tiles.append(tile);
|
||||
}
|
||||
newSet.metatiles.append(mt);
|
||||
|
|
|
@ -15,8 +15,13 @@ NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) :
|
|||
QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression);
|
||||
this->ui->nameLineEdit->setValidator(validator);
|
||||
|
||||
bool checkerboard = porymapConfig.getTilesetCheckerboardFill();
|
||||
this->ui->fillCheckBox->setChecked(checkerboard);
|
||||
this->checkerboardFill = checkerboard;
|
||||
|
||||
connect(this->ui->nameLineEdit, &QLineEdit::textChanged, this, &NewTilesetDialog::NameOrSecondaryChanged);
|
||||
connect(this->ui->typeComboBox, &QComboBox::currentTextChanged, this, &NewTilesetDialog::SecondaryChanged);
|
||||
connect(this->ui->fillCheckBox, &QCheckBox::stateChanged, this, &NewTilesetDialog::FillChanged);
|
||||
//connect(this->ui->toolButton, &QToolButton::clicked, this, &NewTilesetDialog::ChangeFilePath);
|
||||
this->SecondaryChanged();
|
||||
}
|
||||
|
@ -38,3 +43,8 @@ void NewTilesetDialog::NameOrSecondaryChanged() {
|
|||
this->path = Tileset::getExpectedDir(this->fullSymbolName, this->isSecondary);
|
||||
this->ui->pathLineEdit->setText(this->path);
|
||||
}
|
||||
|
||||
void NewTilesetDialog::FillChanged() {
|
||||
this->checkerboardFill = this->ui->fillCheckBox->isChecked();
|
||||
porymapConfig.setTilesetCheckerboardFill(this->checkerboardFill);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue