diff --git a/src/nostalgia/core/studio/new_tilesheet_wizard.cpp b/src/nostalgia/core/studio/new_tilesheet_wizard.cpp index c70de4d9..91dc01c2 100644 --- a/src/nostalgia/core/studio/new_tilesheet_wizard.cpp +++ b/src/nostalgia/core/studio/new_tilesheet_wizard.cpp @@ -20,14 +20,8 @@ namespace nostalgia::core { NewTilesheetWizardPage::NewTilesheetWizardPage(const studio::Context *ctx) { m_ctx = ctx; addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [this](QString name) { - auto path = QString(TileSheetDir) + name + FileExt_ng; - auto err = m_ctx->project->exists(path); - if (err) { - showValidationError(tr("A tile sheet with this name already exists.")); - } - return err; - } - ); + return 0; + }); m_palettePicker = addComboBox(tr("&Palette:"), QString(Palette) + "*", {""}); m_ctx->project->subscribe(studio::ProjectEvent::FileRecognized, m_palettePicker, [this](QString path) { if (path.startsWith(PaletteDir) && path.endsWith(FileExt_npal)) { @@ -40,6 +34,12 @@ int NewTilesheetWizardPage::accept() { const auto tilesheetName = field(TileSheetName).toString(); const auto palette = m_palettePicker->itemData(field(Palette).toInt()).toString(); const auto outPath = TileSheetDir + tilesheetName + FileExt_ng; + auto outPath = QString(TileSheetDir) + name + FileExt_ng; + auto err = m_ctx->project->exists(outPath); + if (err) { + showValidationError(tr("A tile sheet with this name already exists.")); + return err; + } NostalgiaGraphic ng; ng.columns = 1; ng.rows = 1;