mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-27 02:16:34 -05:00
resize region map tilemaps
This commit is contained in:
@@ -31,8 +31,6 @@ bool RegionMap::loadMapData(poryjson::Json data) {
|
||||
poryjson::Json::object mapObject = data.object_items();
|
||||
|
||||
this->alias = mapObject["alias"].string_value();
|
||||
this->region_width = mapObject["width"].int_value();
|
||||
this->region_height = mapObject["height"].int_value();
|
||||
|
||||
poryjson::Json tilemapJson = mapObject["tilemap"];
|
||||
poryjson::Json layoutJson = mapObject["layout"];
|
||||
@@ -260,6 +258,41 @@ void RegionMap::save() {
|
||||
saveLayout();
|
||||
}
|
||||
|
||||
poryjson::Json::object RegionMap::config() {
|
||||
poryjson::Json::object config;
|
||||
|
||||
config["alias"] = this->alias;
|
||||
|
||||
poryjson::Json::object tilemapObject;
|
||||
tilemapObject["width"] = this->tilemap_width;
|
||||
tilemapObject["height"] = this->tilemap_height;
|
||||
|
||||
QMap<TilemapFormat, QString> tilemapFormatMap = { {TilemapFormat::Plain, "plain"}, {TilemapFormat::BPP_4, "4bpp"}, {TilemapFormat::BPP_8, "8bpp"} };
|
||||
tilemapObject["format"] = tilemapFormatMap[this->tilemap_format];
|
||||
tilemapObject["tileset_path"] = this->tileset_path;
|
||||
tilemapObject["tilemap_path"] = this->tilemap_path;
|
||||
if (!this->palette_path.isEmpty()) {
|
||||
tilemapObject["palette"] = this->palette_path;
|
||||
}
|
||||
config["tilemap"] = tilemapObject;
|
||||
|
||||
if (this->layout_format != LayoutFormat::None) {
|
||||
poryjson::Json::object layoutObject;
|
||||
layoutObject["width"] = this->layout_width;
|
||||
layoutObject["height"] = this->layout_height;
|
||||
layoutObject["offset_left"] = this->offset_left;
|
||||
layoutObject["offset_top"] = this->offset_top;
|
||||
QMap<LayoutFormat, QString> layoutFormatMap = { {LayoutFormat::Binary, "binary"}, {LayoutFormat::CArray, "C array"} };
|
||||
layoutObject["format"] = layoutFormatMap[this->layout_format];
|
||||
layoutObject["path"] = this->layout_path;
|
||||
config["layout"] = layoutObject;
|
||||
} else {
|
||||
config["layout"] = nullptr;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
void RegionMap::saveTilemap() {
|
||||
QFile tilemapFile(fullPath(this->tilemap_path));
|
||||
if (!tilemapFile.open(QIODevice::WriteOnly)) {
|
||||
@@ -354,9 +387,52 @@ void RegionMap::replaceSection(QString oldSection, QString newSection) {
|
||||
}
|
||||
}
|
||||
|
||||
void RegionMap::resize(int newWidth, int newHeight) {
|
||||
// TODO
|
||||
void RegionMap::resizeTilemap(int newWidth, int newHeight, bool update) {
|
||||
auto tilemapCopy = this->tilemap;
|
||||
int oldWidth = this->tilemap_width;
|
||||
int oldHeight = this->tilemap_height;
|
||||
this->tilemap_width = newWidth;
|
||||
this->tilemap_height = newHeight;
|
||||
|
||||
if (update) {
|
||||
QByteArray tilemapArray;
|
||||
QDataStream dataStream(&tilemapArray, QIODevice::WriteOnly);
|
||||
dataStream.setByteOrder(QDataStream::LittleEndian);
|
||||
switch (this->tilemap_format) {
|
||||
case TilemapFormat::Plain:
|
||||
for (int y = 0; y < newHeight; y++)
|
||||
for (int x = 0; x < newWidth; x++) {
|
||||
if (y < oldHeight && x < oldWidth) {
|
||||
int i = x + y * oldWidth;
|
||||
uint8_t tile = tilemapCopy[i]->raw();
|
||||
dataStream << tile;
|
||||
} else {
|
||||
uint8_t tile = 0;
|
||||
dataStream << tile;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TilemapFormat::BPP_4:
|
||||
case TilemapFormat::BPP_8:
|
||||
for (int y = 0; y < newHeight; y++)
|
||||
for (int x = 0; x < newWidth; x++) {
|
||||
if (y < oldHeight && x < oldWidth) {
|
||||
int i = x + y * oldWidth;
|
||||
uint16_t tile = tilemapCopy[i]->raw();
|
||||
dataStream << tile;
|
||||
} else {
|
||||
uint16_t tile = 0;
|
||||
dataStream << tile;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
setTilemap(tilemapArray);
|
||||
}
|
||||
}
|
||||
|
||||
void RegionMap::emitDisplay() {
|
||||
emit mapNeedsDisplaying();
|
||||
}
|
||||
|
||||
QByteArray RegionMap::getTilemap() {
|
||||
|
||||
@@ -225,4 +225,37 @@ void RemoveEntry::undo() {
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
ResizeTilemap::ResizeTilemap(RegionMap *map, QByteArray oldTilemap, QByteArray newTilemap,
|
||||
int oldWidth, int oldHeight, int newWidth, int newHeight, QUndoCommand *parent)
|
||||
: EditTilemap(map, oldTilemap, newTilemap, -1, parent) {
|
||||
setText("Resize Tilemap");
|
||||
|
||||
this->oldWidth = oldWidth;
|
||||
this->oldHeight = oldHeight;
|
||||
this->newWidth = newWidth;
|
||||
this->newHeight = newHeight;
|
||||
}
|
||||
|
||||
void ResizeTilemap::redo() {
|
||||
QUndoCommand::redo();
|
||||
|
||||
if (!map) return;
|
||||
|
||||
map->resizeTilemap(this->newWidth, this->newHeight, false);
|
||||
map->setTilemap(this->newTilemap);
|
||||
map->emitDisplay();
|
||||
}
|
||||
|
||||
void ResizeTilemap::undo() {
|
||||
if (!map) return;
|
||||
|
||||
map->resizeTilemap(this->oldWidth, this->oldHeight, false);
|
||||
map->setTilemap(this->oldTilemap);
|
||||
map->emitDisplay();
|
||||
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,21 +22,19 @@
|
||||
using OrderedJson = poryjson::Json;
|
||||
using OrderedJsonDoc = poryjson::JsonDoc;
|
||||
|
||||
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) :
|
||||
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::RegionMapEditor)
|
||||
{
|
||||
this->ui->setupUi(this);
|
||||
this->project = project_;
|
||||
this->ui->action_RegionMap_Resize->setVisible(false);
|
||||
this->project = project;
|
||||
this->initShortcuts();
|
||||
this->restoreWindowState();
|
||||
//on_verticalSlider_Zoom_Map_Image_valueChanged(50);
|
||||
}
|
||||
|
||||
RegionMapEditor::~RegionMapEditor()
|
||||
{
|
||||
delete ui;
|
||||
this->region_map = nullptr;
|
||||
// deletion must be done in this order else crashes
|
||||
auto stacks = this->history.stacks();
|
||||
for (auto *stack : stacks) {
|
||||
@@ -55,6 +53,7 @@ RegionMapEditor::~RegionMapEditor()
|
||||
delete scene_city_map_image;
|
||||
delete scene_region_map_layout;
|
||||
delete scene_region_map_tiles;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RegionMapEditor::restoreWindowState() {
|
||||
@@ -81,10 +80,6 @@ void RegionMapEditor::initShortcuts() {
|
||||
ui->menuEdit->addAction(undoAction);
|
||||
ui->menuEdit->addAction(redoAction);
|
||||
|
||||
connect(&(this->history), &QUndoGroup::indexChanged, [this](int) {
|
||||
on_tabWidget_Region_Map_currentChanged(this->ui->tabWidget_Region_Map->currentIndex());
|
||||
});
|
||||
|
||||
shortcutsConfig.load();
|
||||
shortcutsConfig.setDefaultShortcuts(shortcutableObjects());
|
||||
applyUserShortcuts();
|
||||
@@ -433,6 +428,10 @@ bool RegionMapEditor::load() {
|
||||
newMap->setEntries(&this->region_map_entries);
|
||||
newMap->loadMapData(o);
|
||||
|
||||
connect(newMap, &RegionMap::mapNeedsDisplaying, [this]() {
|
||||
displayRegionMap();
|
||||
});
|
||||
|
||||
region_maps[alias] = newMap;
|
||||
|
||||
this->history.addStack(&(newMap->editHistory));
|
||||
@@ -448,6 +447,10 @@ bool RegionMapEditor::load() {
|
||||
setRegionMap(region_maps.begin()->second);
|
||||
}
|
||||
|
||||
connect(&(this->history), &QUndoGroup::indexChanged, [this](int) {
|
||||
on_tabWidget_Region_Map_currentChanged(this->ui->tabWidget_Region_Map->currentIndex());
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -477,23 +480,56 @@ bool RegionMapEditor::loadCityMaps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
||||
// TODO: add "Save All" to save all region maps
|
||||
this->region_map->save();
|
||||
bool RegionMapEditor::saveRegionMap(RegionMap *map) {
|
||||
//
|
||||
if (!map) return false;
|
||||
|
||||
// save entries
|
||||
saveRegionMapEntries();
|
||||
map->save();
|
||||
|
||||
// save config
|
||||
return true;
|
||||
}
|
||||
|
||||
void RegionMapEditor::saveConfig() {
|
||||
OrderedJson::array mapArray;
|
||||
for (auto it : this->region_maps) {
|
||||
OrderedJson::object obj = it.second->config();
|
||||
mapArray.append(obj);
|
||||
}
|
||||
|
||||
OrderedJson::object mapsObject;
|
||||
mapsObject["region_maps"] = mapArray;
|
||||
|
||||
OrderedJson newConfigJson(mapsObject);
|
||||
QString filepath = QString("%1/src/data/region_map/porymap_config.json").arg(this->project->root);
|
||||
QFile file(filepath);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
logError(QString("Error: Could not open %1 for writing").arg(filepath));
|
||||
return;
|
||||
}
|
||||
OrderedJsonDoc jsonDoc(&(this->rmConfigJson));
|
||||
OrderedJsonDoc jsonDoc(&newConfigJson);
|
||||
jsonDoc.dump(&file);
|
||||
file.close();
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
||||
// TODO: add "Save All" to save all region maps
|
||||
saveRegionMap(this->region_map);
|
||||
|
||||
// save entries
|
||||
saveRegionMapEntries();
|
||||
|
||||
// save config
|
||||
saveConfig();
|
||||
|
||||
this->hasUnsavedChanges = false;
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_actionSave_All_triggered() {
|
||||
for (auto it : this->region_maps) {
|
||||
saveRegionMap(it.second);
|
||||
}
|
||||
saveRegionMapEntries();
|
||||
saveConfig();
|
||||
|
||||
this->hasUnsavedChanges = false;
|
||||
}
|
||||
@@ -520,7 +556,6 @@ void RegionMapEditor::updateLayerDisplayed() {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_comboBox_regionSelector_textActivated(const QString ®ion) {
|
||||
//
|
||||
if (this->region_maps.contains(region)) {
|
||||
setRegionMap(region_maps.at(region));
|
||||
}
|
||||
@@ -596,6 +631,8 @@ void RegionMapEditor::updateRegionMapLayoutOptions(int index) {
|
||||
this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->squareMapSection(index));
|
||||
this->ui->comboBox_RM_ConnectedMap->blockSignals(false);
|
||||
|
||||
this->ui->pushButton_RM_Options_delete->setEnabled(this->region_map->squareHasMap(index));
|
||||
|
||||
this->ui->spinBox_RM_LayoutWidth->blockSignals(true);
|
||||
this->ui->spinBox_RM_LayoutHeight->blockSignals(true);
|
||||
this->ui->spinBox_RM_LayoutWidth->setMinimum(1);
|
||||
@@ -910,6 +947,8 @@ void RegionMapEditor::onHoveredRegionMapTileCleared() {
|
||||
}
|
||||
|
||||
void RegionMapEditor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item) {
|
||||
static unsigned actionId_ = 0;
|
||||
|
||||
QPointF pos = event->pos();
|
||||
int x = static_cast<int>(pos.x()) / 8;
|
||||
int y = static_cast<int>(pos.y()) / 8;
|
||||
@@ -920,9 +959,17 @@ void RegionMapEditor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, Reg
|
||||
item->select(event);
|
||||
//} else if (event->buttons() & Qt::MiddleButton) {// TODO
|
||||
} else {
|
||||
item->paint(event);
|
||||
this->region_map_layout_item->draw();
|
||||
this->hasUnsavedChanges = true;
|
||||
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||
actionId_++;
|
||||
} else {
|
||||
QByteArray oldTilemap = this->region_map->getTilemap();
|
||||
item->paint(event);
|
||||
QByteArray newTilemap = this->region_map->getTilemap();
|
||||
EditTilemap *command = new EditTilemap(this->region_map, oldTilemap, newTilemap, actionId_);
|
||||
this->region_map->commit(command);
|
||||
//this->region_map_layout_item->draw();
|
||||
this->hasUnsavedChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +1007,7 @@ void RegionMapEditor::mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityM
|
||||
|
||||
void RegionMapEditor::on_tabWidget_Region_Map_currentChanged(int index) {
|
||||
this->ui->stackedWidget_RM_Options->setCurrentIndex(index);
|
||||
if (!region_map) return;
|
||||
if (!this->region_map) return;
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
@@ -1019,8 +1066,6 @@ void RegionMapEditor::on_comboBox_layoutLayer_textActivated(const QString &text)
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_RM_Entry_x_valueChanged(int x) {
|
||||
//tryInsertNewMapEntry(activeEntry);
|
||||
qDebug() << "spinBox_RM_Entry_x valueChanged" << x;
|
||||
if (!this->region_map_entries.contains(activeEntry)) return;
|
||||
MapSectionEntry oldEntry = this->region_map_entries[activeEntry];
|
||||
this->region_map_entries[activeEntry].x = x;
|
||||
@@ -1036,7 +1081,6 @@ void RegionMapEditor::on_spinBox_RM_Entry_x_valueChanged(int x) {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_RM_Entry_y_valueChanged(int y) {
|
||||
//tryInsertNewMapEntry(activeEntry);
|
||||
if (!this->region_map_entries.contains(activeEntry)) return;
|
||||
MapSectionEntry oldEntry = this->region_map_entries[activeEntry];
|
||||
this->region_map_entries[activeEntry].y = y;
|
||||
@@ -1052,7 +1096,6 @@ void RegionMapEditor::on_spinBox_RM_Entry_y_valueChanged(int y) {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_RM_Entry_width_valueChanged(int width) {
|
||||
//tryInsertNewMapEntry(activeEntry);
|
||||
if (!this->region_map_entries.contains(activeEntry)) return;
|
||||
MapSectionEntry oldEntry = this->region_map_entries[activeEntry];
|
||||
this->region_map_entries[activeEntry].width = width;
|
||||
@@ -1064,7 +1107,6 @@ void RegionMapEditor::on_spinBox_RM_Entry_width_valueChanged(int width) {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_RM_Entry_height_valueChanged(int height) {
|
||||
//tryInsertNewMapEntry(activeEntry);
|
||||
if (!this->region_map_entries.contains(activeEntry)) return;
|
||||
MapSectionEntry oldEntry = this->region_map_entries[activeEntry];
|
||||
this->region_map_entries[activeEntry].height = height;
|
||||
@@ -1076,7 +1118,6 @@ void RegionMapEditor::on_spinBox_RM_Entry_height_valueChanged(int height) {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_RM_LayoutWidth_valueChanged(int value) {
|
||||
//
|
||||
if (this->region_map) {
|
||||
int oldWidth = this->region_map->layoutWidth();
|
||||
int oldHeight = this->region_map->layoutHeight();
|
||||
@@ -1179,23 +1220,21 @@ void RegionMapEditor::on_pushButton_CityMap_add_clicked() {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_action_RegionMap_Resize_triggered() {
|
||||
// TODO: this whole feature
|
||||
/*
|
||||
QDialog popup(this, Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||
popup.setWindowTitle("New Region Map Dimensions");
|
||||
popup.setWindowTitle("New Tilemap Dimensions");
|
||||
popup.setWindowModality(Qt::NonModal);
|
||||
|
||||
QFormLayout form(&popup);
|
||||
|
||||
QSpinBox *widthSpinBox = new QSpinBox();
|
||||
QSpinBox *heightSpinBox = new QSpinBox();
|
||||
widthSpinBox->setMinimum(32);
|
||||
heightSpinBox->setMinimum(20);
|
||||
widthSpinBox->setMaximum(128);// TODO: find real limits... 128
|
||||
// TODO: limits do not go smaller than layout
|
||||
QSpinBox *widthSpinBox = new QSpinBox;
|
||||
QSpinBox *heightSpinBox = new QSpinBox;
|
||||
widthSpinBox->setMinimum(16);
|
||||
heightSpinBox->setMinimum(16);
|
||||
widthSpinBox->setMaximum(128);
|
||||
heightSpinBox->setMaximum(128);
|
||||
// TODO width, height
|
||||
widthSpinBox->setValue(this->region_map->width());
|
||||
heightSpinBox->setValue(this->region_map->height());
|
||||
widthSpinBox->setValue(this->region_map->tilemapWidth());
|
||||
heightSpinBox->setValue(this->region_map->tilemapHeight());
|
||||
form.addRow(new QLabel("Width"), widthSpinBox);
|
||||
form.addRow(new QLabel("Height"), heightSpinBox);
|
||||
|
||||
@@ -1206,24 +1245,25 @@ void RegionMapEditor::on_action_RegionMap_Resize_triggered() {
|
||||
connect(&buttonBox, &QDialogButtonBox::accepted, &popup, &QDialog::accept);
|
||||
|
||||
if (popup.exec() == QDialog::Accepted) {
|
||||
resize(widthSpinBox->value(), heightSpinBox->value());
|
||||
RegionMapHistoryItem *commit = new RegionMapHistoryItem(
|
||||
RegionMapEditorBox::BackgroundImage, this->region_map->getTiles(), widthSpinBox->value(), heightSpinBox->value()
|
||||
);
|
||||
history.push(commit);
|
||||
resizeTilemap(widthSpinBox->value(), heightSpinBox->value());
|
||||
}
|
||||
|
||||
this->hasUnsavedChanges = true;
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
void RegionMapEditor::resize(int w, int h) {
|
||||
this->region_map->resize(w, h);
|
||||
this->currIndex = this->region_map->padLeft() * w + this->region_map->padTop();
|
||||
displayRegionMapImage();
|
||||
displayRegionMapLayout();
|
||||
displayRegionMapLayoutOptions();
|
||||
void RegionMapEditor::resizeTilemap(int width, int height) {
|
||||
QByteArray oldTilemap = this->region_map->getTilemap();
|
||||
int oldWidth = this->region_map->tilemapWidth();
|
||||
int oldHeight = this->region_map->tilemapHeight();
|
||||
this->region_map->resizeTilemap(width, height);
|
||||
QByteArray newTilemap = this->region_map->getTilemap();
|
||||
int newWidth = this->region_map->tilemapWidth();
|
||||
int newHeight = this->region_map->tilemapHeight();
|
||||
ResizeTilemap *commit = new ResizeTilemap(this->region_map, oldTilemap, newTilemap, oldWidth, oldHeight, newWidth, newHeight);
|
||||
this->region_map->editHistory.push(commit);
|
||||
this->currIndex = this->region_map->padLeft() * width + this->region_map->padTop();
|
||||
//displayRegionMapImage();
|
||||
//displayRegionMapLayout();
|
||||
//displayRegionMapLayoutOptions();
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_action_Swap_triggered() {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "regionmappixmapitem.h"
|
||||
#include "regionmapeditcommands.h"
|
||||
|
||||
static unsigned actionId_ = 0;
|
||||
|
||||
void RegionMapPixmapItem::draw() {
|
||||
if (!region_map) return;
|
||||
|
||||
@@ -23,25 +21,17 @@ void RegionMapPixmapItem::draw() {
|
||||
|
||||
void RegionMapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||
if (region_map) {
|
||||
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||
actionId_++;
|
||||
} else {
|
||||
QPointF pos = event->pos();
|
||||
int x = static_cast<int>(pos.x()) / 8;
|
||||
int y = static_cast<int>(pos.y()) / 8;
|
||||
int index = x + y * region_map->tilemapWidth();
|
||||
QByteArray oldTilemap = this->region_map->getTilemap();
|
||||
this->region_map->setTileData(index,
|
||||
this->tile_selector->selectedTile,
|
||||
this->tile_selector->tile_hFlip,
|
||||
this->tile_selector->tile_vFlip,
|
||||
this->tile_selector->tile_palette
|
||||
);
|
||||
QByteArray newTilemap = this->region_map->getTilemap();
|
||||
EditTilemap *command = new EditTilemap(this->region_map, oldTilemap, newTilemap, actionId_);
|
||||
this->region_map->commit(command);
|
||||
draw();
|
||||
}
|
||||
QPointF pos = event->pos();
|
||||
int x = static_cast<int>(pos.x()) / 8;
|
||||
int y = static_cast<int>(pos.y()) / 8;
|
||||
int index = x + y * region_map->tilemapWidth();
|
||||
this->region_map->setTileData(index,
|
||||
this->tile_selector->selectedTile,
|
||||
this->tile_selector->tile_hFlip,
|
||||
this->tile_selector->tile_vFlip,
|
||||
this->tile_selector->tile_palette
|
||||
);
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ RegionMapPropertiesDialog::~RegionMapPropertiesDialog()
|
||||
|
||||
void RegionMapPropertiesDialog::hideMessages() {
|
||||
ui->message_alias->setVisible(false);
|
||||
ui->message_width->setVisible(false);
|
||||
ui->message_height->setVisible(false);
|
||||
ui->message_tilemapFormat->setVisible(false);
|
||||
ui->message_tilemapWidth->setVisible(false);
|
||||
ui->message_tilemapHeight->setVisible(false);
|
||||
@@ -48,8 +46,6 @@ void RegionMapPropertiesDialog::setProperties(poryjson::Json json) {
|
||||
|
||||
// Region Map Properties
|
||||
ui->config_alias->setText(object["alias"].string_value());
|
||||
ui->config_width->setValue(object["width"].int_value());
|
||||
ui->config_height->setValue(object["height"].int_value());
|
||||
|
||||
// Tilemap properties
|
||||
poryjson::Json::object tilemap = object["tilemap"].object_items();
|
||||
@@ -82,8 +78,6 @@ poryjson::Json RegionMapPropertiesDialog::saveToJson() {
|
||||
// TODO: make sure next comment is not a lie
|
||||
// data should already be verified and valid at this point
|
||||
config["alias"] = ui->config_alias->text();
|
||||
config["width"] = ui->config_width->value();
|
||||
config["height"] = ui->config_height->value();
|
||||
|
||||
poryjson::Json::object tilemapObject;
|
||||
tilemapObject["width"] = ui->config_tilemapWidth->value();
|
||||
|
||||
Reference in New Issue
Block a user