Merged changes in the trunk up to revision 35367.

To branch builders: From this revision Python 3.2 will be used.
Don't forget svn update in the "lib" directory as well.
This commit is contained in:
2011-03-06 12:13:32 +00:00
1026 changed files with 15856 additions and 10181 deletions

View File

@@ -47,6 +47,7 @@ set(SRC
bpy_operator_wrap.c
bpy_props.c
bpy_rna.c
bpy_rna_anim.c
bpy_rna_array.c
bpy_rna_callback.c
bpy_traceback.c
@@ -60,6 +61,7 @@ set(SRC
bpy_operator_wrap.h
bpy_props.h
bpy_rna.h
bpy_rna_anim.h
bpy_rna_callback.h
bpy_traceback.h
bpy_util.h
@@ -75,4 +77,8 @@ if(WITH_PYTHON_MODULE)
add_definitions(-DWITH_PYTHON_MODULE)
endif()
if(WITH_PYTHON_SAFETY)
add_definitions(-DWITH_PYTHON_SAFETY)
endif()
blender_add_lib(bf_python "${SRC}" "${INC}")

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy.c
* \ingroup pythonintern
*/
/* This file defines the '_bpy' module which is used by python's 'bpy' package.
* a script writer should never directly access this module */
@@ -43,6 +48,8 @@
#include "BKE_global.h" /* XXX, G.main only */
#include "RNA_access.h"
#include "MEM_guardedalloc.h"
/* external util modules */

View File

@@ -20,6 +20,11 @@
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK ***** */
/** \file blender/python/intern/bpy.h
* \ingroup pythonintern
*/
void BPy_init_modules( void );
extern PyObject *bpy_package_py;

View File

@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_app.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "bpy_app.h"

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_app.h
* \ingroup pythonintern
*/
#ifndef BPY_APP_H
#define BPY_APP_H

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_driver.c
* \ingroup pythonintern
*/
/* ****************************************** */
/* Drivers - PyExpression Evaluation */

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_driver.h
* \ingroup pythonintern
*/
#ifndef BPY_DRIVER_H
#define BPY_DRIVER_H

View File

@@ -22,6 +22,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_interface.c
* \ingroup pythonintern
*/
/* grr, python redefines */
#ifdef _POSIX_C_SOURCE
@@ -32,6 +37,8 @@
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "bpy.h"
#include "bpy_rna.h"
#include "bpy_util.h"

View File

@@ -1,5 +1,5 @@
/**
/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -23,12 +23,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_operator.c
* \ingroup pythonintern
*/
/* Note, this module is not to be used directly by the user.
* Internally its exposed as '_bpy.ops', which provides functions for 'bpy.ops', a python package.
* */
#include <Python.h>
#include "RNA_types.h"
#include "bpy_operator.h"
#include "bpy_operator_wrap.h"
#include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */
@@ -36,6 +43,7 @@
#include "BLI_utildefines.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "WM_api.h"

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_operator.h
* \ingroup pythonintern
*/
#ifndef BPY_OPERATOR_H
#define BPY_OPERATOR_H

View File

@@ -1,5 +1,5 @@
/**
/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -23,6 +23,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_operator_wrap.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "bpy_operator_wrap.h"
@@ -31,6 +36,7 @@
#include "BLI_utildefines.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "bpy_rna.h"

View File

@@ -21,6 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_operator_wrap.h
* \ingroup pythonintern
*/
#ifndef BPY_OPERATOR_WRAP_H
#define BPY_OPERATOR_WRAP_H

View File

@@ -22,14 +22,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_props.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "RNA_types.h"
#include "bpy_props.h"
#include "bpy_rna.h"
#include "bpy_util.h"
#include "BLI_utildefines.h"
#include "BKE_idprop.h"
#include "RNA_access.h"
#include "RNA_define.h" /* for defining our own rna */
#include "RNA_enum_types.h"

View File

@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_props.h
* \ingroup pythonintern
*/
#ifndef BPY_PROPS_H
#define BPY_PROPS_H

File diff suppressed because it is too large Load Diff

View File

@@ -21,12 +21,49 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_rna.h
* \ingroup pythonintern
*/
#ifndef BPY_RNA_H
#define BPY_RNA_H
#include "RNA_access.h"
#include "RNA_types.h"
#include "BKE_idprop.h"
/* --- bpy build options --- */
#ifdef WITH_PYTHON_SAFETY
/* play it safe and keep optional for now, need to test further now this affects looping on 10000's of verts for eg. */
#define USE_WEAKREFS
/* method to invalidate removed py data, XXX, slow to remove objects, otherwise no overhead */
/* #define USE_PYRNA_INVALIDATE_GC */
/* different method */
#define USE_PYRNA_INVALIDATE_WEAKREF
/* support for inter references, currently only needed for corner case */
#define USE_PYRNA_STRUCT_REFERENCE
/* use real collection iterators rather then faking with a list */
#define USE_PYRNA_ITER
#else /* WITH_PYTHON_SAFETY */
/* default, no defines! */
#endif /* !WITH_PYTHON_SAFETY */
/* sanity checks on above defs */
#if defined(USE_PYRNA_INVALIDATE_WEAKREF) && !defined(USE_WEAKREFS)
#define USE_WEAKREFS
#endif
#if defined(USE_PYRNA_INVALIDATE_GC) && defined(USE_PYRNA_INVALIDATE_WEAKREF)
#error "Only 1 reference check method at a time!"
#endif
/* --- end bpy build options --- */
extern PyTypeObject pyrna_struct_meta_idprop_Type;
extern PyTypeObject pyrna_struct_Type;
@@ -39,47 +76,70 @@ extern PyTypeObject pyrna_prop_collection_Type;
#define BPy_PropertyRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_prop_Type))
#define BPy_PropertyRNA_CheckExact(v) (Py_TYPE(v) == &pyrna_prop_Type)
/* play it safe and keep optional for now, need to test further now this affects looping on 10000's of verts for eg. */
// #define USE_WEAKREFS
#define PYRNA_STRUCT_CHECK_OBJ(obj) if(pyrna_struct_validity_check(obj) == -1) { return NULL; }
#define PYRNA_STRUCT_CHECK_INT(obj) if(pyrna_struct_validity_check(obj) == -1) { return -1; }
#define PYRNA_PROP_CHECK_OBJ(obj) if(pyrna_prop_validity_check(obj) == -1) { return NULL; }
#define PYRNA_PROP_CHECK_INT(obj) if(pyrna_prop_validity_check(obj) == -1) { return -1; }
#define PYRNA_STRUCT_IS_VALID(pysrna) (((BPy_StructRNA *)(pysrna))->ptr.type != NULL)
#define PYRNA_PROP_IS_VALID(pysrna) (((BPy_PropertyRNA *)(pysrna))->ptr.type != NULL)
/* 'in_weakreflist' MUST be aligned */
typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
PointerRNA ptr;
} BPy_DummyPointerRNA;
typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
PointerRNA ptr;
#ifdef USE_PYRNA_STRUCT_REFERENCE
/* generic PyObject we hold a reference to, example use:
* hold onto the collection iterator to prevent it from freeing allocated data we may use */
PyObject *reference;
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
} BPy_StructRNA;
typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
PropertyRNA *prop;
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
PointerRNA ptr;
PropertyRNA *prop;
} BPy_PropertyRNA;
typedef struct {
PyObject_HEAD /* required python macro */
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
PointerRNA ptr;
PropertyRNA *prop;
/* Arystan: this is a hack to allow sub-item r/w access like: face.uv[n][m] */
int arraydim; /* array dimension, e.g: 0 for face.uv, 2 for face.uv[n][m], etc. */
int arrayoffset; /* array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n */
} BPy_PropertyArrayRNA;
typedef struct {
PyObject_HEAD /* required python macro */
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
} BPy_PropertyArrayRNA;
/* collection iterator spesific parts */
CollectionPropertyIterator iter;
} BPy_PropertyCollectionIterRNA;
/* cheap trick */
#define BPy_BaseTypeRNA BPy_PropertyRNA
@@ -123,6 +183,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
int pyrna_write_check(void);
int pyrna_struct_validity_check(BPy_StructRNA *pysrna);
int pyrna_prop_validity_check(BPy_PropertyRNA *self);
void BPY_modules_update(struct bContext *C); //XXX temp solution
/* bpy.utils.(un)register_class */

