Request frame duration when opening sequences

This commit is contained in:
lampysprites 2022-08-22 18:15:24 +07:00 committed by David Capello
parent 277e24c799
commit c67902dee3
4 changed files with 13 additions and 0 deletions

View File

@ -1033,6 +1033,7 @@ double_high = Double-high Pixels (1:2)
title = Notice
description = Do you want to load the following files as an animation?
repeat = Do the same for other files
duration = Duration
agree = &Agree
skip = &Skip

View File

@ -8,6 +8,10 @@
<view expansive="true" id="view" minwidth="128" minheight="64">
<listbox id="files" multiselect="true" />
</view>
<hbox>
<label text="@.duration" />
<expr text="0" id="duration" suffix="ms" />
</hbox>
<separator horizontal="true" />
<check id="repeat" text="@.repeat" />
<check id="dont_show" text="@general.dont_show" />

View File

@ -385,6 +385,10 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context,
window.files()->getSelectedChild() != nullptr);
});
window.duration()->setTextf("%d", fop->m_seq.duration);
window.duration()->Change.connect(
[&]() { fop->m_seq.duration = window.duration()->textInt(); });
window.openWindowInForeground();
// Don't show this alert again.
@ -832,6 +836,8 @@ void FileOp::operate(IFileOpProgress* progress)
#endif
}
m_document->sprite()->setFrameDuration(frame, m_seq.duration);
++frame;
m_seq.progress_offset += m_seq.progress_fraction;
}
@ -1395,6 +1401,7 @@ FileOp::FileOp(FileOpType type,
m_seq.frame = frame_t(0);
m_seq.layer = nullptr;
m_seq.last_cel = nullptr;
m_seq.duration = 100;
m_seq.flags = 0;
}

View File

@ -311,6 +311,7 @@ namespace app {
bool has_alpha;
LayerImage* layer;
Cel* last_cel;
int duration;
// Flags after the user choose what to do with the sequence.
int flags;
} m_seq;