Add tileset comboboxes, and make metatile area scrollable
This commit is contained in:
parent
767407e1a7
commit
37529d37ec
4 changed files with 234 additions and 91 deletions
|
@ -222,6 +222,12 @@ void MainWindow::displayMapProperties() {
|
||||||
ui->comboBox_Location->addItems(project->getLocations());
|
ui->comboBox_Location->addItems(project->getLocations());
|
||||||
ui->comboBox_Location->setCurrentText(map->location);
|
ui->comboBox_Location->setCurrentText(map->location);
|
||||||
|
|
||||||
|
QMap<QString, QStringList> tilesets = project->getTilesets();
|
||||||
|
ui->comboBox_PrimaryTileset->addItems(tilesets.value("primary"));
|
||||||
|
ui->comboBox_PrimaryTileset->setCurrentText(map->layout->tileset_primary_label);
|
||||||
|
ui->comboBox_SecondaryTileset->addItems(tilesets.value("secondary"));
|
||||||
|
ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label);
|
||||||
|
|
||||||
ui->comboBox_Visibility->addItems(project->getVisibilities());
|
ui->comboBox_Visibility->addItems(project->getVisibilities());
|
||||||
ui->comboBox_Visibility->setCurrentText(map->visibility);
|
ui->comboBox_Visibility->setCurrentText(map->visibility);
|
||||||
|
|
||||||
|
|
207
mainwindow.ui
207
mainwindow.ui
|
@ -290,7 +290,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>475</width>
|
<width>436</width>
|
||||||
<height>621</height>
|
<height>621</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -451,69 +451,55 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QScrollArea" name="scrollArea_2">
|
<widget class="QFrame" name="frame_Tilesets">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>358</width>
|
|
||||||
<height>612</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5" rowstretch="0,0" columnstretch="0">
|
<property name="frameShape">
|
||||||
<property name="sizeConstraint">
|
<enum>QFrame::StyledPanel</enum>
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="frameShadow">
|
||||||
<number>0</number>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>8</number>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_PrimaryTileset">
|
||||||
|
<property name="text">
|
||||||
|
<string>Primary Tileset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_PrimaryTileset">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_SecondaryTileset">
|
||||||
|
<property name="text">
|
||||||
|
<string>Secondary Tileset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_SecondaryTileset">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
<widget class="QFrame" name="frame_10">
|
<widget class="QFrame" name="frame_10">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -531,6 +517,19 @@
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_13">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_16">
|
<widget class="QLabel" name="label_16">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -575,7 +574,7 @@
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Maximum</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
|
@ -588,13 +587,83 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
|
<widget class="QScrollArea" name="scrollArea_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="verticalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||||
|
</property>
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>358</width>
|
||||||
|
<height>497</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -610,6 +679,32 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_14">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_15">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
47
project.cpp
47
project.cpp
|
@ -354,7 +354,7 @@ void Project::readMapLayout(Map* map) {
|
||||||
map->layout = mapLayouts[map->layout_label];
|
map->layout = mapLayouts[map->layout_label];
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilesets(map);
|
getMapTilesets(map);
|
||||||
loadBlockdata(map);
|
loadBlockdata(map);
|
||||||
loadMapBorder(map);
|
loadMapBorder(map);
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ void Project::saveMapConstantsHeader() {
|
||||||
saveTextFile(root + "/include/constants/maps.h", text);
|
saveTextFile(root + "/include/constants/maps.h", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::getTilesets(Map* map) {
|
void Project::getMapTilesets(Map* map) {
|
||||||
if (map->layout->has_unsaved_changes) {
|
if (map->layout->has_unsaved_changes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -955,7 +955,7 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
||||||
mapNamesToMapConstants->insert(map->name, map->constantName);
|
mapNamesToMapConstants->insert(map->name, map->constantName);
|
||||||
setNewMapHeader(map, mapLayoutsTable.size() + 1);
|
setNewMapHeader(map, mapLayoutsTable.size() + 1);
|
||||||
setNewMapLayout(map);
|
setNewMapLayout(map);
|
||||||
getTilesets(map);
|
getMapTilesets(map);
|
||||||
setNewMapBlockdata(map);
|
setNewMapBlockdata(map);
|
||||||
setNewMapBorder(map);
|
setNewMapBorder(map);
|
||||||
setNewMapEvents(map);
|
setNewMapEvents(map);
|
||||||
|
@ -1001,6 +1001,47 @@ QStringList Project::getVisibilities() {
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<QString, QStringList> Project::getTilesets() {
|
||||||
|
QMap<QString, QStringList> allTilesets;
|
||||||
|
QStringList primaryTilesets;
|
||||||
|
QStringList secondaryTilesets;
|
||||||
|
allTilesets.insert("primary", primaryTilesets);
|
||||||
|
allTilesets.insert("secondary", secondaryTilesets);
|
||||||
|
QString headers_text = readTextFile(root + "/data/tilesets/headers.inc");
|
||||||
|
QList<QStringList>* commands = parseAsm(headers_text);
|
||||||
|
int i = 0;
|
||||||
|
while (i < commands->length()) {
|
||||||
|
if (commands->at(i).length() != 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (commands->at(i).at(0) == ".label") {
|
||||||
|
QString tilesetLabel = commands->at(i).at(1);
|
||||||
|
// Advance to command specifying whether or not it is a secondary tileset
|
||||||
|
i += 2;
|
||||||
|
if (commands->at(i).at(0) != ".byte") {
|
||||||
|
qDebug() << "Unexpected command found for secondary tileset flag. Expected '.byte', but found: " << commands->at(i).at(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString secondaryTilesetValue = commands->at(i).at(1);
|
||||||
|
if (secondaryTilesetValue != "TRUE" && secondaryTilesetValue != "FALSE" && secondaryTilesetValue != "0" && secondaryTilesetValue != "1") {
|
||||||
|
qDebug() << "Unexpected secondary tileset flag found. Expected \"TRUE\", \"FALSE\", \"0\", or \"1\", but found: " << secondaryTilesetValue;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isSecondaryTileset = (secondaryTilesetValue == "TRUE" || secondaryTilesetValue == "1");
|
||||||
|
if (isSecondaryTileset)
|
||||||
|
allTilesets["secondary"].append(tilesetLabel);
|
||||||
|
else
|
||||||
|
allTilesets["primary"].append(tilesetLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return allTilesets;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Project::getWeathers() {
|
QStringList Project::getWeathers() {
|
||||||
// TODO
|
// TODO
|
||||||
QStringList names;
|
QStringList names;
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
QStringList* readLayoutValues(QString layoutName);
|
QStringList* readLayoutValues(QString layoutName);
|
||||||
void readMapLayout(Map*);
|
void readMapLayout(Map*);
|
||||||
void readMapsWithConnections();
|
void readMapsWithConnections();
|
||||||
void getTilesets(Map*);
|
void getMapTilesets(Map*);
|
||||||
void loadTilesetAssets(Tileset*);
|
void loadTilesetAssets(Tileset*);
|
||||||
|
|
||||||
void saveBlockdata(Map*);
|
void saveBlockdata(Map*);
|
||||||
|
@ -74,6 +74,7 @@ public:
|
||||||
QStringList getSongNames();
|
QStringList getSongNames();
|
||||||
QStringList getLocations();
|
QStringList getLocations();
|
||||||
QStringList getVisibilities();
|
QStringList getVisibilities();
|
||||||
|
QMap<QString, QStringList> getTilesets();
|
||||||
QStringList getWeathers();
|
QStringList getWeathers();
|
||||||
QStringList getMapTypes();
|
QStringList getMapTypes();
|
||||||
QStringList getBattleScenes();
|
QStringList getBattleScenes();
|
||||||
|
|
Loading…
Reference in a new issue