diff --git a/toonz/sources/image/CMakeLists.txt b/toonz/sources/image/CMakeLists.txt index f36123e..2bac510 100644 --- a/toonz/sources/image/CMakeLists.txt +++ b/toonz/sources/image/CMakeLists.txt @@ -85,7 +85,7 @@ if(WIN32) endif() endif() -_find_toonz_library(TNZLIBS "tnzcore;tnzbase") +_find_toonz_library(TNZLIBS "tnzcore;tnzbase;toonzlib") if(WIN32) set(EXTRA_LIBS diff --git a/toonz/sources/image/psd/tiio_psd.cpp b/toonz/sources/image/psd/tiio_psd.cpp index 1e48db3..3521f8a 100644 --- a/toonz/sources/image/psd/tiio_psd.cpp +++ b/toonz/sources/image/psd/tiio_psd.cpp @@ -1,8 +1,9 @@ - - #include "tiio_psd.h" #include "trasterimage.h" #include "timageinfo.h" +#include "toonz/preferences.h" + +#include // forward declaration //class TImageReaderLayerPsd; @@ -39,8 +40,9 @@ TLevelReaderPsd::TLevelReaderPsd(const TFilePath &path) #ifdef REF_LAYER_BY_NAME if (layerStr != "frames") { + QTextCodec* layerNameCodec = QTextCodec::codecForName( Preferences::instance()->getLayerNameEncoding().c_str() ); TPSDParser psdparser(m_path); - m_layerId = psdparser.getLevelIdByName(layerStr.toStdString()); + m_layerId = psdparser.getLevelIdByName(layerNameCodec->fromUnicode(layerStr).toStdString()); } else m_layerId = layerStr.toInt(); #else diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 7f02001..f1cbeba 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -428,6 +428,7 @@ public: int getShmSeg() const { return m_shmseg; } //! \sa The \p sysctl unix command. int getShmAll() const { return m_shmall; } //! \sa The \p sysctl unix command. int getShmMni() const { return m_shmmni; } //! \sa The \p sysctl unix command. + std::string getLayerNameEncoding() const {return m_layerNameEncoding; }; Q_SIGNALS : @@ -537,6 +538,7 @@ private: int m_paletteTypeOnLoadRasterImageAsColorModel; bool m_showKeyframesOnXsheetCellArea; + std::string m_layerNameEncoding = "SJIS"; // Fixed to SJIS for now. You can add interface if you wanna change encoding. private: Preferences(); diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index ef5bdda..3be22b3 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -1,5 +1,3 @@ - - #include "toonz/txshsimplelevel.h" #include "imagebuilders.h" @@ -40,6 +38,7 @@ #include #include #include +#include #include "../common/psdlib/psd.h" @@ -1100,14 +1099,14 @@ TFilePath getLevelPathAndSetNameWithPsdLevelName(TXshSimpleLevel *xshLevel) if (list.size() >= 2 && list.at(1) != "frames") { bool hasLayerId; int layid = list.at(1).toInt(&hasLayerId); + QTextCodec* layerNameCodec = QTextCodec::codecForName( Preferences::instance()->getLayerNameEncoding().c_str() ); if (hasLayerId) { // An explicit photoshop layer id must be converted to the associated level name TPSDParser psdparser(xshLevel->getScene()->decodeFilePath(retfp)); std::string levelName = psdparser.getLevelNameWithCounter(layid); // o_o what about UNICODE names?? - list[1] = QString::fromStdString(levelName); - + list[1] = layerNameCodec->toUnicode(levelName.c_str()); std::wstring wLevelName = list.join("#").toStdWString(); retfp = retfp.withName(wLevelName);