Merge branch 'master' into blender2.8

This commit is contained in:
2018-05-05 14:42:10 +02:00
5 changed files with 259 additions and 62 deletions

View File

@@ -1806,49 +1806,3 @@ PyObject *BPyInit_idprop(void)
return mod;
}
/* -------------------------------------------------------------------- */
/* debug only function */
char *IDP_reprN(const IDProperty *prop)
{
if (prop == NULL) {
return BLI_strdup("None");
}
PyGILState_STATE gilstate;
bool use_gil = true; /* !PyC_IsInterpreterActive(); */
PyObject *ret_dict;
PyObject *ret_str;
if (use_gil) {
gilstate = PyGILState_Ensure();
}
/* Note: non-const cast is safe here since we only repr the result. */
/* to_dict() */
ret_dict = BPy_IDGroup_MapDataToPy((IDProperty *)prop);
ret_str = PyObject_Repr(ret_dict);
Py_DECREF(ret_dict);
Py_ssize_t res_str_len = 0;
char *res_str_bytes = _PyUnicode_AsStringAndSize(ret_str, &res_str_len);
res_str_bytes = BLI_strdupn(res_str_bytes, res_str_len);
Py_DECREF(ret_str);
if (use_gil) {
PyGILState_Release(gilstate);
}
return res_str_bytes;
}
void IDP_print(const IDProperty *prop)
{
char *repr = IDP_reprN(prop);
printf("IDProperty(%p): %s\n", prop, repr);
MEM_freeN(repr);
}