Merged changes in the trunk up to revision 26533.

This commit is contained in:
2010-02-01 20:47:23 +00:00
221 changed files with 4426 additions and 2920 deletions

View File

@@ -0,0 +1,129 @@
/**
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "bpy_app.h"
#include "bpy_util.h"
#include "BLI_path_util.h"
#include "BKE_blender.h"
#include "BKE_global.h"
#include "structseq.h"
#ifdef BUILD_DATE
extern char * build_date;
extern char * build_time;
extern char * build_rev;
extern char * build_platform;
extern char * build_type;
#else
static char * build_date = "Unknown";
static char * build_time = "Unknown";
static char * build_rev = "Unknown";
static char * build_platform = "Unknown";
static char * build_type = "Unknown";
#endif
static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{"version_string", "The Blender version formatted as a string."},
{"home", "The blender home directory, normally matching $HOME"},
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances."},
{"debug", "Boolean, set when blender is running in debug mode (started with -d)."},
/* buildinfo */
{"build_date", "The date this blender instance was built.."},
{"build_time", "The time this blender instance was built."},
{"build_revision", "The subversion revision this blender instance was built with."},
{"build_platform", "The platform this blender instance was built for."},
{"build_type", "The type of build (Release, Debug)"},
{0}
};
static PyStructSequence_Desc app_info_desc = {
"bpy.app", /* name */
"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
10
};
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(flag) \
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(flag))
#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));
SetStrItem(BLI_gethome());
SetStrItem(bprogname);
SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
/* build info */
SetStrItem(build_date);
SetStrItem(build_time);
SetStrItem(build_rev);
SetStrItem(build_platform);
SetStrItem(build_type);
#undef SetIntItem
#undef SetStrItem
#undef SetObjItem
if (PyErr_Occurred()) {
Py_CLEAR(app_info);
return NULL;
}
return app_info;
}
PyObject *BPY_app_struct(void)
{
PyObject *ret;
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret= make_app_info();
/* prevent user from creating new instances */
BlenderAppType.tp_init = NULL;
BlenderAppType.tp_new = NULL;
return ret;
}

View File

@@ -21,11 +21,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BPY_UI_H__
#define BPY_UI_H__
#ifndef BPY_APP_H__
#define BPY_APP_H__
#include <Python.h>
PyObject *BPY_ui_module( void );
PyObject *BPY_app_struct( void );
#endif

View File

@@ -38,10 +38,10 @@
#include "compile.h" /* for the PyCodeObject */
#include "eval.h" /* for PyEval_EvalCode */
#include "bpy_app.h"
#include "bpy_rna.h"
#include "bpy_props.h"
#include "bpy_operator.h"
#include "bpy_ui.h"
#include "bpy_util.h"
#ifndef WIN32
@@ -60,11 +60,9 @@
#include "BLI_fileops.h"
#include "BLI_string.h"
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BPY_extern.h"
@@ -213,9 +211,7 @@ static void bpy_init_modules( void )
/* PyModule_AddObject( mod, "doc", BPY_rna_doc() ); */
PyModule_AddObject( mod, "props", BPY_rna_props() );
PyModule_AddObject( mod, "ops", BPY_operator_module() ); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experimental, consider this a test, especially PyCObject is not meant to be permanent
PyModule_AddObject( mod, "app", BPY_app_struct() );
/* bpy context */
{
@@ -227,20 +223,6 @@ static void bpy_init_modules( void )
PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
}
/* blender info that wont change at runtime, add into _bpy */
{
extern char bprogname[]; /* argv[0] from creator.c */
PyObject *mod_dict= PyModule_GetDict(mod);
char tmpstr[256];
PyModule_AddStringConstant(mod, "_HOME", BLI_gethome());
PyDict_SetItemString(mod_dict, "_VERSION", Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
sprintf(tmpstr, "%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
PyModule_AddStringConstant(mod, "_VERSION_STR", tmpstr);
PyModule_AddStringConstant(mod, "_BINPATH", bprogname);
PyModule_AddIntConstant(mod, "_DEBUG", G.f & G_DEBUG ? 1:0);
}
/* add our own modules dir, this is a python package */
bpy_import_test("bpy");
}
@@ -797,10 +779,9 @@ int BPY_context_get(bContext *C, const char *member, bContextDataResult *result)
if (item) printf("Context '%s' not a valid type\n", member);
else printf("Context '%s' not found\n", member);
}
else if (G.f & G_DEBUG) {
else {
printf("Context '%s' found\n", member);
}
return done;
}

