OpenToonz - An open-source full-featured 2D animation creation software
C
load palette global name on loading level (#2299)
shun-iwasawa995cf619d43b
diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cppindex bd696828a..c94d9eb05 100644--- a/toonz/sources/image/tzl/tiio_tzl.cpp+++ b/toonz/sources/image/tzl/tiio_tzl.cpp@@ -1409,8 +1409,15 @@ void TLevelReaderTzl::readPalette() {TPalette *palette = 0;if (is && fs.doesExist()) {- is >> p;- palette = dynamic_cast<TPalette *>(p);+ std::string tagName;+ if (is.matchTag(tagName) && tagName == "palette") {+ std::string gname;+ is.getTagParam("name", gname);+ palette = new TPalette();+ palette->loadData(is);+ palette->setGlobalName(::to_wstring(gname));+ is.matchEndTag();+ }}if (!palette) {diff --git a/toonz/sources/toonzlib/txshpalettelevel.cpp b/toonz/sources/toonzlib/txshpalettelevel.cppindex 942720cc5..e24db02d7 100644--- a/toonz/sources/toonzlib/txshpalettelevel.cpp+++ b/toonz/sources/toonzlib/txshpalettelevel.cpp@@ -77,12 +77,20 @@ void TXshPaletteLevel::load() {TFileStatus fs(path);TPersist *p = 0;TIStream is(path);+ TPalette *palette = nullptr;if (is && fs.doesExist()) {- is >> p;- TPalette *palette = dynamic_cast<TPalette *>(p);- palette->setPaletteName(path.getWideName());- setPalette(palette);+ std::string tagName;+ if (is.matchTag(tagName) && tagName == "palette") {+ std::string gname;+ is.getTagParam("name", gname);+ palette = new TPalette();+ palette->loadData(is);+ palette->setGlobalName(::to_wstring(gname));+ is.matchEndTag();+ palette->setPaletteName(path.getWideName());+ setPalette(palette);+ }}assert(m_palette);}