Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

get layer name encoding from preference

Keisuke Ogaki5ff9a72ca5e7
diff --git a/toonz/sources/image/CMakeLists.txt b/toonz/sources/image/CMakeLists.txt
index f36123efa..2bac510af 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 6d00c14ae..3521f8a6a 100644
--- a/toonz/sources/image/psd/tiio_psd.cpp
+++ b/toonz/sources/image/psd/tiio_psd.cpp
@@ -1,6 +1,7 @@
#include "tiio_psd.h"
#include "trasterimage.h"
#include "timageinfo.h"
+#include "toonz/preferences.h"
#include <QtCore>
@@ -39,7 +40,7 @@ TLevelReaderPsd::TLevelReaderPsd(const TFilePath &path)
#ifdef REF_LAYER_BY_NAME
if (layerStr != "frames") {
- QTextCodec* layerNameCodec = QTextCodec::codecForName( "SJIS" );
+ QTextCodec* layerNameCodec = QTextCodec::codecForName( Preferences::instance()->getLayerNameEncoding().c_str() );
TPSDParser psdparser(m_path);
m_layerId = psdparser.getLevelIdByName(layerNameCodec->fromUnicode(layerStr).toStdString());
} else
diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h
index 7f02001c7..f1cbebaf0 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 548d44240..3be22b37c 100644
--- a/toonz/sources/toonzlib/txshsimplelevel.cpp
+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp
@@ -1099,7 +1099,7 @@ 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( "SJIS" );
+ QTextCodec* layerNameCodec = QTextCodec::codecForName( Preferences::instance()->getLayerNameEncoding().c_str() );
if (hasLayerId) {
// An explicit photoshop layer id must be converted to the associated level name