View File

@@ -0,0 +1,353 @@
/*
* $Id$
*
* ***** 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_rna_anim.c
* \ingroup pythonintern
*/
#include <Python.h>
#include <float.h> /* FLT_MIN/MAX */
#include "MEM_guardedalloc.h"
#include "BLI_string.h"
#include "DNA_scene_types.h"
#include "DNA_anim_types.h"
#include "ED_keyframing.h"
#include "BKE_report.h"
#include "BKE_context.h"
#include "BKE_animsys.h"
#include "BKE_fcurve.h"
#include "RNA_access.h"
#include "bpy_rna.h"
#include "bpy_util.h"
#define TRUE 1
#define FALSE 0
/* for keyframes and drivers */
static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefix, const char *path,
const char **path_full, int *index)
{
const int is_idbase= RNA_struct_is_ID(ptr->type);
PropertyRNA *prop;
PointerRNA r_ptr;
if (ptr->data==NULL) {
PyErr_Format(PyExc_TypeError, "%.200s this struct has no data, can't be animated", error_prefix);
return -1;
}
/* full paths can only be given from ID base */
if(is_idbase) {
int r_index= -1;
if(RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) {
prop= NULL;
}
else if(r_index != -1) {
PyErr_Format(PyExc_ValueError, "%.200s path includes index, must be a separate argument", error_prefix, path);
return -1;
}
else if(ptr->id.data != r_ptr.id.data) {
PyErr_Format(PyExc_ValueError, "%.200s path spans ID blocks", error_prefix, path);
return -1;
}
}
else {
prop = RNA_struct_find_property(ptr, path);
r_ptr= *ptr;
}
if (prop==NULL) {
PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
return -1;
}
if (!RNA_property_animateable(&r_ptr, prop)) {
PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not animatable", error_prefix, path);
return -1;
}
if(RNA_property_array_check(&r_ptr, prop) == 0) {
if((*index) == -1) {
*index= 0;
}
else {
PyErr_Format(PyExc_TypeError, "%.200s index %d was given while property \"%s\" is not an array", error_prefix, *index, path);
return -1;
}
}
else {
int array_len= RNA_property_array_length(&r_ptr, prop);
if((*index) < -1 || (*index) >= array_len) {
PyErr_Format(PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len);
return -1;
}
}
if(is_idbase) {
*path_full= BLI_strdup(path);
}
else {
*path_full= RNA_path_from_ID_to_property(&r_ptr, prop);
if (*path_full==NULL) {
PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path);
return -1;
}
}
return 0;
}
/* 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 */
{
static const char *kwlist[] = {"data_path", "index", "frame", "group", 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))
return -1;
if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
if(*cfra==FLT_MAX)
*cfra= CTX_data_scene(BPy_GetContext())->r.cfra;
return 0; /* success */
}
char pyrna_struct_keyframe_insert_doc[] =
".. method:: keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, group=\"\")\n"
"\n"
" Insert a keyframe on the property given, adding fcurves and animation data when necessary.\n"
"\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"
" :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"
" :return: Success of keyframe insertion.\n"
" :rtype: boolean\n"
;
PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
/* args, pyrna_struct_keyframe_parse handles these */
const char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
const char *group_name= NULL;
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) {
return NULL;
}
else {
short result;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
result= insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
MEM_freeN((void *)path_full);
if(BPy_reports_to_error(&reports, TRUE))
return NULL;
return PyBool_FromLong(result);
}
}
char pyrna_struct_keyframe_delete_doc[] =
".. method:: keyframe_delete(data_path, index=-1, frame=bpy.context.scene.frame_current, group=\"\")\n"
"\n"
" Remove a keyframe from this properties fcurve.\n"
"\n"
" :arg data_path: path to the property to remove a key, analogous to the fcurve's data path.\n"
" :type data_path: string\n"
" :arg index: array index of the property to remove a key. Defaults to -1 removing 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 deleted, 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"
" :return: Success of keyframe deleation.\n"
" :rtype: boolean\n"
;
PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
/* args, pyrna_struct_keyframe_parse handles these */
const char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
const char *group_name= NULL;
PYRNA_STRUCT_CHECK_OBJ(self)
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1) {
return NULL;
}
else {
short result;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
result= delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
MEM_freeN((void *)path_full);
if(BPy_reports_to_error(&reports, TRUE))
return NULL;
return PyBool_FromLong(result);
}
}
char pyrna_struct_driver_add_doc[] =
".. method:: driver_add(path, index=-1)\n"
"\n"
" Adds driver(s) to the given property\n"
"\n"
" :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
" :type path: string\n"
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single channel if the property is not an array.\n"
" :type index: int\n"
" :return: The driver(s) added.\n"
" :rtype: :class:`FCurve` or list if index is -1 with an array property.\n"
;
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
int index= -1;
PYRNA_STRUCT_CHECK_OBJ(self)
if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index))
return NULL;
if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) {
return NULL;
}
else {
PyObject *ret= NULL;
ReportList reports;
int result;
BKE_reports_init(&reports, RPT_STORE);
result= ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON);
if(BPy_reports_to_error(&reports, TRUE))
return NULL;
if(result) {
ID *id= self->ptr.id.data;
AnimData *adt= BKE_animdata_from_id(id);
FCurve *fcu;
PointerRNA tptr;
PyObject *item;
if(index == -1) { /* all, use a list */
int i= 0;
ret= PyList_New(0);
while((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) {
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
item= pyrna_struct_CreatePyObject(&tptr);
PyList_Append(ret, item);
Py_DECREF(item);
}
}
else {
fcu= list_find_fcurve(&adt->drivers, path_full, index);
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
ret= pyrna_struct_CreatePyObject(&tptr);
}
}
else {
/* XXX, should be handled by reports, */
PyErr_SetString(PyExc_TypeError, "bpy_struct.driver_add(): failed because of an internal error");
return NULL;
}
MEM_freeN((void *)path_full);
return ret;
}
}
char pyrna_struct_driver_remove_doc[] =
".. method:: driver_remove(path, index=-1)\n"
"\n"
" Remove driver(s) from the given property\n"
"\n"
" :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
" :type path: string\n"
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single channel if the property is not an array.\n"
" :type index: int\n"
" :return: Success of driver removal.\n"
" :rtype: boolean\n"
;
PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
int index= -1;
PYRNA_STRUCT_CHECK_OBJ(self)
if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index))
return NULL;
if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) {
return NULL;
}
else {
short result;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
result= ANIM_remove_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0);
MEM_freeN((void *)path_full);
if(BPy_reports_to_error(&reports, TRUE))
return NULL;
return PyBool_FromLong(result);
}
}

