mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Add frame duration warnings saving animated GIF files (fix #1504)
This commit is contained in:
parent
63de8edfdf
commit
18c56ae638
@ -115,6 +115,8 @@ file_format_indexed_mode = Indexed mode
|
|||||||
file_format_layers = Layers
|
file_format_layers = Layers
|
||||||
file_format_palette_changes = Palette changes between frames
|
file_format_palette_changes = Palette changes between frames
|
||||||
file_format_rgb_mode = RGB mode
|
file_format_rgb_mode = RGB mode
|
||||||
|
file_format_20ms_min_duration = Frame duration less than 20ms
|
||||||
|
file_format_10ms_duration_precision = Frame duration other than a multiple of 10ms
|
||||||
invalid_chars_in_filename = <<<END
|
invalid_chars_in_filename = <<<END
|
||||||
Error
|
Error
|
||||||
<<The file name cannot contain the following character(s):
|
<<The file name cannot contain the following character(s):
|
||||||
|
@ -607,6 +607,22 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GIF doesn't support frame duration less than 20ms, also
|
||||||
|
// the duration of each frame will be floored to 10ms multiples.
|
||||||
|
if (fop->m_format->support(FILE_GIF_ANI_LIMITATIONS)) {
|
||||||
|
bool durationLessThan20 = false;
|
||||||
|
bool milisecPrecision = false;
|
||||||
|
for (int i=0; i<fop->document()->sprite()->totalFrames(); ++i) {
|
||||||
|
int frameDuration = fop->document()->sprite()->frameDuration(i);
|
||||||
|
if (frameDuration < 20) durationLessThan20 = true;
|
||||||
|
if (frameDuration % 10) milisecPrecision = true;
|
||||||
|
}
|
||||||
|
if (durationLessThan20)
|
||||||
|
warnings += "<<- " + Strings::alerts_file_format_20ms_min_duration();
|
||||||
|
if (milisecPrecision)
|
||||||
|
warnings += "<<- " + Strings::alerts_file_format_10ms_duration_precision();
|
||||||
|
}
|
||||||
|
|
||||||
// Show the confirmation alert
|
// Show the confirmation alert
|
||||||
if (!warnings.empty()) {
|
if (!warnings.empty()) {
|
||||||
#ifdef ENABLE_UI
|
#ifdef ENABLE_UI
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
// Copyright (C) 2019-2023 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -31,6 +31,7 @@
|
|||||||
#define FILE_SUPPORT_BIG_PALETTES 0x00002000 // Palettes w/more than 256 colors
|
#define FILE_SUPPORT_BIG_PALETTES 0x00002000 // Palettes w/more than 256 colors
|
||||||
#define FILE_SUPPORT_PALETTE_WITH_ALPHA 0x00004000
|
#define FILE_SUPPORT_PALETTE_WITH_ALPHA 0x00004000
|
||||||
#define FILE_ENCODE_ABSTRACT_IMAGE 0x00008000 // Use the new FileAbstractImage
|
#define FILE_ENCODE_ABSTRACT_IMAGE 0x00008000 // Use the new FileAbstractImage
|
||||||
|
#define FILE_GIF_ANI_LIMITATIONS 0x00010000
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -94,7 +94,8 @@ class GifFormat : public FileFormat {
|
|||||||
FILE_SUPPORT_FRAMES |
|
FILE_SUPPORT_FRAMES |
|
||||||
FILE_SUPPORT_PALETTES |
|
FILE_SUPPORT_PALETTES |
|
||||||
FILE_SUPPORT_GET_FORMAT_OPTIONS |
|
FILE_SUPPORT_GET_FORMAT_OPTIONS |
|
||||||
FILE_ENCODE_ABSTRACT_IMAGE;
|
FILE_ENCODE_ABSTRACT_IMAGE |
|
||||||
|
FILE_GIF_ANI_LIMITATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool onLoad(FileOp* fop) override;
|
bool onLoad(FileOp* fop) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user