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]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Add `setScale` to the scripting API.
|
- Add `setScale` to the scripting API.
|
||||||
|
- Add option to turn off the checkerboard fill for new tilesets.
|
||||||
|
|
||||||
## [5.0.0] - 2022-10-30
|
## [5.0.0] - 2022-10-30
|
||||||
### Breaking Changes
|
### 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_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)
|
``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
|
``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
|
``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_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``.
|
``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>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>190</height>
|
<height>216</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>190</height>
|
<height>216</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>380</width>
|
<width>380</width>
|
||||||
<height>135</height>
|
<height>161</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>380</width>
|
<width>380</width>
|
||||||
<height>129</height>
|
<height>155</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
@ -174,11 +174,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
this->showBorder = true;
|
this->showBorder = true;
|
||||||
this->showGrid = false;
|
this->showGrid = false;
|
||||||
this->monitorFiles = true;
|
this->monitorFiles = true;
|
||||||
|
this->tilesetCheckerboardFill = true;
|
||||||
this->theme = "default";
|
this->theme = "default";
|
||||||
this->textEditorOpenFolder = "";
|
this->textEditorOpenFolder = "";
|
||||||
this->textEditorGotoLine = "";
|
this->textEditorGotoLine = "";
|
||||||
|
@ -75,6 +76,7 @@ public:
|
||||||
void setShowBorder(bool enabled);
|
void setShowBorder(bool enabled);
|
||||||
void setShowGrid(bool enabled);
|
void setShowGrid(bool enabled);
|
||||||
void setMonitorFiles(bool monitor);
|
void setMonitorFiles(bool monitor);
|
||||||
|
void setTilesetCheckerboardFill(bool checkerboard);
|
||||||
void setTheme(QString theme);
|
void setTheme(QString theme);
|
||||||
void setTextEditorOpenFolder(const QString &command);
|
void setTextEditorOpenFolder(const QString &command);
|
||||||
void setTextEditorGotoLine(const QString &command);
|
void setTextEditorGotoLine(const QString &command);
|
||||||
|
@ -93,6 +95,7 @@ public:
|
||||||
bool getShowBorder();
|
bool getShowBorder();
|
||||||
bool getShowGrid();
|
bool getShowGrid();
|
||||||
bool getMonitorFiles();
|
bool getMonitorFiles();
|
||||||
|
bool getTilesetCheckerboardFill();
|
||||||
QString getTheme();
|
QString getTheme();
|
||||||
QString getTextEditorOpenFolder();
|
QString getTextEditorOpenFolder();
|
||||||
QString getTextEditorGotoLine();
|
QString getTextEditorGotoLine();
|
||||||
|
@ -127,6 +130,7 @@ private:
|
||||||
bool showBorder;
|
bool showBorder;
|
||||||
bool showGrid;
|
bool showGrid;
|
||||||
bool monitorFiles;
|
bool monitorFiles;
|
||||||
|
bool tilesetCheckerboardFill;
|
||||||
QString theme;
|
QString theme;
|
||||||
QString textEditorOpenFolder;
|
QString textEditorOpenFolder;
|
||||||
QString textEditorGotoLine;
|
QString textEditorGotoLine;
|
||||||
|
|
|
@ -19,10 +19,12 @@ public:
|
||||||
QString fullSymbolName;
|
QString fullSymbolName;
|
||||||
QString friendlyName;
|
QString friendlyName;
|
||||||
bool isSecondary;
|
bool isSecondary;
|
||||||
|
bool checkerboardFill;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void NameOrSecondaryChanged();
|
void NameOrSecondaryChanged();
|
||||||
void SecondaryChanged();
|
void SecondaryChanged();
|
||||||
|
void FillChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NewTilesetDialog *ui;
|
Ui::NewTilesetDialog *ui;
|
||||||
|
|
|
@ -228,6 +228,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
this->showGrid = getConfigBool(key, value);
|
this->showGrid = getConfigBool(key, value);
|
||||||
} else if (key == "monitor_files") {
|
} else if (key == "monitor_files") {
|
||||||
this->monitorFiles = getConfigBool(key, value);
|
this->monitorFiles = getConfigBool(key, value);
|
||||||
|
} else if (key == "tileset_checkerboard_fill") {
|
||||||
|
this->tilesetCheckerboardFill = getConfigBool(key, value);
|
||||||
} else if (key == "theme") {
|
} else if (key == "theme") {
|
||||||
this->theme = value;
|
this->theme = value;
|
||||||
} else if (key == "text_editor_open_directory") {
|
} 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_border", this->showBorder ? "1" : "0");
|
||||||
map.insert("show_grid", this->showGrid ? "1" : "0");
|
map.insert("show_grid", this->showGrid ? "1" : "0");
|
||||||
map.insert("monitor_files", this->monitorFiles ? "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("theme", this->theme);
|
||||||
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
|
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
|
||||||
map.insert("text_editor_goto_line", this->textEditorGotoLine);
|
map.insert("text_editor_goto_line", this->textEditorGotoLine);
|
||||||
|
@ -311,6 +314,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setTilesetCheckerboardFill(bool checkerboard) {
|
||||||
|
this->tilesetCheckerboardFill = checkerboard;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
void PorymapConfig::setMainGeometry(QByteArray mainWindowGeometry_, QByteArray mainWindowState_,
|
void PorymapConfig::setMainGeometry(QByteArray mainWindowGeometry_, QByteArray mainWindowState_,
|
||||||
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
||||||
this->mainWindowGeometry = mainWindowGeometry_;
|
this->mainWindowGeometry = mainWindowGeometry_;
|
||||||
|
@ -464,6 +472,10 @@ bool PorymapConfig::getMonitorFiles() {
|
||||||
return this->monitorFiles;
|
return this->monitorFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PorymapConfig::getTilesetCheckerboardFill() {
|
||||||
|
return this->tilesetCheckerboardFill;
|
||||||
|
}
|
||||||
|
|
||||||
QString PorymapConfig::getTheme() {
|
QString PorymapConfig::getTheme() {
|
||||||
return this->theme;
|
return this->theme;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1277,12 +1277,14 @@ void MainWindow::on_actionNew_Tileset_triggered() {
|
||||||
for(int i = 0; i < numMetaTiles; ++i) {
|
for(int i = 0; i < numMetaTiles; ++i) {
|
||||||
Metatile *mt = new Metatile();
|
Metatile *mt = new Metatile();
|
||||||
for(int j = 0; j < tilesPerMetatile; ++j){
|
for(int j = 0; j < tilesPerMetatile; ++j){
|
||||||
Tile tile(0, false, false, 0);
|
Tile tile = Tile();
|
||||||
//Create a checkerboard-style dummy tileset
|
if (createTilesetDialog->checkerboardFill) {
|
||||||
if(((i / 8) % 2) == 0)
|
// Create a checkerboard-style dummy tileset
|
||||||
tile.tileId = ((i % 2) == 0) ? 1 : 2;
|
if (((i / 8) % 2) == 0)
|
||||||
else
|
tile.tileId = ((i % 2) == 0) ? 1 : 2;
|
||||||
tile.tileId = ((i % 2) == 1) ? 1 : 2;
|
else
|
||||||
|
tile.tileId = ((i % 2) == 1) ? 1 : 2;
|
||||||
|
}
|
||||||
mt->tiles.append(tile);
|
mt->tiles.append(tile);
|
||||||
}
|
}
|
||||||
newSet.metatiles.append(mt);
|
newSet.metatiles.append(mt);
|
||||||
|
|
|
@ -15,8 +15,13 @@ NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) :
|
||||||
QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression);
|
QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression);
|
||||||
this->ui->nameLineEdit->setValidator(validator);
|
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->nameLineEdit, &QLineEdit::textChanged, this, &NewTilesetDialog::NameOrSecondaryChanged);
|
||||||
connect(this->ui->typeComboBox, &QComboBox::currentTextChanged, this, &NewTilesetDialog::SecondaryChanged);
|
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);
|
//connect(this->ui->toolButton, &QToolButton::clicked, this, &NewTilesetDialog::ChangeFilePath);
|
||||||
this->SecondaryChanged();
|
this->SecondaryChanged();
|
||||||
}
|
}
|
||||||
|
@ -38,3 +43,8 @@ void NewTilesetDialog::NameOrSecondaryChanged() {
|
||||||
this->path = Tileset::getExpectedDir(this->fullSymbolName, this->isSecondary);
|
this->path = Tileset::getExpectedDir(this->fullSymbolName, this->isSecondary);
|
||||||
this->ui->pathLineEdit->setText(this->path);
|
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