Merged changes in the trunk up to revision 32684.

This commit is contained in:
2010-10-24 13:05:09 +00:00
362 changed files with 4293 additions and 22486 deletions

View File

@@ -25,8 +25,6 @@
ADD_SUBDIRECTORY(generic)
FILE(GLOB SRC intern/*.c)
SET(INC
.
../blenlib
@@ -41,6 +39,21 @@ SET(INC
${PYTHON_INC}
)
SET(SRC
intern/bpy.c
intern/bpy_app.c
intern/bpy_array.c
intern/bpy_driver.c
intern/bpy_interface.c
intern/bpy_operator.c
intern/bpy_operator_wrap.c
intern/bpy_props.c
intern/bpy_rna.c
intern/bpy_rna_callback.c
intern/bpy_util.c
intern/stubs.c
)
# only to check if buildinfo is available
IF(WITH_BUILDINFO)
ADD_DEFINITIONS(-DBUILD_DATE)

View File

@@ -18,8 +18,6 @@
#
# ***** END GPL LICENSE BLOCK *****
FILE(GLOB SRC *.c)
SET(INC
.
../../blenlib
@@ -31,4 +29,20 @@ SET(INC
${PYTHON_INC}
)
SET(SRC
IDProp.c
bgl.c
blf_api.c
bpy_internal_import.c
geometry.c
mathutils.c
mathutils_color.c
mathutils_euler.c
mathutils_matrix.c
mathutils_quat.c
mathutils_vector.c
noise.c
py_capi_utils.c
)
BLENDERLIB(bf_python_ext "${SRC}" "${INC}")

View File

@@ -258,7 +258,7 @@ static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * se
for(i= 0; i < COLOR_SIZE; i++)
self->col[begin + i] = col[i];
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 0;
}

View File

@@ -209,7 +209,7 @@ static PyObject *Euler_Unique(EulerObject * self)
heading -= (floor(heading * PI_INV)) * PI_2;
heading -= Py_PI;
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -229,7 +229,7 @@ static PyObject *Euler_Zero(EulerObject * self)
self->eul[1] = 0.0;
self->eul[2] = 0.0;
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -266,7 +266,7 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
if(self->order == EULER_ORDER_XYZ) rotate_eul(self->eul, *axis, angle);
else rotate_eulO(self->eul, self->order, *axis, angle);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -300,7 +300,7 @@ static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value)
compatible_eul(self->eul, value->eul);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -488,7 +488,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * se
for(i= 0; i < EULER_SIZE; i++)
self->eul[begin + i] = eul[i];
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 0;
}
@@ -612,7 +612,7 @@ static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closu
return -1;
self->order= order;
BaseMath_WriteCallback(self); /* order can be written back */
(void)BaseMath_WriteCallback(self); /* order can be written back */
return 0;
}

View File

