diff options
Diffstat (limited to 'source/blender/python/intern/bpy_app_oiio.c')
-rw-r--r-- | source/blender/python/intern/bpy_app_oiio.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/source/blender/python/intern/bpy_app_oiio.c b/source/blender/python/intern/bpy_app_oiio.c index 5701a8def92..05c192f6e2e 100644 --- a/source/blender/python/intern/bpy_app_oiio.c +++ b/source/blender/python/intern/bpy_app_oiio.c @@ -32,76 +32,77 @@ static PyTypeObject BlenderAppOIIOType; static PyStructSequence_Field app_oiio_info_fields[] = { - {(char *)"supported", (char *)("Boolean, True when Blender is built with OpenImageIO support")}, - {(char *)("version"), (char *)("The OpenImageIO version as a tuple of 3 numbers")}, - {(char *)("version_string"), (char *)("The OpenImageIO version formatted as a string")}, - {NULL}, + {(char *)"supported", + (char *)("Boolean, True when Blender is built with OpenImageIO support")}, + {(char *)("version"), (char *)("The OpenImageIO version as a tuple of 3 numbers")}, + {(char *)("version_string"), (char *)("The OpenImageIO version formatted as a string")}, + {NULL}, }; static PyStructSequence_Desc app_oiio_info_desc = { - (char *)"bpy.app.oiio", /* name */ - (char *)"This module contains information about OpeImageIO blender is linked against", /* doc */ - app_oiio_info_fields, /* fields */ - ARRAY_SIZE(app_oiio_info_fields) - 1, + (char *)"bpy.app.oiio", /* name */ + (char + *)"This module contains information about OpeImageIO blender is linked against", /* doc */ + app_oiio_info_fields, /* fields */ + ARRAY_SIZE(app_oiio_info_fields) - 1, }; static PyObject *make_oiio_info(void) { - PyObject *oiio_info; - int pos = 0; + PyObject *oiio_info; + int pos = 0; #ifdef WITH_OPENIMAGEIO - int curversion; + int curversion; #endif - oiio_info = PyStructSequence_New(&BlenderAppOIIOType); - if (oiio_info == NULL) { - return NULL; - } + oiio_info = PyStructSequence_New(&BlenderAppOIIOType); + if (oiio_info == NULL) { + return NULL; + } #ifndef WITH_OPENIMAGEIO -#define SetStrItem(str) \ - PyStructSequence_SET_ITEM(oiio_info, pos++, PyUnicode_FromString(str)) +# define SetStrItem(str) PyStructSequence_SET_ITEM(oiio_info, pos++, PyUnicode_FromString(str)) #endif -#define SetObjItem(obj) \ - PyStructSequence_SET_ITEM(oiio_info, pos++, obj) +#define SetObjItem(obj) PyStructSequence_SET_ITEM(oiio_info, pos++, obj) #ifdef WITH_OPENIMAGEIO - curversion = OIIO_getVersionHex(); - SetObjItem(PyBool_FromLong(1)); - SetObjItem(PyC_Tuple_Pack_I32(curversion / 10000, (curversion / 100) % 100, curversion % 100)); - SetObjItem(PyUnicode_FromFormat("%2d, %2d, %2d", - curversion / 10000, (curversion / 100) % 100, curversion % 100)); + curversion = OIIO_getVersionHex(); + SetObjItem(PyBool_FromLong(1)); + SetObjItem(PyC_Tuple_Pack_I32(curversion / 10000, (curversion / 100) % 100, curversion % 100)); + SetObjItem(PyUnicode_FromFormat( + "%2d, %2d, %2d", curversion / 10000, (curversion / 100) % 100, curversion % 100)); #else - SetObjItem(PyBool_FromLong(0)); - SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0)); - SetStrItem("Unknown"); + SetObjItem(PyBool_FromLong(0)); + SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0)); + SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(oiio_info); - return NULL; - } + if (PyErr_Occurred()) { + Py_CLEAR(oiio_info); + return NULL; + } #undef SetStrItem #undef SetObjItem - return oiio_info; + return oiio_info; } PyObject *BPY_app_oiio_struct(void) { - PyObject *ret; + PyObject *ret; - PyStructSequence_InitType(&BlenderAppOIIOType, &app_oiio_info_desc); + PyStructSequence_InitType(&BlenderAppOIIOType, &app_oiio_info_desc); - ret = make_oiio_info(); + ret = make_oiio_info(); - /* prevent user from creating new instances */ - BlenderAppOIIOType.tp_init = NULL; - BlenderAppOIIOType.tp_new = NULL; - BlenderAppOIIOType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ + /* prevent user from creating new instances */ + BlenderAppOIIOType.tp_init = NULL; + BlenderAppOIIOType.tp_new = NULL; + BlenderAppOIIOType.tp_hash = (hashfunc) + _Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ - return ret; + return ret; } |