diff --git a/data/strings/en.ini b/data/strings/en.ini index ad380ddd3..9e1d54e2c 100644 --- a/data/strings/en.ini +++ b/data/strings/en.ini @@ -115,6 +115,8 @@ file_format_indexed_mode = Indexed mode file_format_layers = Layers file_format_palette_changes = Palette changes between frames 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 = <<m_format->support(FILE_GIF_ANI_LIMITATIONS)) { + bool durationLessThan20 = false; + bool milisecPrecision = false; + for (int i=0; idocument()->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 if (!warnings.empty()) { #ifdef ENABLE_UI diff --git a/src/app/file/file_format.h b/src/app/file/file_format.h index 6503d1552..a9ddbaa8d 100644 --- a/src/app/file/file_format.h +++ b/src/app/file/file_format.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2022 Igara Studio S.A. +// Copyright (C) 2019-2023 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // 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_PALETTE_WITH_ALPHA 0x00004000 #define FILE_ENCODE_ABSTRACT_IMAGE 0x00008000 // Use the new FileAbstractImage +#define FILE_GIF_ANI_LIMITATIONS 0x00010000 namespace app { diff --git a/src/app/file/gif_format.cpp b/src/app/file/gif_format.cpp index 5e568d50a..78ee43a77 100644 --- a/src/app/file/gif_format.cpp +++ b/src/app/file/gif_format.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2022 Igara Studio S.A. +// Copyright (C) 2018-2023 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -94,7 +94,8 @@ class GifFormat : public FileFormat { FILE_SUPPORT_FRAMES | FILE_SUPPORT_PALETTES | FILE_SUPPORT_GET_FORMAT_OPTIONS | - FILE_ENCODE_ABSTRACT_IMAGE; + FILE_ENCODE_ABSTRACT_IMAGE | + FILE_GIF_ANI_LIMITATIONS; } bool onLoad(FileOp* fop) override;