mirror of
https://github.com/huderlem/porymap.git
synced 2026-11-10 19:08:22 -06:00
Apply the "map opened" API callback to layouts, add utility functions
This commit is contained in:
@@ -794,7 +794,7 @@ void MainWindow::setMetatileTile(int metatileId, int tileIndex, QJSValue tileObj
|
||||
}
|
||||
|
||||
QJSValue MainWindow::getTilePixels(int tileId) {
|
||||
if (tileId < 0 || !this->editor || !this->editor->project || !this->editor->map || !this->editor->layout)
|
||||
if (tileId < 0 || !this->editor || !this->editor->layout)
|
||||
return QJSValue();
|
||||
QImage tileImage = getTileImage(tileId, this->editor->layout->tileset_primary, this->editor->layout->tileset_secondary);
|
||||
if (tileImage.isNull() || tileImage.sizeInBytes() < 64)
|
||||
|
||||
@@ -249,6 +249,27 @@ QList<QString> ScriptUtility::getMapNames() {
|
||||
return window->editor->project->mapNames;
|
||||
}
|
||||
|
||||
QList<QString> ScriptUtility::getMapConstants() {
|
||||
if (!window || !window->editor || !window->editor->project)
|
||||
return QList<QString>();
|
||||
return window->editor->project->mapConstantsToMapNames.keys();
|
||||
}
|
||||
|
||||
QList<QString> ScriptUtility::getLayoutNames() {
|
||||
QList<QString> names;
|
||||
if (!window || !window->editor || !window->editor->project)
|
||||
return names;
|
||||
for (const auto &layout : window->editor->project->mapLayouts)
|
||||
names.append(layout->name);
|
||||
return names;
|
||||
}
|
||||
|
||||
QList<QString> ScriptUtility::getLayoutConstants() {
|
||||
if (!window || !window->editor || !window->editor->project)
|
||||
return QList<QString>();
|
||||
return window->editor->project->layoutIds;
|
||||
}
|
||||
|
||||
QList<QString> ScriptUtility::getTilesetNames() {
|
||||
if (!window || !window->editor || !window->editor->project)
|
||||
return QList<QString>();
|
||||
|
||||
Reference in New Issue
Block a user