Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-06 02:24:05 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-06 02:24:05 +0400
commitfeccbaabbd39c18b2f552964ebd8dfab4eeaed89 (patch)
tree0069f654883a7a02dd320649ce61bd7933748111 /source/blender/python
parenta22096e8019c461128a0907e4026859996ec1b5c (diff)
parent37ba969c74840142682cf22f34610f3b65b86cf4 (diff)
Merged changes in the trunk up to revision 53584.
Conflicts resolved: release/scripts/startup/bl_ui/properties_render.py source/blender/blenloader/intern/readfile.c source/blender/editors/interface/interface_templates.c source/blender/makesrna/RNA_enum_types.h Also made additional code updates for: r53355 UIList - Python-extendable list of UI items r53460 Alpha premul pipeline cleanup
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/SConscript12
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c9
-rw-r--r--source/blender/python/generic/idprop_py_api.c7
-rw-r--r--source/blender/python/generic/py_capi_utils.c17
-rw-r--r--source/blender/python/generic/py_capi_utils.h3
-rw-r--r--source/blender/python/intern/CMakeLists.txt22
-rw-r--r--source/blender/python/intern/bpy_app_build_options.c226
-rw-r--r--source/blender/python/intern/bpy_interface.c10
-rw-r--r--source/blender/python/intern/bpy_path.c65
-rw-r--r--source/blender/python/intern/bpy_path.h33
-rw-r--r--source/blender/python/intern/bpy_props.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c5
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c36
13 files changed, 370 insertions, 77 deletions
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index 15403d7acf4..4fb6d771c5b 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -134,6 +134,12 @@ if env['WITH_BF_TIFF']:
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_OPENAL']:
+ defs.append('WITH_OPENAL')
+
+if env['WITH_BF_SDL']:
+ defs.append('WITH_SDL')
+
if env['WITH_BF_JACK']:
defs.append('WITH_JACK')
@@ -155,12 +161,12 @@ if env['WITH_BF_REMESH']:
if env['WITH_BF_SMOKE']:
defs.append('WITH_SMOKE')
-if env['WITH_BF_OPENAL']:
- defs.append('WITH_OPENAL')
-
if env['WITH_BF_COLLADA']:
defs.append('WITH_COLLADA')
+if env['WITH_BF_OIIO']:
+ defs.append('WITH_OCIO')
+
if env['WITH_BF_PLAYER']:
defs.append('WITH_PLAYER')
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index 9abb13731af..ce8153fb994 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -110,14 +110,17 @@ PyDoc_STRVAR(bpy_bm_update_edit_mesh_doc,
" :arg destructive: Use when grometry has been added or removed.\n"
" :type destructive: boolean\n"
);
-static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args)
+static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
+ static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL};
PyObject *py_me;
Mesh *me;
int do_tessface = TRUE;
int is_destructive = TRUE;
- if (!PyArg_ParseTuple(args, "O|ii:update_edit_mesh", &py_me, &do_tessface, &is_destructive)) {
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:update_edit_mesh", (char **)kwlist,
+ &py_me, &do_tessface, &is_destructive))
+ {
return NULL;
}
@@ -144,7 +147,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args)
static struct PyMethodDef BPy_BM_methods[] = {
{"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
{"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
- {"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS, bpy_bm_update_edit_mesh_doc},
+ {"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 53112d46098..10ca7a943cb 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -836,6 +836,11 @@ static PyObject *BPy_IDGroup_to_dict(BPy_IDProperty *self)
return BPy_IDGroup_MapDataToPy(self->prop);
}
+static PyObject *BPy_IDGroup_clear(BPy_IDProperty *self)
+{
+ IDP_ClearProperty(self->prop);
+ Py_RETURN_NONE;
+}
/* Matches python dict.get(key, [default]) */
static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
@@ -875,6 +880,8 @@ static struct PyMethodDef BPy_IDGroup_methods[] = {
"idprop.get(k[,d]) -> idprop[k] if k in idprop, else d. d defaults to None"},
{"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
"return a purely python version of the group"},
+ {"clear", (PyCFunction)BPy_IDGroup_clear, METH_NOARGS,
+ "clear all members from this group"},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index f62fdaf09db..9a064923736 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -241,6 +241,23 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
return item;
}
+PyObject *PyC_FrozenSetFromStrings(const char **strings)
+{
+ const char **str;
+ PyObject *ret;
+
+ ret = PyFrozenSet_New(NULL);
+
+ for (str = strings; *str; str++) {
+ PyObject *py_str = PyUnicode_FromString(*str);
+ PySet_Add(ret, py_str);
+ Py_DECREF(py_str);
+ }
+
+ return ret;
+}
+
+
/* similar to PyErr_Format(),
*
* implementation - we cant actually preprend the existing exception,
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 935a5f9030b..db582bd7086 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -33,6 +33,7 @@ void PyC_LineSpit(void);
void PyC_StackSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+PyObject * PyC_FrozenSetFromStrings(const char **strings);
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
void PyC_FileAndNum(const char **filename, int *lineno);
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
@@ -53,7 +54,7 @@ void PyC_MainModule_Restore(PyObject *main_mod);
void PyC_SetHomePath(const char *py_path_bundle);
-#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
+#define PYC_INTERPRETER_ACTIVE (((PyThreadState *)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 8f90a823668..823c7c709d7 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -56,6 +56,7 @@ set(SRC
bpy_library.c
bpy_operator.c
bpy_operator_wrap.c
+ bpy_path.c
bpy_props.c
bpy_rna.c
bpy_rna_anim.c
@@ -76,6 +77,7 @@ set(SRC
bpy_library.h
bpy_operator.h
bpy_operator_wrap.h
+ bpy_path.h
bpy_props.h
bpy_rna.h
bpy_rna_anim.h
@@ -190,12 +192,16 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-if(WITH_JACK)
- add_definitions(-DWITH_JACK)
+if(WITH_OPENAL)
+ add_definitions(-DWITH_OPENAL)
endif()
-if(WITH_LIBMV)
- add_definitions(-DWITH_LIBMV)
+if(WITH_SDL)
+ add_definitions(-DWITH_SDL)
+endif()
+
+if(WITH_JACK)
+ add_definitions(-DWITH_JACK)
endif()
if(WITH_LIBMV)
@@ -222,14 +228,14 @@ 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_OPENCOLORIO)
+ add_definitions(-DWITH_OCIO)
+endif()
+
if(WITH_PLAYER)
add_definitions(-DWITH_PLAYER)
endif()
diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c
index 74df3ef7307..8815348c22d 100644
--- a/source/blender/python/intern/bpy_app_build_options.c
+++ b/source/blender/python/intern/bpy_app_build_options.c
@@ -15,7 +15,7 @@
* 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
+ * Contributor(s): Sergey Sharybin
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -29,152 +29,282 @@
#include "bpy_app_build_options.h"
-static PyObject *make_build_options(void)
+static PyTypeObject BlenderAppBuildOptionsType;
+
+static PyStructSequence_Field app_builtopts_info_fields[] = {
+ /* names mostly follow CMake options, lowecases, after WITH_ */
+ {(char *)"bullet", NULL},
+ {(char *)"codec_avi", NULL},
+ {(char *)"codec_ffmpeg", NULL},
+ {(char *)"codec_quicktime", NULL},
+ {(char *)"codec_sndfile", NULL},
+ {(char *)"compositor", NULL},
+ {(char *)"cycles", NULL},
+ {(char *)"cycles_osl", NULL},
+ {(char *)"freestyle", NULL},
+ {(char *)"gameengine", NULL},
+ {(char *)"image_cineon", NULL},
+ {(char *)"image_dds", NULL},
+ {(char *)"image_frameserver", NULL},
+ {(char *)"image_hdr", NULL},
+ {(char *)"image_openexr", NULL},
+ {(char *)"image_openjpeg", NULL},
+ {(char *)"image_redcode", NULL},
+ {(char *)"image_tiff", NULL},
+ {(char *)"input_ndof", NULL},
+ {(char *)"audaspace", NULL},
+ {(char *)"international", NULL},
+ {(char *)"openal", NULL},
+ {(char *)"sdl", NULL},
+ {(char *)"jack", NULL},
+ {(char *)"libmv", NULL},
+ {(char *)"mod_boolean", NULL},
+ {(char *)"mod_fluid", NULL},
+ {(char *)"mod_oceansim", NULL},
+ {(char *)"mod_remesh", NULL},
+ {(char *)"mod_smoke", NULL},
+ {(char *)"collada", NULL},
+ {(char *)"opencolorio", NULL},
+ {(char *)"player", NULL},
+ {NULL}
+};
+
+
+static PyStructSequence_Desc app_builtopts_info_desc = {
+ (char *)"bpy.app.build_options", /* name */
+ (char *)"This module contains information about FFmpeg blender is linked against", /* doc */
+ app_builtopts_info_fields, /* fields */
+ (sizeof(app_builtopts_info_fields) / sizeof(PyStructSequence_Field)) - 1
+};
+
+static PyObject *make_builtopts_info(void)
{
- PyObject *build_options = PyFrozenSet_New(NULL);
+ PyObject *builtopts_info;
+ int pos = 0;
-#define SetStrItem(str) \
- PySet_Add(build_options, PyUnicode_FromString(str));
+ builtopts_info = PyStructSequence_New(&BlenderAppBuildOptionsType);
+ if (builtopts_info == NULL) {
+ return NULL;
+ }
-#ifdef WITH_AUDASPACE
- SetStrItem("AUDASPACE");
-#endif
+#define SetObjIncref(item) \
+ PyStructSequence_SET_ITEM(builtopts_info, pos++, (Py_IncRef(item), item))
#ifdef WITH_BULLET
- SetStrItem("BULLET");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_AVI
- SetStrItem("CODEC_AVI");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_FFMPEG
- SetStrItem("CODEC_FFMPEG");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_QUICKTIME
- SetStrItem("CODEC_QUICKTIME");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_SNDFILE
- SetStrItem("CODEC_SNDFILE");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_COMPOSITOR
- SetStrItem("COMPOSITOR");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_CYCLES
- SetStrItem("CYCLES");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_CYCLES_OSL
- SetStrItem("CYCLES_OSL");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_FREESTYLE
- SetStrItem("FREESTYLE");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_GAMEENGINE
- SetStrItem("GAMEENGINE");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_CINEON
- SetStrItem("IMAGE_CINEON");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_DDS
- SetStrItem("IMAGE_DDS");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_FRAMESERVER
- SetStrItem("IMAGE_FRAMESERVER");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_HDR
- SetStrItem("IMAGE_HDR");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_OPENEXR
- SetStrItem("IMAGE_OPENEXR");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_OPENJPEG
- SetStrItem("IMAGE_OPENJPEG");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_REDCODE
- SetStrItem("IMAGE_REDCODE");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_TIFF
- SetStrItem("IMAGE_TIFF");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_INPUT_NDOF
- SetStrItem("INPUT_NDOF");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
+#endif
+
+#ifdef WITH_AUDASPACE
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_INTERNATIONAL
- SetStrItem("INTERNATIONAL");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
+#endif
+
+#ifdef WITH_OPENAL
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
+#endif
+
+#ifdef WITH_SDL
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_JACK
- SetStrItem("JACK");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_LIBMV
- SetStrItem("LIBMV");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_BOOLEAN
- SetStrItem("MOD_BOOLEAN");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_FLUID
- SetStrItem("MOD_FLUID");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_OCEANSIM
- SetStrItem("MOD_OCEANSIM");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_REMESH
- SetStrItem("MOD_REMESH");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_SMOKE
- SetStrItem("MOD_SMOKE");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
-#ifdef WITH_OPENAL
- SetStrItem("OPENAL");
+#ifdef WITH_COLLADA
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
-#ifdef WITH_COLLADA
- SetStrItem("COLLADA");
+#ifdef WITH_OCIO
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
#ifdef WITH_PLAYER
- SetStrItem("PLAYER");
+ SetObjIncref(Py_True);
+#else
+ SetObjIncref(Py_False);
#endif
-#undef SetStrItem
+#undef SetObjIncref
- if (PyErr_Occurred()) {
- Py_CLEAR(build_options);
- return NULL;
- }
-
- return build_options;
+ return builtopts_info;
}
PyObject *BPY_app_build_options_struct(void)
{
PyObject *ret;
- ret = make_build_options();
+ PyStructSequence_InitType(&BlenderAppBuildOptionsType, &app_builtopts_info_desc);
+
+ ret = make_builtopts_info();
+
+ /* prevent user from creating new instances */
+ BlenderAppBuildOptionsType.tp_init = NULL;
+ BlenderAppBuildOptionsType.tp_new = NULL;
+ BlenderAppBuildOptionsType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
return ret;
}
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index cdecf64c93c..7bce8673943 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -44,6 +44,7 @@
#include "bpy.h"
#include "gpu.h"
#include "bpy_rna.h"
+#include "bpy_path.h"
#include "bpy_util.h"
#include "bpy_traceback.h"
#include "bpy_intern_string.h"
@@ -212,6 +213,7 @@ static struct _inittab bpy_internal_modules[] = {
{(char *)"mathutils", PyInit_mathutils},
// {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
// {(char *)"mathutils.noise", PyInit_mathutils_noise},
+ {(char *)"_bpy_path", BPyInit__bpy_path},
{(char *)"bgl", BPyInit_bgl},
{(char *)"blf", BPyInit_blf},
{(char *)"bmesh", BPyInit_bmesh},
@@ -269,7 +271,8 @@ void BPY_python_start(int argc, const char **argv)
Py_Initialize();
/* THIS IS BAD: see http://bugs.python.org/issue16129 */
-#if 1
+ /* this clobbers the stdout on exit (no 'MEM_printmemlist_stats') */
+#if 0
/* until python provides a reliable way to set the env var */
PyRun_SimpleString("import sys, io\n"
"sys.__backup_stdio__ = sys.__stdout__, sys.__stderr__\n" /* else we loose the FD's [#32720] */
@@ -817,7 +820,7 @@ typedef struct {
} dealloc_obj;
/* call once __file__ is set */
-void bpy_module_delay_init(PyObject *bpy_proxy)
+static void bpy_module_delay_init(PyObject *bpy_proxy)
{
const int argc = 1;
const char *argv[2];
@@ -856,6 +859,9 @@ static void dealloc_obj_dealloc(PyObject *self)
}
PyMODINIT_FUNC
+PyInit_bpy(void);
+
+PyMODINIT_FUNC
PyInit_bpy(void)
{
PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
diff --git a/source/blender/python/intern/bpy_path.c b/source/blender/python/intern/bpy_path.c
new file mode 100644
index 00000000000..8df7ed2364f
--- /dev/null
+++ b/source/blender/python/intern/bpy_path.c
@@ -0,0 +1,65 @@
+/*
+ * ***** 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): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/intern/bpy_path.c
+ * \ingroup pythonintern
+ *
+ * This file defines '_bpy_path' module, Some 'C' funtionality used by 'bpy.path'
+ */
+
+#include <Python.h>
+
+#include "bpy_path.h"
+
+#include "../generic/py_capi_utils.h"
+
+/* #include "IMB_imbuf_types.h" */
+extern const char *imb_ext_image[];
+extern const char *imb_ext_movie[];
+extern const char *imb_ext_audio[];
+
+/*----------------------------MODULE INIT-------------------------*/
+static struct PyModuleDef _bpy_path_module_def = {
+ PyModuleDef_HEAD_INIT,
+ "_bpy_path", /* m_name */
+ NULL, /* m_doc */
+ 0, /* m_size */
+ NULL, /* m_methods */
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL, /* m_free */
+};
+
+PyObject *BPyInit__bpy_path(void)
+{
+ PyObject *submodule;
+
+ submodule = PyModule_Create(&_bpy_path_module_def);
+
+ PyModule_AddObject(submodule, "extensions_image", PyC_FrozenSetFromStrings(imb_ext_image));
+ PyModule_AddObject(submodule, "extensions_movie", PyC_FrozenSetFromStrings(imb_ext_movie));
+ PyModule_AddObject(submodule, "extensions_audio", PyC_FrozenSetFromStrings(imb_ext_audio));
+
+ return submodule;
+}
+
diff --git a/source/blender/python/intern/bpy_path.h b/source/blender/python/intern/bpy_path.h
new file mode 100644
index 00000000000..a0f31202264
--- /dev/null
+++ b/source/blender/python/intern/bpy_path.h
@@ -0,0 +1,33 @@
+/*
+ * ***** 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): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/intern/bpy_path.h
+ * \ingroup pythonintern
+ */
+
+
+#ifndef __BPY_PATH_H__
+#define __BPY_PATH_H__
+
+PyObject *BPyInit__bpy_path(void);
+
+#endif
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index bd033736865..57ddee0c8c0 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1233,6 +1233,8 @@ BPY_PROPDEF_DESC_DOC
" For dynamic values a callback can be passed which returns a list in\n"
" the same format as the static list.\n"
" This function must take 2 arguments (self, context)\n"
+" WARNING: Do not use generators here (they will work the first time, but will lead to empty values\n"
+" in some unload/reload scenarii)!\n"
" :type items: sequence of string triplets or a function\n"
BPY_PROPDEF_UPDATE_DOC
);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 2de477c46c3..bc245ecda5c 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -7373,8 +7373,9 @@ PyDoc_STRVAR(pyrna_register_class_doc,
".. method:: register_class(cls)\n"
"\n"
" Register a subclass of a blender type in (:class:`bpy.types.Panel`,\n"
-" :class:`bpy.types.Menu`, :class:`bpy.types.Header`, :class:`bpy.types.Operator`,\n"
-" :class:`bpy.types.KeyingSetInfo`, :class:`bpy.types.RenderEngine`).\n"
+" :class:`bpy.types.UIList`, :class:`bpy.types.Menu`, :class:`bpy.types.Header`,\n"
+" :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n"
+" :class:`bpy.types.RenderEngine`).\n"
"\n"
" If the class has a *register* class method it will be called\n"
" before registration.\n"
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 69839514a12..0acfc36bb4e 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -44,6 +44,7 @@
#include "BKE_fcurve.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -147,14 +148,17 @@ static int pyrna_struct_anim_args_parse(
/* internal use for insert and delete */
static int pyrna_struct_keyframe_parse(
PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
- const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
+ const char **path_full, int *index, float *cfra, const char **group_name, int *options) /* return values */
{
- static const char *kwlist[] = {"data_path", "index", "frame", "group", NULL};
+ static const char *kwlist[] = {"data_path", "index", "frame", "group", "options", NULL};
+ PyObject *pyoptions = NULL;
const char *path;
- /* note, parse_str MUST start with 's|ifs' */
- if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name))
+ /* note, parse_str MUST start with 's|ifsO!' */
+ if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name,
+ &PySet_Type, &pyoptions)) {
return -1;
+ }
if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
@@ -162,6 +166,10 @@ static int pyrna_struct_keyframe_parse(
if (*cfra == FLT_MAX)
*cfra = CTX_data_scene(BPy_GetContext())->r.cfra;
+ /* flag may be null (no option currently for remove keyframes e.g.). */
+ if (pyoptions && options && (pyrna_set_to_enum_bitfield(keying_flag_items, pyoptions, options, error_prefix) < 0))
+ return -1;
+
return 0; /* success */
}
@@ -172,12 +180,19 @@ char pyrna_struct_keyframe_insert_doc[] =
"\n"
" :arg data_path: path to the property to key, analogous to the fcurve's data path.\n"
" :type data_path: string\n"
-" :arg index: array index of the property to key. Defaults to -1 which will key all indices or a single channel if the property is not an array.\n"
+" :arg index: array index of the property to key. Defaults to -1 which will key all indices or a single channel "
+ "if the property is not an array.\n"
" :type index: int\n"
" :arg frame: The frame on which the keyframe is inserted, defaulting to the current frame.\n"
" :type frame: float\n"
" :arg group: The name of the group the F-Curve should be added to if it doesn't exist yet.\n"
" :type group: str\n"
+" :arg options: Some optional flags:\n"
+" 'NEEDED': Only insert keyframes where they're needed in the relevant F-Curves.\n"
+" 'VISUAL': Insert keyframes based on 'visual transforms'.\n"
+" 'XYZ_TO_RGB': Color for newly added transformation F-Curves (Location, Rotation, Scale) "
+ "and also Color is based on the transform axis.\n"
+" :type flag: set\n"
" :return: Success of keyframe insertion.\n"
" :rtype: boolean\n"
;
@@ -188,12 +203,13 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
int index = -1;
float cfra = FLT_MAX;
const char *group_name = NULL;
+ int options = 0;
PYRNA_STRUCT_CHECK_OBJ(self);
if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
- "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
- &path_full, &index, &cfra, &group_name) == -1)
+ "s|ifsO!:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
+ &path_full, &index, &cfra, &group_name, &options) == -1)
{
return NULL;
}
@@ -203,7 +219,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_init(&reports, RPT_STORE);
- result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
+ result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, options);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
@@ -240,9 +256,9 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
PYRNA_STRUCT_CHECK_OBJ(self);
if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
- "s|ifs:bpy_struct.keyframe_delete()",
+ "s|ifsO!:bpy_struct.keyframe_delete()",
"bpy_struct.keyframe_insert()",
- &path_full, &index, &cfra, &group_name) == -1)
+ &path_full, &index, &cfra, &group_name, NULL) == -1)
{
return NULL;
}