mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Adjust export dialog UI to support "Play Subtags & Repetitions" checkbox (fix #4173)
This commit is contained in:
parent
da7f51ee43
commit
4d8fc12351
@ -546,6 +546,7 @@
|
||||
<option id="ani_dir" type="doc::AniDir" default="doc::AniDir::FORWARD" />
|
||||
<option id="apply_pixel_ratio" type="bool" default="false" />
|
||||
<option id="for_twitter" type="bool" default="false" />
|
||||
<option id="play_subtags" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="sprite_sheet">
|
||||
<option id="defined" type="bool" default="false" />
|
||||
|
@ -657,6 +657,7 @@ area = Area:
|
||||
layers = Layers:
|
||||
frames = Frames:
|
||||
anidir = Animation Direction:
|
||||
play_subtags = Play Subtags && Repetitions
|
||||
pixel_ratio = Apply pixel ratio
|
||||
for_twitter = Export for Twitter
|
||||
for_twitter_tooltip = Adjust the duration of the last frame to 1/4 so\nTwitter reproduces the animation correctly
|
||||
|
@ -37,6 +37,8 @@
|
||||
<label id="anidir_label" text="@.anidir" />
|
||||
<combobox id="anidir" text="" cell_align="horizontal" cell_hspan="2" />
|
||||
|
||||
<check id="play_subtags" text="@.play_subtags" cell_hspan="3" />
|
||||
|
||||
<check id="pixel_ratio" text="@.pixel_ratio" cell_hspan="3" />
|
||||
|
||||
<hbox cell_hspan="3">
|
||||
|
@ -385,6 +385,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
double scale = params().scale();
|
||||
gfx::Rect bounds = params().bounds();
|
||||
doc::AniDir aniDirValue = params().aniDir();
|
||||
bool isPlaySubtags = params().playSubtags();
|
||||
bool isForTwitter = false;
|
||||
|
||||
#if ENABLE_UI
|
||||
@ -462,6 +463,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
applyPixelRatio = win.applyPixelRatio();
|
||||
aniDirValue = win.aniDirValue();
|
||||
isForTwitter = win.isForTwitter();
|
||||
isPlaySubtags = win.isPlaySubtags();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -534,6 +536,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
params().aniDir(aniDirValue);
|
||||
if (!bounds.isEmpty())
|
||||
params().bounds(bounds);
|
||||
params().playSubtags(isPlaySubtags);
|
||||
|
||||
// TODO This should be set as options for the specific encoder
|
||||
GifEncoderDurationFix fixGif(isForTwitter);
|
||||
|
@ -33,6 +33,7 @@ namespace app {
|
||||
Param<bool> ignoreEmpty { this, false, "ignoreEmpty" };
|
||||
Param<double> scale { this, 1.0, "scale" };
|
||||
Param<gfx::Rect> bounds { this, gfx::Rect(), "bounds" };
|
||||
Param<bool> playSubtags { this, false, "playSubtags" };
|
||||
};
|
||||
|
||||
class SaveFileBaseCommand : public CommandWithNewParams<SaveFileParams> {
|
||||
|
@ -59,12 +59,13 @@ ExportFileWindow::ExportFileWindow(const Doc* doc)
|
||||
pixelRatio()->setSelected(m_docPref.saveCopy.applyPixelRatio());
|
||||
forTwitter()->setSelected(m_docPref.saveCopy.forTwitter());
|
||||
adjustResize()->setVisible(false);
|
||||
|
||||
playSubtags()->setSelected(m_docPref.saveCopy.playSubtags());
|
||||
// Here we don't call updateAniDir() because it's already filled and
|
||||
// set by the function fill_anidir_combobox(). So if the user
|
||||
// exported a tag with a specific AniDir, we want to keep the option
|
||||
// in the preference (instead of the tag's AniDir).
|
||||
//updateAniDir();
|
||||
updatePlaySubtags();
|
||||
|
||||
updateAdjustResizeButton();
|
||||
|
||||
@ -82,7 +83,10 @@ ExportFileWindow::ExportFileWindow(const Doc* doc)
|
||||
});
|
||||
|
||||
resize()->Change.connect([this]{ updateAdjustResizeButton(); });
|
||||
frames()->Change.connect([this]{ updateAniDir(); });
|
||||
frames()->Change.connect([this]{
|
||||
updateAniDir();
|
||||
updatePlaySubtags();
|
||||
});
|
||||
forTwitter()->Click.connect([this]{ updateAdjustResizeButton(); });
|
||||
adjustResize()->Click.connect([this]{ onAdjustResize(); });
|
||||
ok()->Click.connect([this]{ onOK(); });
|
||||
@ -105,6 +109,7 @@ void ExportFileWindow::savePref()
|
||||
m_docPref.saveCopy.frameTag(framesValue());
|
||||
m_docPref.saveCopy.applyPixelRatio(applyPixelRatio());
|
||||
m_docPref.saveCopy.forTwitter(isForTwitter());
|
||||
m_docPref.saveCopy.playSubtags(isPlaySubtags());
|
||||
}
|
||||
|
||||
std::string ExportFileWindow::outputFilenameValue() const
|
||||
@ -145,6 +150,11 @@ doc::AniDir ExportFileWindow::aniDirValue() const
|
||||
return (doc::AniDir)anidir()->getSelectedItemIndex();
|
||||
}
|
||||
|
||||
bool ExportFileWindow::isPlaySubtags() const
|
||||
{
|
||||
return playSubtags()->isSelected() && framesValue() != kSelectedFrames;
|
||||
}
|
||||
|
||||
bool ExportFileWindow::applyPixelRatio() const
|
||||
{
|
||||
return pixelRatio()->isSelected();
|
||||
@ -205,6 +215,13 @@ void ExportFileWindow::updateAniDir()
|
||||
anidir()->setSelectedItemIndex(int(doc::AniDir::FORWARD));
|
||||
}
|
||||
|
||||
void ExportFileWindow::updatePlaySubtags()
|
||||
{
|
||||
std::string framesValue = this->framesValue();
|
||||
playSubtags()->setVisible(framesValue != kSelectedFrames);
|
||||
layout();
|
||||
}
|
||||
|
||||
void ExportFileWindow::updateAdjustResizeButton()
|
||||
{
|
||||
// Calculate a better size for Twitter
|
||||
|
@ -33,6 +33,7 @@ namespace app {
|
||||
int layersIndex() const;
|
||||
std::string framesValue() const;
|
||||
doc::AniDir aniDirValue() const;
|
||||
bool isPlaySubtags() const;
|
||||
bool applyPixelRatio() const;
|
||||
bool isForTwitter() const;
|
||||
|
||||
@ -47,6 +48,7 @@ namespace app {
|
||||
void updateOutputFilenameEntry();
|
||||
void onOutputFilenameEntryChange();
|
||||
void updateAniDir();
|
||||
void updatePlaySubtags();
|
||||
void updateAdjustResizeButton();
|
||||
void onAdjustResize();
|
||||
void onOK();
|
||||
|
Loading…
x
Reference in New Issue
Block a user