@@ -68,7 +68,7 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype)
for(i=0; i < self->colSize; i++)
self->matrix[subtype][i]= bmo->data[i];
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 1;
}
@@ -92,7 +92,7 @@ static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, i
self->matrix[subtype][index]= bmo->data[index];
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 1;
}
@@ -1004,7 +1004,7 @@ PyObject *Matrix_Invert(MatrixObject * self)
return NULL;
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -1066,7 +1066,7 @@ PyObject *Matrix_Transpose(MatrixObject * self)
transpose_m4((float (*)[4])self->contigPtr);
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -1302,7 +1302,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
self->matrix[i][y] = vec[y];
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 0;
}else{
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: expects a sequence of column size\n");
@@ -1403,7 +1403,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
self->matrix[begin + (int)floor(x / self->colSize)][x % self->colSize] = mat[x];
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 0;
}else{
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation\n");

View File

@@ -257,7 +257,7 @@ static PyObject *Quaternion_Normalize(QuaternionObject * self)
normalize_qt(self->quat);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -277,7 +277,7 @@ static PyObject *Quaternion_Inverse(QuaternionObject * self)
invert_qt(self->quat);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -297,7 +297,7 @@ static PyObject *Quaternion_Identity(QuaternionObject * self)
unit_qt(self->quat);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -317,7 +317,7 @@ static PyObject *Quaternion_Negate(QuaternionObject * self)
mul_qt_fl(self->quat, -1.0f);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -337,7 +337,7 @@ static PyObject *Quaternion_Conjugate(QuaternionObject * self)
conjugate_qt(self->quat);
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -523,7 +523,7 @@ static int Quaternion_ass_slice(QuaternionObject * self, int begin, int end, PyO
for(i= 0; i < size; i++)
self->quat[begin + i] = quat[i];
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
return 0;
}

View File

@@ -80,7 +80,7 @@ static PyObject *Vector_Zero(VectorObject *self)
self->vec[i] = 0.0f;
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -113,7 +113,7 @@ static PyObject *Vector_Normalize(VectorObject *self)
self->vec[i] /= norm;
}
BaseMath_WriteCallback(self);
(void)BaseMath_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -940,7 +940,7 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
vec1->vec[i] = vec1->vec[i] + vec2->vec[i];
}
BaseMath_WriteCallback(vec1);
(void)BaseMath_WriteCallback(vec1);
Py_INCREF( v1 );
return v1;
}
@@ -1000,7 +1000,7 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
vec1->vec[i] = vec1->vec[i] - vec2->vec[i];
}
BaseMath_WriteCallback(vec1);
(void)BaseMath_WriteCallback(vec1);
Py_INCREF( v1 );
return v1;
}
@@ -1122,7 +1122,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
return NULL;
}
BaseMath_WriteCallback(vec);
(void)BaseMath_WriteCallback(vec);
Py_INCREF( v1 );
return v1;
}
@@ -1184,7 +1184,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
vec1->vec[i] /= scalar;
}
BaseMath_WriteCallback(vec1);
(void)BaseMath_WriteCallback(vec1);
Py_INCREF( v1 );
return v1;
@@ -1501,7 +1501,7 @@ static int Vector_setLength(VectorObject *self, PyObject * value )
self->vec[i]= self->vec[i] / (float)dot;
}
BaseMath_WriteCallback(self); /* checked already */
(void)BaseMath_WriteCallback(self); /* checked already */
return 0;
}
@@ -2067,7 +2067,7 @@ static PyObject *Vector_Negate(VectorObject *self)
for(i = 0; i < self->size; i++)
self->vec[i] = -(self->vec[i]);
BaseMath_WriteCallback(self); // already checked for error
(void)BaseMath_WriteCallback(self); // already checked for error
Py_INCREF(self);
return (PyObject*)self;

View File

@@ -42,6 +42,7 @@ extern char build_type[];
extern char build_cflags[];
extern char build_cxxflags[];
extern char build_linkflags[];
extern char build_system[];
#endif
static PyTypeObject BlenderAppType;
@@ -61,6 +62,7 @@ static PyStructSequence_Field app_info_fields[] = {
{"build_cflags", ""},
{"build_cxxflags", ""},
{"build_linkflags", ""},
{"build_system", ""},
{0}
};
@@ -105,6 +107,7 @@ static PyObject *make_app_info(void)
SetStrItem(build_cflags);
SetStrItem(build_cxxflags);
SetStrItem(build_linkflags);
SetStrItem(build_system);
#else
SetStrItem("Unknown");
SetStrItem("Unknown");
@@ -114,6 +117,7 @@ static PyObject *make_app_info(void)
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
#endif
#undef SetIntItem

View File