View File

@@ -0,0 +1,37 @@
/*
* $Id$
*
* ***** 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_rna_anim.h
* \ingroup pythonintern
*/
extern char pyrna_struct_keyframe_insert_doc[];
extern char pyrna_struct_keyframe_delete_doc[];
extern char pyrna_struct_driver_add_doc[];
extern char pyrna_struct_driver_remove_doc[];
PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw);
PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw);
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args);
PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args);

View File

@@ -21,12 +21,21 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_rna_array.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "RNA_types.h"
#include "bpy_rna.h"
#include "BKE_global.h"
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
#define MAX_ARRAY_DIMENSION 10
typedef void (*ItemConvertFunc)(PyObject *, char *);
@@ -58,6 +67,10 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
if (dim + 1 < totdim) {
/* check that a sequence contains dimsize[dim] items */
const int seq_size= PySequence_Size(seq);
if(seq_size == -1) {
PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not %s", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
return 0;
}
for (i= 0; i < seq_size; i++) {
PyObject *item;
int ok= 1;
@@ -91,6 +104,10 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
else {
/* check that items are of correct type */
const int seq_size= PySequence_Size(seq);
if(seq_size == -1) {
PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not %s", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
return 0;
}
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
@@ -233,6 +250,8 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
int totdim= RNA_property_array_dimension(ptr, prop, NULL);
const int seq_size= PySequence_Size(seq);
assert(seq_size != -1);
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);

View File

@@ -22,8 +22,15 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_rna_callback.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "RNA_types.h"
#include "bpy_rna.h"
#include "bpy_rna_callback.h"
#include "bpy_util.h"
@@ -32,6 +39,8 @@
#include "DNA_screen_types.h"
#include "RNA_access.h"
#include "BKE_context.h"
#include "ED_space_api.h"

View File

@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_rna_callback.h
* \ingroup pythonintern
*/
struct BPy_StructRNA;
struct PyObject;

View File

@@ -20,6 +20,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_traceback.c
* \ingroup pythonintern
*/
#include <Python.h>
#include <frameobject.h>

View File

@@ -20,6 +20,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_traceback.h
* \ingroup pythonintern
*/
#ifndef BPY_TRACEBACK_H
#define BPY_TRACEBACK_H

View File

@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_util.c
* \ingroup pythonintern
*/
#include <Python.h>
#include "bpy_util.h"

View File

@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_util.h
* \ingroup pythonintern
*/
#ifndef BPY_UTIL_H
#define BPY_UTIL_H

View File

@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/stubs.c
* \ingroup pythonintern
*/
/* python, will come back */
//void BPY_script_exec(void) {}
//void BPY_python_start(void) {}