From 53dcabdee1156562930da67c335d87cdb4e1d963 Mon Sep 17 00:00:00 2001 From: Rodney Date: Feb 21 2022 23:22:29 +0000 Subject: Merge pull request #4268 from justburner/GIFFixOldVersions Fix GIF rendering on older versions --- diff --git a/toonz/sources/image/ffmpeg/tiio_gif.cpp b/toonz/sources/image/ffmpeg/tiio_gif.cpp index 5a53949..c1f0381 100644 --- a/toonz/sources/image/ffmpeg/tiio_gif.cpp +++ b/toonz/sources/image/ffmpeg/tiio_gif.cpp @@ -134,6 +134,8 @@ TLevelWriterGif::~TLevelWriterGif() { break; } + preIArgs << "-r"; + preIArgs << QString::number(framerate); preIArgs << "-v"; preIArgs << "warning"; postIArgs << "-vf"; @@ -285,6 +287,7 @@ TImageP TLevelReaderGif::load(int frameIndex) { Tiio::GifWriterProperties::GifWriterProperties() : m_scale("Scale", 1, 100, 100) , m_looping("Looping", true) + , m_palette("Generate Palette", true) , m_mode("Mode") , m_maxcolors("Max Colors", 2, 256, 256) { @@ -318,8 +321,12 @@ Tiio::GifWriterProperties::GifWriterProperties() m_mode.setItemUIName(L"NEW3", tr("New Pal Per Frame + Bayer1 Dither")); m_mode.setItemUIName(L"NOPAL", tr("Opaque, Dither, 256 Colors Only")); + // Doesn't make Generate Palette property visible in the popup + m_palette.setVisible(false); + bind(m_scale); bind(m_looping); + bind(m_palette); bind(m_mode); bind(m_maxcolors); } diff --git a/toonz/sources/image/ffmpeg/tiio_gif.h b/toonz/sources/image/ffmpeg/tiio_gif.h index 7f8d315..64b5afd 100644 --- a/toonz/sources/image/ffmpeg/tiio_gif.h +++ b/toonz/sources/image/ffmpeg/tiio_gif.h @@ -82,6 +82,7 @@ class GifWriterProperties : public TPropertyGroup { public: TIntProperty m_scale; TBoolProperty m_looping; + TBoolProperty m_palette; TEnumProperty m_mode; TIntProperty m_maxcolors; diff --git a/toonz/sources/include/tproperty.h b/toonz/sources/include/tproperty.h index 86a085e..d317a61 100644 --- a/toonz/sources/include/tproperty.h +++ b/toonz/sources/include/tproperty.h @@ -93,11 +93,15 @@ public: std::string getId() const { return m_id; } void setId(std::string id) { m_id = id; } + bool getVisible() const { return m_visible; } + void setVisible(bool state) { m_visible = state; } + private: std::string m_name; QString m_qstringName; std::string m_id; std::vector m_listeners; + bool m_visible; }; //--------------------------------------------------------- diff --git a/toonz/sources/toonz/formatsettingspopups.cpp b/toonz/sources/toonz/formatsettingspopups.cpp index de8ab31..4838380 100644 --- a/toonz/sources/toonz/formatsettingspopups.cpp +++ b/toonz/sources/toonz/formatsettingspopups.cpp @@ -76,15 +76,17 @@ FormatSettingsPopup::FormatSettingsPopup(QWidget *parent, if (m_props) { int i = 0; for (i = 0; i < m_props->getPropertyCount(); i++) { - if (dynamic_cast(m_props->getProperty(i))) + TProperty *prop = m_props->getProperty(i); + if (prop && !prop->getVisible()) continue; + if (dynamic_cast(prop)) buildPropertyComboBox(i, m_props); - else if (dynamic_cast(m_props->getProperty(i))) + else if (dynamic_cast(prop)) buildValueField(i, m_props); - else if (dynamic_cast(m_props->getProperty(i))) + else if (dynamic_cast(prop)) buildDoubleField(i, m_props); - else if (dynamic_cast(m_props->getProperty(i))) + else if (dynamic_cast(prop)) buildPropertyCheckBox(i, m_props); - else if (dynamic_cast(m_props->getProperty(i))) + else if (dynamic_cast(prop)) buildPropertyLineEdit(i, m_props); else assert(false);