diff options
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r-- | source/blender/python/intern/CMakeLists.txt | 124 | ||||
-rw-r--r-- | source/blender/python/intern/bpy.c | 10 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 3 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_build_options.c | 176 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_build_options.h | 32 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 23 |
6 files changed, 357 insertions, 11 deletions
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index bd660b94321..b2ce33b08c7 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -48,6 +48,7 @@ set(SRC bpy.c bpy_app.c bpy_app_ffmpeg.c + bpy_app_build_options.c bpy_app_handlers.c bpy_driver.c bpy_interface.c @@ -69,6 +70,7 @@ set(SRC bpy.h bpy_app.h bpy_app_ffmpeg.h + bpy_app_build_options.h bpy_app_handlers.h bpy_driver.h bpy_intern_string.h @@ -97,24 +99,136 @@ if(WITH_PYTHON_SAFETY) add_definitions(-DWITH_PYTHON_SAFETY) endif() + + if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() -if(WITH_CYCLES) - add_definitions(-DWITH_CYCLES) +if(WITH_BULLET) + add_definitions(-DWITH_BULLET) endif() -if(WITH_INTERNATIONAL) - add_definitions(-DWITH_INTERNATIONAL) +if(WITH_CODEC_AVI) + add_definitions(-DWITH_AVI) endif() if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) - add_definitions(-DWITH_FFMPEG) endif() +if(WITH_CODEC_QUICKTIME) + add_definitions(-DWITH_QUICKTIME) +endif() + +if(WITH_CODEC_SNDFILE) + add_definitions(-DWITH_SNDFILE) +endif() + +if(WITH_COMPOSITOR) + add_definitions(-DWITH_COMPOSITOR) +endif() + +if(WITH_CYCLES) + add_definitions(-DWITH_CYCLES) +endif() + +if(WITH_CYCLES_OSL) + add_definitions(-DWITH_CYCLES_OSL) +endif() + +if(WITH_GAMEENGINE) + add_definitions(-DWITH_GAMEENGINE) +endif() + +if(WITH_IMAGE_CINEON) + add_definitions(-DWITH_CINEON) +endif() + +if(WITH_IMAGE_DDS) + add_definitions(-DWITH_DDS) +endif() + +if(WITH_IMAGE_FRAMESERVER) + add_definitions(-DWITH_FRAMESERVER) +endif() + +if(WITH_IMAGE_HDR) + add_definitions(-DWITH_HDR) +endif() + +if(WITH_IMAGE_OPENEXR) + add_definitions(-DWITH_OPENEXR) +endif() + +if(WITH_IMAGE_OPENJPEG) + add_definitions(-DWITH_OPENJPEG) +endif() + +if(WITH_IMAGE_REDCODE) + add_definitions(-DWITH_REDCODE) +endif() + +if(WITH_IMAGE_TIFF) + add_definitions(-DWITH_TIFF) +endif() + +if(WITH_INPUT_NDOF) + add_definitions(-DWITH_INPUT_NDOF) +endif() + +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + +if(WITH_JACK) + add_definitions(-DWITH_JACK) +endif() + +if(WITH_LIBMV) + add_definitions(-DWITH_LIBMV) +endif() + +if(WITH_LIBMV) + add_definitions(-DWITH_LIBMV) +endif() + +if(WITH_MOD_BOOLEAN) + add_definitions(-DWITH_MOD_BOOLEAN) +endif() + +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) +endif() + +if(WITH_MOD_OCEANSIM) + add_definitions(-DWITH_OCEANSIM) +endif() + +if(WITH_MOD_REMESH) + add_definitions(-DWITH_MOD_REMESH) +endif() + +if(WITH_MOD_SMOKE) + add_definitions(-DWITH_SMOKE) +endif() + +if(WITH_OPENAL) + add_definitions(-DWITH_OPENAL) +endif() + +if(WITH_OPENCOLLADA) + add_definitions(-DWITH_COLLADA) +endif() + +if(WITH_PLAYER) + add_definitions(-DWITH_PLAYER) +endif() + + + + blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 6897a8591b0..b0dd8a29fbe 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -45,7 +45,7 @@ #include "BLI_path_util.h" #include "BLI_string.h" -#include "BLI_bpath.h" +#include "BKE_bpath.h" #include "BLI_utildefines.h" #include "BKE_main.h" @@ -129,13 +129,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec return NULL; } - if (absolute) flag |= BLI_BPATH_TRAVERSE_ABS; - if (!packed) flag |= BLI_BPATH_TRAVERSE_SKIP_PACKED; - if (local) flag |= BLI_BPATH_TRAVERSE_SKIP_LIBRARY; + if (absolute) flag |= BKE_BPATH_TRAVERSE_ABS; + if (!packed) flag |= BKE_BPATH_TRAVERSE_SKIP_PACKED; + if (local) flag |= BKE_BPATH_TRAVERSE_SKIP_LIBRARY; list = PyList_New(0); - BLI_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list); + BKE_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list); return list; } diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index b1eeff8b3ae..bea63d2b6e8 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -34,6 +34,7 @@ #include "bpy_app.h" #include "bpy_app_ffmpeg.h" +#include "bpy_app_build_options.h" #include "bpy_app_handlers.h" #include "bpy_driver.h" @@ -83,6 +84,7 @@ static PyStructSequence_Field app_info_fields[] = { /* submodules */ {(char *)"ffmpeg", (char *)"FFmpeg library information backend"}, + {(char *)"build_options", (char *)"A set containing most important enabled optional build features"}, {(char *)"handlers", (char *)"Application handler callbacks"}, {NULL} }; @@ -148,6 +150,7 @@ static PyObject *make_app_info(void) #endif SetObjItem(BPY_app_ffmpeg_struct()); + SetObjItem(BPY_app_build_options_struct()); SetObjItem(BPY_app_handlers_struct()); #undef SetIntItem diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c new file mode 100644 index 00000000000..607613b592c --- /dev/null +++ b/source/blender/python/intern/bpy_app_build_options.c @@ -0,0 +1,176 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Bastien Montagne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_build_options.c + * \ingroup pythonintern + */ + +#include <Python.h> +#include "BLI_utildefines.h" + +#include "bpy_app_build_options.h" + +static PyObject *make_build_options(void) +{ + PyObject *build_options = PyFrozenSet_New(NULL); + +#define SetStrItem(str) \ + PySet_Add(build_options, PyUnicode_FromString(str)); + +#ifdef WITH_AUDASPACE + SetStrItem("AUDASPACE"); +#endif + +#ifdef WITH_BULLET + SetStrItem("BULLET"); +#endif + +#ifdef WITH_AVI + SetStrItem("CODEC_AVI"); +#endif + +#ifdef WITH_FFMPEG + SetStrItem("CODEC_FFMPEG"); +#endif + +#ifdef WITH_QUICKTIME + SetStrItem("CODEC_QUICKTIME"); +#endif + +#ifdef WITH_SNDFILE + SetStrItem("CODEC_SNDFILE"); +#endif + +#ifdef WITH_COMPOSITOR + SetStrItem("COMPOSITOR"); +#endif + +#ifdef WITH_CYCLES + SetStrItem("CYCLES"); +#endif + +#ifdef WITH_CYCLES_OSL + SetStrItem("CYCLES_OSL"); +#endif + +#ifdef WITH_GAMEENGINE + SetStrItem("GAMEENGINE"); +#endif + +#ifdef WITH_CINEON + SetStrItem("IMAGE_CINEON"); +#endif + +#ifdef WITH_DDS + SetStrItem("IMAGE_DDS"); +#endif + +#ifdef WITH_FRAMESERVER + SetStrItem("IMAGE_FRAMESERVER"); +#endif + +#ifdef WITH_HDR + SetStrItem("IMAGE_HDR"); +#endif + +#ifdef WITH_OPENEXR + SetStrItem("IMAGE_OPENEXR"); +#endif + +#ifdef WITH_OPENJPEG + SetStrItem("IMAGE_OPENJPEG"); +#endif + +#ifdef WITH_REDCODE + SetStrItem("IMAGE_REDCODE"); +#endif + +#ifdef WITH_TIFF + SetStrItem("IMAGE_TIFF"); +#endif + +#ifdef WITH_INPUT_NDOF + SetStrItem("INPUT_NDOF"); +#endif + +#ifdef WITH_INTERNATIONAL + SetStrItem("INTERNATIONAL"); +#endif + +#ifdef WITH_JACK + SetStrItem("JACK"); +#endif + +#ifdef WITH_LIBMV + SetStrItem("LIBMV"); +#endif + +#ifdef WITH_MOD_BOOLEAN + SetStrItem("MOD_BOOLEAN"); +#endif + +#ifdef WITH_MOD_FLUID + SetStrItem("MOD_FLUID"); +#endif + +#ifdef WITH_OCEANSIM + SetStrItem("MOD_OCEANSIM"); +#endif + +#ifdef WITH_MOD_REMESH + SetStrItem("MOD_REMESH"); +#endif + +#ifdef WITH_SMOKE + SetStrItem("MOD_SMOKE"); +#endif + +#ifdef WITH_OPENAL + SetStrItem("OPENAL"); +#endif + +#ifdef WITH_COLLADA + SetStrItem("COLLADA"); +#endif + +#ifdef WITH_PLAYER + SetStrItem("PLAYER"); +#endif + +#undef SetStrItem + + if (PyErr_Occurred()) { + Py_CLEAR(build_options); + return NULL; + } + + return build_options; +} + +PyObject *BPY_app_build_options_struct(void) +{ + PyObject *ret; + + ret = make_build_options(); + + return ret; +} diff --git a/source/blender/python/intern/bpy_app_build_options.h b/source/blender/python/intern/bpy_app_build_options.h new file mode 100644 index 00000000000..82a1417ea2c --- /dev/null +++ b/source/blender/python/intern/bpy_app_build_options.h @@ -0,0 +1,32 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Bastien Montagne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_build_options.h + * \ingroup pythonintern + */ + +#ifndef __BPY_APP_BUILD_OPTIONS_H__ +#define __BPY_APP_BUILD_OPTIONS_H__ + +PyObject *BPY_app_build_options_struct(void); + +#endif /* __BPY_APP_BUILD_OPTIONS_H__ */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index a0df8988068..55983c73895 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1478,7 +1478,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha } -static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func) +static PyObject *pyrna_func_to_py(const PointerRNA *ptr, FunctionRNA *func) { BPy_FunctionRNA *pyfunc = (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type); pyfunc->ptr = *ptr; @@ -6029,6 +6029,27 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna) PyObject_SetAttr(newclass, bpy_intern_str_bl_rna, item); Py_DECREF(item); + /* add classmethods */ + { + const PointerRNA func_ptr = {{NULL}, srna, NULL}; + const ListBase *lb; + Link *link; + + lb = RNA_struct_type_functions(srna); + for (link = lb->first; link; link = link->next) { + FunctionRNA *func = (FunctionRNA *)link; + const int flag = RNA_function_flag(func); + if ((flag & FUNC_NO_SELF) && /* is classmethod */ + (flag & FUNC_REGISTER) == FALSE) /* is not for registration */ + { + /* we may went to set the type of this later */ + PyObject *func_py = pyrna_func_to_py(&func_ptr, func); + PyObject_SetAttrString(newclass, RNA_function_identifier(func), func_py); + Py_DECREF(func_py); + } + } + } + /* done with rna instance */ } |