mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 00:40:04 +00:00
Fix --save-as with --frame-tag or --frame-range
This commit is contained in:
parent
3e9e49caf9
commit
c38e4149e7
@ -389,10 +389,16 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
|
||||
// show "Save As" dialog
|
||||
DocumentPreferences& docPref = Preferences::instance().document(document);
|
||||
SaveAsCopyDelegate delegate(document->sprite(),
|
||||
docPref.saveCopy.resizeScale(),
|
||||
docPref.saveCopy.layer(),
|
||||
docPref.saveCopy.frameTag());
|
||||
|
||||
base::UniquePtr<SaveAsCopyDelegate> delegate;
|
||||
if (context->isUIAvailable()) {
|
||||
delegate.reset(
|
||||
new SaveAsCopyDelegate(
|
||||
document->sprite(),
|
||||
docPref.saveCopy.resizeScale(),
|
||||
docPref.saveCopy.layer(),
|
||||
docPref.saveCopy.frameTag()));
|
||||
}
|
||||
|
||||
// Is a default output filename in the preferences?
|
||||
if (!docPref.saveCopy.filename().empty()) {
|
||||
@ -401,11 +407,13 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
docPref.saveCopy.filename());
|
||||
}
|
||||
|
||||
if (saveAsDialog(context, "Save Copy As", &delegate)) {
|
||||
if (saveAsDialog(context, "Save Copy As", delegate)) {
|
||||
docPref.saveCopy.filename(document->filename());
|
||||
docPref.saveCopy.resizeScale(delegate.getResizeScale());
|
||||
docPref.saveCopy.layer(delegate.getLayers());
|
||||
docPref.saveCopy.frameTag(delegate.getFrames());
|
||||
if (delegate) {
|
||||
docPref.saveCopy.resizeScale(delegate->getResizeScale());
|
||||
docPref.saveCopy.layer(delegate->getLayers());
|
||||
docPref.saveCopy.frameTag(delegate->getFrames());
|
||||
}
|
||||
}
|
||||
|
||||
// Restore the file name.
|
||||
|
@ -141,7 +141,7 @@ FileOpROI::FileOpROI()
|
||||
|
||||
FileOpROI::FileOpROI(const app::Document* doc,
|
||||
const std::string& frameTagName,
|
||||
const doc::SelectedFrames selFrames,
|
||||
const doc::SelectedFrames& selFrames,
|
||||
const bool adjustByFrameTag)
|
||||
: m_document(doc)
|
||||
, m_frameTag(nullptr)
|
||||
@ -150,12 +150,13 @@ FileOpROI::FileOpROI(const app::Document* doc,
|
||||
if (doc) {
|
||||
m_frameTag = doc->sprite()->frameTags().getByName(frameTagName);
|
||||
if (m_frameTag) {
|
||||
if (adjustByFrameTag)
|
||||
if (m_selFrames.empty())
|
||||
m_selFrames.insert(m_frameTag->fromFrame(), m_frameTag->toFrame());
|
||||
else if (adjustByFrameTag)
|
||||
m_selFrames.displace(m_frameTag->fromFrame());
|
||||
|
||||
m_selFrames.filter(MAX(0, m_frameTag->fromFrame()),
|
||||
MIN(m_frameTag->toFrame(),
|
||||
doc->sprite()->lastFrame()));
|
||||
MIN(m_frameTag->toFrame(), doc->sprite()->lastFrame()));
|
||||
}
|
||||
// All frames if selected frames is empty
|
||||
else if (m_selFrames.empty())
|
||||
@ -848,7 +849,7 @@ Image* FileOp::sequenceImage(PixelFormat pixelFormat, int w, int h)
|
||||
}
|
||||
|
||||
if (m_seq.last_cel) {
|
||||
setError("Error: called two times \"fop_sequence_image()\".\n");
|
||||
setError("Error: called two times FileOp::sequenceImage()\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace app {
|
||||
FileOpROI();
|
||||
FileOpROI(const app::Document* doc,
|
||||
const std::string& frameTagName,
|
||||
const doc::SelectedFrames selFrames,
|
||||
const doc::SelectedFrames& selFrames,
|
||||
const bool adjustByFrameTag);
|
||||
|
||||
const app::Document* document() const { return m_document; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user