Request frame duration when opening sequences

master
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 title = Notice
description = Do you want to load the following files as an animation? description = Do you want to load the following files as an animation?
repeat = Do the same for other files repeat = Do the same for other files
duration = Duration
agree = &Agree agree = &Agree
skip = &Skip skip = &Skip

View File

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

View File

@ -385,6 +385,10 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context,
window.files()->getSelectedChild() != nullptr); 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(); window.openWindowInForeground();
// Don't show this alert again. // Don't show this alert again.
@ -832,6 +836,8 @@ void FileOp::operate(IFileOpProgress* progress)
#endif #endif
} }
m_document->sprite()->setFrameDuration(frame, m_seq.duration);
++frame; ++frame;
m_seq.progress_offset += m_seq.progress_fraction; m_seq.progress_offset += m_seq.progress_fraction;
} }
@ -1395,6 +1401,7 @@ FileOp::FileOp(FileOpType type,
m_seq.frame = frame_t(0); m_seq.frame = frame_t(0);
m_seq.layer = nullptr; m_seq.layer = nullptr;
m_seq.last_cel = nullptr; m_seq.last_cel = nullptr;
m_seq.duration = 100;
m_seq.flags = 0; m_seq.flags = 0;
} }

View File

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