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