OpenToonz - An open-source full-featured 2D animation creation software
C
:lipstick: force encoding in SJIS for psd layer name
Keisuke Ogaki8b06ffc4e33e
diff --git a/toonz/sources/image/psd/tiio_psd.cpp b/toonz/sources/image/psd/tiio_psd.cppindex 1e48db30e..6d00c14ae 100644--- a/toonz/sources/image/psd/tiio_psd.cpp+++ b/toonz/sources/image/psd/tiio_psd.cpp@@ -1,9 +1,9 @@--#include "tiio_psd.h"#include "trasterimage.h"#include "timageinfo.h"+#include <QtCore>+// forward declaration//class TImageReaderLayerPsd;@@ -39,8 +39,9 @@ TLevelReaderPsd::TLevelReaderPsd(const TFilePath &path)#ifdef REF_LAYER_BY_NAMEif (layerStr != "frames") {+ QTextCodec* layerNameCodec = QTextCodec::codecForName( "SJIS" );TPSDParser psdparser(m_path);- m_layerId = psdparser.getLevelIdByName(layerStr.toStdString());+ m_layerId = psdparser.getLevelIdByName(layerNameCodec->fromUnicode(layerStr).toStdString());} elsem_layerId = layerStr.toInt();#elsediff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cppindex ef5bddadd..548d44240 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 <QDir>#include <QRegExp>#include <QMessageBox>+#include <QtCore>#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( "SJIS" );if (hasLayerId) {// An explicit photoshop layer id must be converted to the associated level nameTPSDParser 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);