[nostalgia/core/studio] Fix ng export to only attempt export if output file is given
This commit is contained in:
parent
5f8104efea
commit
1d8f8566c5
@ -461,26 +461,28 @@ TileSheetEditor::~TileSheetEditor() {
|
|||||||
saveState();
|
saveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TileSheetEditor::itemName() {
|
QString TileSheetEditor::itemName() const {
|
||||||
return m_itemName;
|
return m_itemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditor::exportFile() {
|
void TileSheetEditor::exportFile() {
|
||||||
auto path = QFileDialog::getSaveFileName(this, tr("Export to Image"), "",
|
auto path = QFileDialog::getSaveFileName(this, tr("Export to Image"), "",
|
||||||
tr("PNG (*.png)"));
|
tr("PNG (*.png)"));
|
||||||
auto ng = m_sheetData.toNostalgiaGraphic();
|
if (path != "") {
|
||||||
QString palPath;
|
auto ng = m_sheetData.toNostalgiaGraphic();
|
||||||
if (palPath == "" && ng->defaultPalette.type() == ox::FileAddressType::Path) {
|
QString palPath;
|
||||||
palPath = ng->defaultPalette.getPath().value;
|
if (palPath == "" && ng->defaultPalette.type() == ox::FileAddressType::Path) {
|
||||||
|
palPath = ng->defaultPalette.getPath().value;
|
||||||
|
}
|
||||||
|
std::unique_ptr<NostalgiaPalette> npal;
|
||||||
|
try {
|
||||||
|
npal = m_ctx->project->loadObj<NostalgiaPalette>(palPath);
|
||||||
|
} catch (ox::Error) {
|
||||||
|
qWarning() << "Could not open palette" << palPath;
|
||||||
|
// TODO: message box to notify of failure
|
||||||
|
}
|
||||||
|
toQImage(ng.get(), npal.get()).save(path, "PNG");
|
||||||
}
|
}
|
||||||
std::unique_ptr<NostalgiaPalette> npal;
|
|
||||||
try {
|
|
||||||
npal = m_ctx->project->loadObj<NostalgiaPalette>(palPath);
|
|
||||||
} catch (ox::Error) {
|
|
||||||
qWarning() << "Could not open palette" << palPath;
|
|
||||||
// TODO: message box to notify of failure
|
|
||||||
}
|
|
||||||
toQImage(ng.get(), npal.get()).save(path, "PNG");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditor::saveItem() {
|
void TileSheetEditor::saveItem() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user