forked from bartvdbraak/blender
Fix T72789: Mantaflow cache doesn't work with non-latin cache directory
Root of the problem was that Manta's Python API was converting to and from Latin1 instead of UTF8.
This commit is contained in:
parent
517870a4a1
commit
39ae4804a8
10
extern/mantaflow/helper/pwrapper/pconvert.cpp
vendored
10
extern/mantaflow/helper/pwrapper/pconvert.cpp
vendored
@ -144,7 +144,12 @@ template<> int fromPy<int>(PyObject *obj)
|
|||||||
template<> string fromPy<string>(PyObject *obj)
|
template<> string fromPy<string>(PyObject *obj)
|
||||||
{
|
{
|
||||||
if (PyUnicode_Check(obj))
|
if (PyUnicode_Check(obj))
|
||||||
|
#ifdef BLENDER
|
||||||
|
// Blender is completely UTF-8 based
|
||||||
|
return PyBytes_AsString(PyUnicode_AsUTF8String(obj));
|
||||||
|
#else
|
||||||
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
|
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
|
||||||
|
#endif
|
||||||
#if PY_MAJOR_VERSION <= 2
|
#if PY_MAJOR_VERSION <= 2
|
||||||
else if (PyString_Check(obj))
|
else if (PyString_Check(obj))
|
||||||
return PyString_AsString(obj);
|
return PyString_AsString(obj);
|
||||||
@ -155,7 +160,12 @@ template<> string fromPy<string>(PyObject *obj)
|
|||||||
template<> const char *fromPy<const char *>(PyObject *obj)
|
template<> const char *fromPy<const char *>(PyObject *obj)
|
||||||
{
|
{
|
||||||
if (PyUnicode_Check(obj))
|
if (PyUnicode_Check(obj))
|
||||||
|
#ifdef BLENDER
|
||||||
|
// Blender is completely UTF-8 based
|
||||||
|
return PyBytes_AsString(PyUnicode_AsUTF8String(obj));
|
||||||
|
#else
|
||||||
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
|
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
|
||||||
|
#endif
|
||||||
#if PY_MAJOR_VERSION <= 2
|
#if PY_MAJOR_VERSION <= 2
|
||||||
else if (PyString_Check(obj))
|
else if (PyString_Check(obj))
|
||||||
return PyString_AsString(obj);
|
return PyString_AsString(obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user