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
This commit is contained in:
2013-01-05 22:24:05 +00:00
577 changed files with 20475 additions and 7280 deletions

View File

@@ -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')

View File

@@ -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}
};

View File

@@ -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}
};

View File

@@ -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,

View File

@@ -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);

View File

@@ -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()

View File

@@ -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));
#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_FREESTYLE
SetStrItem("FREESTYLE");
#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);
builtopts_info = PyStructSequence_New(&BlenderAppBuildOptionsType);
if (builtopts_info == NULL) {
return NULL;
}
return build_options;
#define SetObjIncref(item) \
PyStructSequence_SET_ITEM(builtopts_info, pos++, (Py_IncRef(item), item))
#ifdef WITH_BULLET
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_AVI
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_FFMPEG
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_QUICKTIME
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_SNDFILE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_COMPOSITOR
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_CYCLES
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_CYCLES_OSL
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_FREESTYLE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_GAMEENGINE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_CINEON
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_DDS
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_FRAMESERVER
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_HDR
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_OPENEXR
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_OPENJPEG
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_REDCODE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_TIFF
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_INPUT_NDOF
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_AUDASPACE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_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
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_LIBMV
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_BOOLEAN
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_FLUID
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_OCEANSIM
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_REMESH
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_SMOKE
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_COLLADA
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_OCIO
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#ifdef WITH_PLAYER
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);
#endif
#undef SetObjIncref
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;
}

View File

@@ -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];
@@ -855,6 +858,9 @@ static void dealloc_obj_dealloc(PyObject *self)
dealloc_obj_Type.tp_free(self);
}
PyMODINIT_FUNC
PyInit_bpy(void);
PyMODINIT_FUNC
PyInit_bpy(void)
{

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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
);

View File

@@ -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"

View File

@@ -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;
}