@@ -132,6 +132,27 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \
} \
/* terse macros for error checks shared between all funcs cant use function
* calls because of static strins passed to pyrna_set_to_enum_bitfield */
#define BPY_PROPDEF_CHECK(_func) \
if(id_len >= MAX_IDPROP_NAME) { \
PyErr_Format(PyExc_TypeError, #_func"(): '%.200s' too long, max length is %d", id, MAX_IDPROP_NAME-1); \
return NULL; \
} \
if(RNA_def_property_free_identifier(srna, id) == -1) { \
PyErr_Format(PyExc_TypeError, #_func"(): '%s' is defined as a non-dynamic type.", id); \
return NULL; \
} \
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, #_func"(options={...}):")) \
return NULL; \
#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _subtype) \
BPY_PROPDEF_CHECK(_func) \
if(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \
PyErr_Format(PyExc_TypeError, #_func"(subtype='%s'): invalid subtype.", pysubtype); \
return NULL; \
} \
#if 0
static int bpy_struct_id_used(StructRNA *srna, char *identifier)
@@ -164,6 +185,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
if(srna) {
static char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", NULL};
char *id=NULL, *name="", *description="";
int id_len;
int def=0;
PropertyRNA *prop;
PyObject *pyopts= NULL;
@@ -171,23 +193,11 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiO!s:BoolProperty", (char **)kwlist, &id, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssiO!s:BoolProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "BoolProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(BoolProperty, property_subtype_number_items)
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "BoolProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
// prop= RNA_def_boolean(srna, id, def, name, description);
prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
RNA_def_property_boolean_default(prop, def);
RNA_def_property_ui_text(prop, name, description);
@@ -220,6 +230,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", "size", NULL};
char *id=NULL, *name="", *description="";
int id_len;
int def[PYRNA_STACK_ARRAY]={0};
int size=3;
PropertyRNA *prop;
@@ -229,21 +240,10 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolVectorProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(BoolVectorProperty, property_subtype_array_items)
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
@@ -287,6 +287,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL};
char *id=NULL, *name="", *description="";
int id_len;
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0;
PropertyRNA *prop;
PyObject *pyopts= NULL;
@@ -294,21 +295,10 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "IntProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "IntProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(IntProperty, property_subtype_number_items)
prop= RNA_def_property(srna, id, PROP_INT, subtype);
RNA_def_property_int_default(prop, def);
@@ -343,6 +333,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL};
char *id=NULL, *name="", *description="";
int id_len;
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0};
int size=3;
PropertyRNA *prop;
@@ -352,21 +343,10 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype, &size))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOiiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntVectorProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(IntVectorProperty, property_subtype_array_items)
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
@@ -413,6 +393,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL};
char *id=NULL, *name="", *description="";
int id_len;
float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f;
int precision= 2;
PropertyRNA *prop;
@@ -423,21 +404,10 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
char *pyunit= NULL;
int unit= PROP_UNIT_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "FloatProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "FloatProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_subtype_number_items)
if(pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) {
PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit.");
@@ -477,6 +447,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL};
char *id=NULL, *name="", *description="";
int id_len;
float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f};
int precision= 2, size=3;
PropertyRNA *prop;
@@ -486,21 +457,10 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatVectorProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, property_subtype_array_items)
if(size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
@@ -544,6 +504,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
if(srna) {
static const char *kwlist[] = {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL};
char *id=NULL, *name="", *description="", *def="";
int id_len;
int maxlen=0;
PropertyRNA *prop;
PyObject *pyopts= NULL;
@@ -551,21 +512,10 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
char *pysubtype= NULL;
int subtype= PROP_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sssiO!s:StringProperty", (char **)kwlist, &id, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|sssiO!s:StringProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "StringProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "StringProperty(options={...}):"))
return NULL;
if(pysubtype && RNA_enum_value_from_id(property_subtype_string_items, pysubtype, &subtype)==0) {
PyErr_Format(PyExc_TypeError, "StringProperty(subtype='%s'): invalid subtype.", pysubtype);
return NULL;
}
BPY_PROPDEF_SUBTYPE_CHECK(StringProperty, property_subtype_string_items)
prop= RNA_def_property(srna, id, PROP_STRING, subtype);
if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */
@@ -645,6 +595,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
if(srna) {
static const char *kwlist[] = {"attr", "items", "name", "description", "default", "options", NULL};
char *id=NULL, *name="", *description="", *def="";
int id_len;
int defvalue=0;
PyObject *items= Py_None;
EnumPropertyItem *eitems;
@@ -652,16 +603,10 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
PyObject *pyopts= NULL;
int opts=0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|sssO!:EnumProperty", (char **)kwlist, &id, &items, &name, &description, &def, &PySet_Type, &pyopts))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|sssO!:EnumProperty", (char **)kwlist, &id, &id_len, &items, &name, &description, &def, &PySet_Type, &pyopts))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "EnumProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "EnumProperty(options={...}):"))
return NULL;
BPY_PROPDEF_CHECK(EnumProperty)
eitems= enum_items_from_py(items, def, &defvalue);
if(!eitems)
@@ -718,22 +663,17 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
if(srna) {
static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
char *id=NULL, *name="", *description="";
int id_len;
PropertyRNA *prop;
StructRNA *ptype;
PyObject *type= Py_None;
PyObject *pyopts= NULL;
int opts=0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:PointerProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|ssO!:PointerProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, &PySet_Type, &pyopts))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "PointerProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "PointerProperty(options={...}):"))
return NULL;
BPY_PROPDEF_CHECK(PointerProperty)
ptype= pointer_type_from_py(type, "PointerProperty(...):");
if(!ptype)
@@ -767,22 +707,17 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
if(srna) {
static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
char *id=NULL, *name="", *description="";
int id_len;
PropertyRNA *prop;
StructRNA *ptype;
PyObject *type= Py_None;
PyObject *pyopts= NULL;
int opts=0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:CollectionProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts))
if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|ssO!:CollectionProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, &PySet_Type, &pyopts))
return NULL;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "CollectionProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "CollectionProperty(options={...}):"))
return NULL;
BPY_PROPDEF_CHECK(CollectionProperty)
ptype= pointer_type_from_py(type, "CollectionProperty(...):");
if(!ptype)