View File

@@ -24,6 +24,7 @@
#include "bpy_props.h"
#include "bpy_rna.h"
#include "bpy_util.h"
#include "RNA_access.h"
#include "RNA_define.h" /* for defining our own rna */
@@ -55,7 +56,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -83,6 +84,52 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
}
}
static char BPy_BoolVectorProperty_doc[] =
".. function:: BoolVectorProperty(name=\"\", description=\"\", default=(False, False, False), hidden=False, size=3)\n"
"\n"
" Returns a new vector boolean property definition.";
PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
srna= srna_from_self(self);
if(srna==NULL && PyErr_Occurred()) {
return NULL; /* self's type was compatible but error getting the srna */
}
else if(srna) {
static char *kwlist[] = {"attr", "name", "description", "default", "hidden", "size", NULL};
char *id=NULL, *name="", *description="";
int def[PYRNA_STACK_ARRAY]={0};
int hidden=0, size=3;
PropertyRNA *prop;
PyObject *pydef= NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOii:BoolVectorProperty", kwlist, &id, &name, &description, &pydef, &hidden, &size))
return NULL;
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY);
return NULL;
}
if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
if(hidden) RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_duplicate_pointers(prop);
Py_RETURN_NONE;
}
else { /* operators defer running this function */
return bpy_prop_deferred_return((void *)BPy_BoolVectorProperty, kw);
}
}
static char BPy_IntProperty_doc[] =
".. function:: IntProperty(name=\"\", description=\"\", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, hidden=False)\n"
"\n"
@@ -91,7 +138,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -121,6 +168,54 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
}
}
static char BPy_IntVectorProperty_doc[] =
".. function:: IntVectorProperty(name=\"\", description=\"\", default=(0, 0, 0), min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, hidden=False, size=3)\n"
"\n"
" Returns a new vector int property definition.";
PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
srna= srna_from_self(self);
if(srna==NULL && PyErr_Occurred()) {
return NULL; /* self's type was compatible but error getting the srna */
}
else if(srna) {
static char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "hidden", "size", NULL};
char *id=NULL, *name="", *description="";
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0};
int hidden=0, size=3;
PropertyRNA *prop;
PyObject *pydef= NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiii:IntVectorProperty", kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &hidden, &size))
return NULL;
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY);
return NULL;
}
if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_int_array(srna, id, size, pydef ? def:NULL, min, max, name, description, soft_min, soft_max);
RNA_def_property_ui_range(prop, min, max, step, 0);
if(hidden) RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_duplicate_pointers(prop);
Py_RETURN_NONE;
}
else { /* operators defer running this function */
return bpy_prop_deferred_return((void *)BPy_IntVectorProperty, kw);
}
}
static char BPy_FloatProperty_doc[] =
".. function:: FloatProperty(name=\"\", description=\"\", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, hidden=False)\n"
"\n"
@@ -129,7 +224,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -167,7 +262,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -187,38 +282,15 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiii:FloatVectorProperty", kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &hidden, &size))
return NULL;
if(size < 0 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): size must be between 0 and %d, given %d.", PYRNA_STACK_ARRAY, size);
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY);
return NULL;
}
if(pydef) {
int i;
if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
return NULL;
if(!PySequence_Check(pydef)) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): default value is not a sequence of size: %d.", size);
return NULL;
}
if(size != PySequence_Size(pydef)) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): size: %d, does not default: %d.", size, PySequence_Size(pydef));
return NULL;
}
for(i=0; i<size; i++) {
PyObject *item= PySequence_GetItem(pydef, i);
if(item) {
def[i]= PyFloat_AsDouble(item);
Py_DECREF(item);
}
}
if(PyErr_Occurred()) { /* error set above */
return NULL;
}
}
prop= RNA_def_float_vector(srna, id, size, pydef ? def:NULL, min, max, name, description, soft_min, soft_max);
prop= RNA_def_float_array(srna, id, size, pydef ? def:NULL, min, max, name, description, soft_min, soft_max);
RNA_def_property_ui_range(prop, min, max, step, precision);
if(hidden) RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_duplicate_pointers(prop);
@@ -237,7 +309,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -322,7 +394,7 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -387,7 +459,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -433,7 +505,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
if (PyTuple_Size(args) > 0) {
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
@@ -470,7 +542,9 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
static struct PyMethodDef props_methods[] = {
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
{"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntVectorProperty_doc},
{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatProperty_doc},
{"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatVectorProperty_doc},
{"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, BPy_StringProperty_doc},

View File

@@ -31,7 +31,9 @@ PyObject *BPY_rna_props( void );
/* functions for setting up new props - experemental */
PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw);

View File

@@ -3184,7 +3184,9 @@ PyTypeObject pyrna_prop_Type = {
static struct PyMethodDef pyrna_struct_subtype_methods[] = {
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, ""},

View File

@@ -1,69 +0,0 @@
/**
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "bpy_ui.h"
#include "bpy_util.h"
#include "bpy_rna.h" /* for rna buttons */
#include "bpy_operator.h" /* for setting button operator properties */
#include "WM_types.h" /* for WM_OP_INVOKE_DEFAULT & friends */
#include "BLI_dynstr.h"
#include "MEM_guardedalloc.h"
#include "BKE_global.h" /* evil G.* */
#include "BKE_context.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h" /* only for SpaceLink */
#include "UI_interface.h"
#include "WM_api.h"
/* Dummy Module, may want to include non RNA UI functions here, else it can be removed */
static struct PyMethodDef ui_methods[] = {
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef ui_module = {
PyModuleDef_HEAD_INIT,
"_bpy.ui",
"",
-1,/* multiple "initialization" just copies the module dict. */
ui_methods,
NULL, NULL, NULL, NULL
};
PyObject *BPY_ui_module( void )
{
PyObject *submodule;
submodule= PyModule_Create(&ui_module);
/* INCREF since its its assumed that all these functions return the
* module with a new ref like PyDict_New, since they are passed to
* PyModule_AddObject which steals a ref */
Py_INCREF(submodule);
return submodule;
}

View File

@@ -373,3 +373,56 @@ int BPy_errors_to_report(ReportList *reports)
return 1;
}
/* array utility function */
int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix)
{
PyObject *value_fast;
int value_len;
int i;
if(!(value_fast=PySequence_Fast(value, error_prefix))) {
return -1;
}
value_len= PySequence_Fast_GET_SIZE(value_fast);
if(value_len != length) {
Py_DECREF(value);
PyErr_Format(PyExc_TypeError, "%s: invalid sequence length. expected %d, got %d.", error_prefix, length, value_len);
return -1;
}
/* for each type */
if(type == &PyFloat_Type) {
float *array_float= array;
for(i=0; i<length; i++) {
array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if(type == &PyLong_Type) {
int *array_int= array;
for(i=0; i<length; i++) {
array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if(type == &PyBool_Type) {
int *array_bool= array;
for(i=0; i<length; i++) {
array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
else {
Py_DECREF(value_fast);
PyErr_Format(PyExc_TypeError, "%s: internal error %s is invalid.", error_prefix, type->tp_name);
return -1;
}
Py_DECREF(value_fast);
if(PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError, "%s: one or more items could not be used as a %s.", error_prefix, type->tp_name);
return -1;
}
return 0;
}

View File

@@ -78,5 +78,5 @@ void BPy_SetContext(struct bContext *C);
extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix);
#endif