forked from blender/blender
Moved check of existing MaterialX addon from bpy_hydra.py to material.cc and log warning only once. #83
@ -121,17 +121,19 @@ void MaterialData::export_mtlx()
|
|||||||
|
|
||||||
if (!matx_addon_checked) {
|
if (!matx_addon_checked) {
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
/* Adding second check into the lock, good practice to make this fully correct */
|
||||||
|
if (!matx_addon_checked) {
|
||||||
|
PyObject *mx_module = PyImport_ImportModule("materialx");
|
||||||
|
has_matx_addon = mx_module != nullptr;
|
||||||
|
Py_XDECREF(mx_module);
|
||||||
|
|
||||||
PyObject *mx_module = PyImport_ImportModule("materialx");
|
if (!has_matx_addon) {
|
||||||
has_matx_addon = mx_module != nullptr;
|
PyErr_Print();
|
||||||
Py_XDECREF(mx_module);
|
CLOG_WARN(LOG_HYDRA_SCENE, "No MaterialX addon, materials won't be exported.");
|
||||||
|
}
|
||||||
if (!has_matx_addon) {
|
matx_addon_checked = true;
|
||||||
PyErr_Print();
|
|
||||||
CLOG_WARN(LOG_RENDER_HYDRA_SCENE, "No MaterialX addon, materials won't be exported.");
|
|
||||||
}
|
}
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
matx_addon_checked = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_matx_addon) {
|
if (!has_matx_addon) {
|
||||||
|
Loading…
Reference in New Issue
Block a user