Fix cryptic error message using "Repeat Last Export" in some special cases (fix #1247)

We cannot use the sprite sheet type to know if the last export was
already done/defined by the user for a new sprite. We need a special
field to indicate if the export was done and we can repeat it last
export with the same configuration.
This commit is contained in:
David Capello 2016-09-06 22:07:57 -03:00
parent 1c88af5689
commit 18f9d2478f
3 changed files with 5 additions and 3 deletions

View File

@ -278,6 +278,7 @@
<option id="resize_scale" type="double" default="1" /> <option id="resize_scale" type="double" default="1" />
</section> </section>
<section id="sprite_sheet"> <section id="sprite_sheet">
<option id="defined" type="bool" default="false" />
<option id="type" type="app::SpriteSheetType" default="app::SpriteSheetType::None" /> <option id="type" type="app::SpriteSheetType" default="app::SpriteSheetType::None" />
<option id="columns" type="int" default="0" /> <option id="columns" type="int" default="0" />
<option id="rows" type="int" default="0" /> <option id="rows" type="int" default="0" />

View File

@ -757,6 +757,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
if (!window.ok()) if (!window.ok())
return; return;
docPref.spriteSheet.defined(true);
docPref.spriteSheet.type(window.spriteSheetTypeValue()); docPref.spriteSheet.type(window.spriteSheetTypeValue());
docPref.spriteSheet.columns(window.columnsValue()); docPref.spriteSheet.columns(window.columnsValue());
docPref.spriteSheet.rows(window.rowsValue()); docPref.spriteSheet.rows(window.rowsValue());
@ -778,6 +779,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
// Default preferences for future sprites // Default preferences for future sprites
DocumentPreferences& defPref(Preferences::instance().document(nullptr)); DocumentPreferences& defPref(Preferences::instance().document(nullptr));
defPref.spriteSheet = docPref.spriteSheet; defPref.spriteSheet = docPref.spriteSheet;
defPref.spriteSheet.defined(false);
if (!defPref.spriteSheet.textureFilename().empty()) if (!defPref.spriteSheet.textureFilename().empty())
defPref.spriteSheet.textureFilename.setValueAndDefault(kSpecifiedFilename); defPref.spriteSheet.textureFilename.setValueAndDefault(kSpecifiedFilename);
if (!defPref.spriteSheet.dataFilename().empty()) if (!defPref.spriteSheet.dataFilename().empty())

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2015 David Capello // Copyright (C) 2001-2016 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -51,8 +51,7 @@ void RepeatLastExportCommand::onExecute(Context* context)
DocumentPreferences& docPref = DocumentPreferences& docPref =
Preferences::instance().document(document); Preferences::instance().document(document);
params.set("ui", params.set("ui", (docPref.spriteSheet.defined() ? "0": "1"));
(docPref.spriteSheet.type() == app::SpriteSheetType::None ? "1": "0"));
} }
context->executeCommand(cmd, params); context->executeCommand(cmd, params);