static PyObject *make_oiio_info(void) { PyObject *oiio_info; int pos = 0; #ifdef WITH_OPENIMAGEIO int curversion; #endif 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)) #endif #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(oiio_info, pos++, obj) #ifdef WITH_OPENIMAGEIO curversion = OIIO_getVersionHex(); SetObjItem(PyBool_FromLong(1)); SetObjItem(Py_BuildValue("(iii)", 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(Py_BuildValue("(iii)", 0, 0, 0)); SetStrItem("Unknown"); #endif if (PyErr_Occurred()) { Py_CLEAR(oiio_info); return NULL; } #undef SetStrItem #undef SetObjItem return oiio_info; }
static PyObject *make_app_info(void) { extern char bprogname[]; /* argv[0] from creator.c */ PyObject *app_info; int pos= 0; app_info= PyStructSequence_New(&BlenderAppType); if (app_info == NULL) { return NULL; } #define SetIntItem(flag) \ PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag)) #define SetStrItem(str) \ PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str)) #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(app_info, pos++, obj) SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); #if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1 SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR)); #else SetStrItem(""); #endif SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE)); SetStrItem(bprogname); SetObjItem(PyBool_FromLong(G.background)); /* build info */ #ifdef BUILD_DATE SetStrItem(build_date); SetStrItem(build_time); SetStrItem(build_rev); SetStrItem(build_platform); SetStrItem(build_type); SetStrItem(build_cflags); SetStrItem(build_cxxflags); SetStrItem(build_linkflags); SetStrItem(build_system); #else SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); #endif SetObjItem(BPY_app_handlers_struct()); #undef SetIntItem #undef SetStrItem #undef SetObjItem if (PyErr_Occurred()) { Py_CLEAR(app_info); return NULL; } return app_info; }
static PyObject *make_ffmpeg_info(void) { PyObject *ffmpeg_info; int pos = 0; #ifdef WITH_FFMPEG int curversion; #endif ffmpeg_info = PyStructSequence_New(&BlenderAppFFmpegType); if (ffmpeg_info == NULL) { return NULL; } #if 0 // UNUSED #define SetIntItem(flag) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyLong_FromLong(flag)) #endif #ifndef WITH_FFMPEG #define SetStrItem(str) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyUnicode_FromString(str)) #endif #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, obj) #ifdef WITH_FFMPEG # define FFMPEG_LIB_VERSION(lib) { \ curversion = lib ## _version(); \ SetObjItem(PyC_Tuple_Pack_I32(curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \ SetObjItem(PyUnicode_FromFormat("%2d, %2d, %2d", \ curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \ } (void)0 #else # define FFMPEG_LIB_VERSION(lib) { \ SetStrItem("Unknown"); \ SetStrItem("Unknown"); \ } (void)0 #endif #ifdef WITH_FFMPEG SetObjItem(PyBool_FromLong(1)); #else SetObjItem(PyBool_FromLong(0)); #endif FFMPEG_LIB_VERSION(avcodec); FFMPEG_LIB_VERSION(avdevice); FFMPEG_LIB_VERSION(avformat); FFMPEG_LIB_VERSION(avutil); FFMPEG_LIB_VERSION(swscale); #undef FFMPEG_LIB_VERSION if (PyErr_Occurred()) { Py_CLEAR(ffmpeg_info); return NULL; } // #undef SetIntItem #undef SetStrItem #undef SetObjItem return ffmpeg_info; }
static PyObject *make_sdl_info(void) { PyObject *sdl_info; int pos = 0; #ifdef WITH_SDL bool sdl_available = false; SDL_version version = {0, 0, 0}; #endif sdl_info = PyStructSequence_New(&BlenderAppSDLType); if (sdl_info == NULL) { return NULL; } #define SetStrItem(str) \ PyStructSequence_SET_ITEM(sdl_info, pos++, PyUnicode_FromString(str)) #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(sdl_info, pos++, obj) #ifdef WITH_SDL SetObjItem(PyBool_FromLong(1)); # ifdef WITH_SDL_DYNLOAD if (sdlewInit() == SDLEW_SUCCESS) { SDL_GetVersion(&version); sdl_available = true; } # else // WITH_SDL_DYNLOAD=OFF sdl_available = true; # if SDL_MAJOR_VERSION >= 2 SDL_GetVersion(&version); # else SDL_VERSION(&version); # endif # endif SetObjItem(Py_BuildValue("(iii)", version.major, version.minor, version.patch)); if (sdl_available) { SetObjItem(PyUnicode_FromFormat("%d.%d.%d", version.major, version.minor, version.patch)); } else { SetStrItem("Unknown"); } SetObjItem(PyBool_FromLong(sdl_available)); #else // WITH_SDL=OFF SetObjItem(PyBool_FromLong(0)); SetObjItem(Py_BuildValue("(iii)", 0, 0, 0)); SetStrItem("Unknown"); SetObjItem(PyBool_FromLong(0)); #endif if (PyErr_Occurred()) { Py_CLEAR(sdl_info); return NULL; } #undef SetStrItem #undef SetObjItem return sdl_info; }