Material: Use "et" format unit to parse path
This commit is contained in:
committed by
Chris Hennes
parent
723159d2f5
commit
f19735b702
@@ -71,17 +71,20 @@ PyObject* MaterialManagerPy::getMaterial(PyObject* args)
|
||||
|
||||
PyObject* MaterialManagerPy::getMaterialByPath(PyObject* args)
|
||||
{
|
||||
char* path {};
|
||||
char* path;
|
||||
const char* lib = "";
|
||||
if (!PyArg_ParseTuple(args, "s|s", &path, &lib)) {
|
||||
if (!PyArg_ParseTuple(args, "et|s", "utf-8", &path, &lib)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string utf8Path = std::string(path);
|
||||
PyMem_Free(path);
|
||||
|
||||
QString libPath(QString::fromStdString(lib));
|
||||
if (!libPath.isEmpty()) {
|
||||
try {
|
||||
auto material =
|
||||
getMaterialManagerPtr()->getMaterialByPath(QString::fromStdString(path), libPath);
|
||||
getMaterialManagerPtr()->getMaterialByPath(QString::fromUtf8(utf8Path.c_str()), libPath);
|
||||
return new MaterialPy(new Material(*material));
|
||||
}
|
||||
catch (const MaterialNotFound&) {
|
||||
@@ -95,7 +98,7 @@ PyObject* MaterialManagerPy::getMaterialByPath(PyObject* args)
|
||||
}
|
||||
|
||||
try {
|
||||
auto material = getMaterialManagerPtr()->getMaterialByPath(QString::fromStdString(path));
|
||||
auto material = getMaterialManagerPtr()->getMaterialByPath(QString::fromUtf8(utf8Path.c_str()));
|
||||
return new MaterialPy(new Material(*material));
|
||||
}
|
||||
catch (const MaterialNotFound&) {
|
||||
|
||||
Reference in New Issue
Block a user