Add name list functions to API

This commit is contained in:
GriffinR 2022-09-30 23:01:00 -04:00 committed by Marcus Huderle
parent 1439599079
commit 4b1498d059
2 changed files with 72 additions and 6 deletions

View file

@ -39,6 +39,16 @@ public:
Q_INVOKABLE void setMetatileLayerOrder(QList<int> order);
Q_INVOKABLE QList<float> getMetatileLayerOpacity();
Q_INVOKABLE void setMetatileLayerOpacity(QList<float> order);
Q_INVOKABLE QList<QString> getMapNames();
Q_INVOKABLE QList<QString> getTilesetNames();
Q_INVOKABLE QList<QString> getPrimaryTilesetNames();
Q_INVOKABLE QList<QString> getSecondaryTilesetNames();
Q_INVOKABLE QList<QString> getMetatileBehaviorNames();
Q_INVOKABLE QList<QString> getSongNames();
Q_INVOKABLE QList<QString> getLocationNames();
Q_INVOKABLE QList<QString> getWeatherNames();
Q_INVOKABLE QList<QString> getMapTypeNames();
Q_INVOKABLE QList<QString> getBattleSceneNames();
Q_INVOKABLE bool isPrimaryTileset(QString tilesetName);
Q_INVOKABLE bool isSecondaryTileset(QString tilesetName);

View file

@ -211,14 +211,70 @@ void ScriptUtility::setMetatileLayerOpacity(QList<float> order) {
window->refreshAfterPalettePreviewChange();
}
bool ScriptUtility::isPrimaryTileset(QString tilesetName) {
QList<QString> ScriptUtility::getMapNames() {
if (!window || !window->editor || !window->editor->project)
return false;
return window->editor->project->tilesetLabels["primary"].contains(tilesetName);
return QList<QString>();
return window->editor->project->mapNames;
}
QList<QString> ScriptUtility::getTilesetNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->tilesetLabelsOrdered;
}
QList<QString> ScriptUtility::getPrimaryTilesetNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->tilesetLabels["primary"];
}
QList<QString> ScriptUtility::getSecondaryTilesetNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->tilesetLabels["secondary"];
}
QList<QString> ScriptUtility::getMetatileBehaviorNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->metatileBehaviorMap.keys();
}
QList<QString> ScriptUtility::getSongNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->songNames;
}
QList<QString> ScriptUtility::getLocationNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->mapSectionNameToValue.keys();
}
QList<QString> ScriptUtility::getWeatherNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->weatherNames;
}
QList<QString> ScriptUtility::getMapTypeNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->mapTypes;
}
QList<QString> ScriptUtility::getBattleSceneNames() {
if (!window || !window->editor || !window->editor->project)
return QList<QString>();
return window->editor->project->mapBattleScenes;
}
bool ScriptUtility::isPrimaryTileset(QString tilesetName) {
return getPrimaryTilesetNames().contains(tilesetName);
}
bool ScriptUtility::isSecondaryTileset(QString tilesetName) {
if (!window || !window->editor || !window->editor->project)
return false;
return window->editor->project->tilesetLabels["secondary"].contains(tilesetName);
return getSecondaryTilesetNames().contains(tilesetName);
}