minor edits to exception formatting (remove ... or \n from suffix)
This commit is contained in:
@@ -89,7 +89,7 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
|
||||
int i;
|
||||
|
||||
if (!seq) {
|
||||
PyErr_Format( PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len);
|
||||
PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ static PyGetSetDef BPy_IDGroup_getseters[] = {
|
||||
static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self)
|
||||
{
|
||||
if (self->prop->type != IDP_GROUP) {
|
||||
PyErr_SetString( PyExc_TypeError, "len() of unsized object");
|
||||
PyErr_SetString(PyExc_TypeError, "len() of unsized object");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -232,21 +232,21 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
|
||||
char *name;
|
||||
|
||||
if (self->prop->type != IDP_GROUP) {
|
||||
PyErr_SetString( PyExc_TypeError, "unsubscriptable object");
|
||||
PyErr_SetString(PyExc_TypeError, "unsubscriptable object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name= _PyUnicode_AsString(item);
|
||||
|
||||
if (name == NULL) {
|
||||
PyErr_SetString( PyExc_TypeError, "only strings are allowed as keys of ID properties");
|
||||
PyErr_SetString(PyExc_TypeError, "only strings are allowed as keys of ID properties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idprop= IDP_GetPropertyFromGroup(self->prop, name);
|
||||
|
||||
if(idprop==NULL) {
|
||||
PyErr_SetString( PyExc_KeyError, "key not in subgroup dict");
|
||||
PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
|
||||
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
|
||||
{
|
||||
if (prop->type != IDP_GROUP) {
|
||||
PyErr_SetString( PyExc_TypeError, "unsubscriptable object");
|
||||
PyErr_SetString(PyExc_TypeError, "unsubscriptable object");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
|
||||
MEM_freeN(pkey);
|
||||
return 0;
|
||||
} else {
|
||||
PyErr_SetString( PyExc_KeyError, "property not found in group" );
|
||||
PyErr_SetString(PyExc_KeyError, "property not found in group");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -435,13 +435,13 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
|
||||
const char *err;
|
||||
|
||||
if (!PyUnicode_Check(key)) {
|
||||
PyErr_SetString( PyExc_TypeError, "only strings are allowed as subgroup keys" );
|
||||
PyErr_SetString(PyExc_TypeError, "only strings are allowed as subgroup keys");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = BPy_IDProperty_Map_ValidateAndCreate(_PyUnicode_AsString(key), prop, val);
|
||||
if (err) {
|
||||
PyErr_SetString( PyExc_KeyError, err );
|
||||
PyErr_SetString(PyExc_KeyError, err );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
|
||||
int i;
|
||||
|
||||
if (!seq) {
|
||||
PyErr_Format( PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_ARRAY: PyList_New(%d) failed", prop->len);
|
||||
PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_ARRAY: PyList_New(%d) failed", prop->len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
|
||||
int i;
|
||||
|
||||
if (!seq) {
|
||||
PyErr_Format( PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len);
|
||||
PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
|
||||
char *name = _PyUnicode_AsString(value);
|
||||
|
||||
if (!name) {
|
||||
PyErr_SetString( PyExc_TypeError, "pop expected at least 1 argument, got 0" );
|
||||
PyErr_SetString(PyExc_TypeError, "pop expected at least 1 argument, got 0");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
|
||||
return pyform;
|
||||
}
|
||||
|
||||
PyErr_SetString( PyExc_KeyError, "item not in group" );
|
||||
PyErr_SetString(PyExc_KeyError, "item not in group");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -693,7 +693,7 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
|
||||
char *name = _PyUnicode_AsString(value);
|
||||
|
||||
if (!name) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected a string");
|
||||
PyErr_SetString(PyExc_TypeError, "expected a string");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -706,7 +706,7 @@ static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
|
||||
Py_ssize_t i=0;
|
||||
|
||||
if (!PyDict_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected an object derived from dict.");
|
||||
PyErr_SetString(PyExc_TypeError, "expected an object derived from dict");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ static int BPy_IDArray_Len(BPy_IDArray *self)
|
||||
static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
|
||||
{
|
||||
if (index < 0 || index >= self->prop->len) {
|
||||
PyErr_SetString( PyExc_IndexError, "index out of range!");
|
||||
PyErr_SetString(PyExc_IndexError, "index out of range!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
|
||||
break;
|
||||
}
|
||||
|
||||
PyErr_SetString( PyExc_RuntimeError, "invalid/corrupt array type!");
|
||||
PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
|
||||
double d;
|
||||
|
||||
if (index < 0 || index >= self->prop->len) {
|
||||
PyErr_SetString( PyExc_RuntimeError, "index out of range!");
|
||||
PyErr_SetString(PyExc_RuntimeError, "index out of range!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
|
||||
return PyUnicode_FromString(cur->name);
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString( PyExc_StopIteration, "iterator at end" );
|
||||
PyErr_SetString(PyExc_StopIteration, "iterator at end");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject * value)
|
||||
if(i<0) i= COLOR_SIZE-i;
|
||||
|
||||
if(i < 0 || i >= COLOR_SIZE){
|
||||
PyErr_SetString(PyExc_IndexError, "color[attribute] = x: array assignment index out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError, "color[attribute] = x: array assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ static char Euler_MakeCompatible_doc[] =
|
||||
static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value)
|
||||
{
|
||||
if(!EulerObject_Check(value)) {
|
||||
PyErr_SetString(PyExc_TypeError, "euler.make_compatible(euler): expected a single euler argument.");
|
||||
PyErr_SetString(PyExc_TypeError, "euler.make_compatible(euler): expected a single euler argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value)
|
||||
return NULL;
|
||||
|
||||
if(self->order != value->order) {
|
||||
PyErr_SetString(PyExc_ValueError, "euler.make_compatible(euler): rotation orders don't match\n");
|
||||
PyErr_SetString(PyExc_ValueError, "euler.make_compatible(euler): rotation orders don't match");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
|
||||
if(i<0) i= EULER_SIZE-i;
|
||||
|
||||
if(i < 0 || i >= EULER_SIZE){
|
||||
PyErr_SetString(PyExc_IndexError, "euler[attribute] = x: array assignment index out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError, "euler[attribute] = x: array assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,11 @@ static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args)
|
||||
int clip = 1;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "O!O!O!O!O!|i", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 5 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 5 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
if(vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) {
|
||||
PyErr_SetString( PyExc_TypeError, "only 3D vectors for all parameters\n");
|
||||
PyErr_SetString(PyExc_TypeError, "only 3D vectors for all parameters");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args
|
||||
float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3];
|
||||
|
||||
if( !PyArg_ParseTuple( args, "O!O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4 ) ) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 4 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 4 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) {
|
||||
PyErr_SetString( PyExc_TypeError,"vectors must be of the same size\n" );
|
||||
PyErr_SetString(PyExc_TypeError,"vectors must be of the same size" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString( PyExc_TypeError, "2D/3D vectors only\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "2D/3D vectors only" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -210,15 +210,15 @@ static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args)
|
||||
float v1[3], v2[3], v3[3], v4[3], e1[3], e2[3], n1[3], n2[3];
|
||||
|
||||
if( !PyArg_ParseTuple( args, "O!O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4 ) ) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 4 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 4 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) {
|
||||
PyErr_SetString( PyExc_TypeError,"vectors must be of the same size\n" );
|
||||
PyErr_SetString(PyExc_TypeError,"vectors must be of the same size" );
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != 3 ) {
|
||||
PyErr_SetString( PyExc_TypeError, "only 3D vectors\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "only 3D vectors" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -258,15 +258,15 @@ static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* arg
|
||||
float v1[3], v2[3], v3[3], e1[3], e2[3], n[3];
|
||||
|
||||
if( !PyArg_ParseTuple( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3 ) ) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 3 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 3 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != vec2->size || vec1->size != vec3->size ) {
|
||||
PyErr_SetString( PyExc_TypeError, "vectors must be of the same size\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "vectors must be of the same size" );
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != 3 ) {
|
||||
PyErr_SetString( PyExc_TypeError, "only 3D vectors\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "only 3D vectors" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -297,11 +297,11 @@ static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args)
|
||||
if( !PyArg_ParseTuple
|
||||
( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
|
||||
, &vector_Type, &vec3 ) ) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 3 vector types\n");
|
||||
PyErr_SetString(PyExc_TypeError, "expected 3 vector types");
|
||||
return NULL;
|
||||
}
|
||||
if( vec1->size != vec2->size || vec1->size != vec3->size ) {
|
||||
PyErr_SetString( PyExc_TypeError, "vectors must be of the same size\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "vectors must be of the same size" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args)
|
||||
return PyFloat_FromDouble( area_tri_v2(v1, v2, v3) );
|
||||
}
|
||||
else {
|
||||
PyErr_SetString( PyExc_TypeError, "only 2D,3D vectors are supported\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "only 2D,3D vectors are supported" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLine
|
||||
|
||||
|
||||
if(!PySequence_Check(polyLineSeq)) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected a sequence of poly lines" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected a sequence of poly lines" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLine
|
||||
if (!PySequence_Check(polyLine)) {
|
||||
freedisplist(&dispbase);
|
||||
Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/
|
||||
PyErr_SetString( PyExc_TypeError, "One or more of the polylines is not a sequence of mathutils.Vector's" );
|
||||
PyErr_SetString(PyExc_TypeError, "One or more of the polylines is not a sequence of mathutils.Vector's" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLine
|
||||
if (EXPP_check_sequence_consistency( polyLine, &vector_Type ) != 1) {
|
||||
freedisplist(&dispbase);
|
||||
Py_DECREF(polyLine);
|
||||
PyErr_SetString( PyExc_TypeError, "A point in one of the polylines is not a mathutils.Vector type" );
|
||||
PyErr_SetString(PyExc_TypeError, "A point in one of the polylines is not a mathutils.Vector type" );
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -414,7 +414,7 @@ static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLine
|
||||
|
||||
if(ls_error) {
|
||||
freedisplist(&dispbase); /* possible some dl was allocated */
|
||||
PyErr_SetString( PyExc_TypeError, "A point in one of the polylines is not a mathutils.Vector type" );
|
||||
PyErr_SetString(PyExc_TypeError, "A point in one of the polylines is not a mathutils.Vector type" );
|
||||
return NULL;
|
||||
}
|
||||
else if (totpoints) {
|
||||
@@ -428,7 +428,7 @@ static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLine
|
||||
tri_list= PyList_New(dl->parts);
|
||||
if( !tri_list ) {
|
||||
freedisplist(&dispbase);
|
||||
PyErr_SetString( PyExc_RuntimeError, "geometry.PolyFill failed to make a new list" );
|
||||
PyErr_SetString(PyExc_RuntimeError, "geometry.PolyFill failed to make a new list" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* ar
|
||||
&vector_Type, &line_b1,
|
||||
&vector_Type, &line_b2)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 4 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 4 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject*
|
||||
&vector_Type, &line_1,
|
||||
&vector_Type, &line_2)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 3 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 3 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject*
|
||||
&vector_Type, &tri_p2,
|
||||
&vector_Type, &tri_p3)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 4 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 4 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args
|
||||
&vector_Type, &quad_p3,
|
||||
&vector_Type, &quad_p4)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 5 vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 5 vector types" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ static int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
|
||||
|
||||
/* Error checking must already be done */
|
||||
if( !PyList_Check( value ) ) {
|
||||
PyErr_SetString( PyExc_TypeError, "can only back a list of [x,y,x,w]" );
|
||||
PyErr_SetString(PyExc_TypeError, "can only back a list of [x,y,x,w]" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -649,7 +649,7 @@ static int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
|
||||
list_item = PyList_GET_ITEM( value, i );
|
||||
if( !PyList_Check( list_item ) || PyList_Size( list_item ) < 4 ) {
|
||||
MEM_freeN(*boxarray);
|
||||
PyErr_SetString( PyExc_TypeError, "can only back a list of [x,y,x,w]" );
|
||||
PyErr_SetString(PyExc_TypeError, "can only back a list of [x,y,x,w]" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ static int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
|
||||
|
||||
if (!PyNumber_Check(item_1) || !PyNumber_Check(item_2)) {
|
||||
MEM_freeN(*boxarray);
|
||||
PyErr_SetString( PyExc_TypeError, "can only back a list of 2d boxes [x,y,x,w]" );
|
||||
PyErr_SetString(PyExc_TypeError, "can only back a list of 2d boxes [x,y,x,w]" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist
|
||||
int error;
|
||||
|
||||
if(!PyList_Check(boxlist)) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected a sequence of boxes [[x,y,w,h], ... ]" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected a sequence of boxes [[x,y,w,h], ... ]" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args)
|
||||
&vector_Type, &vec_h2,
|
||||
&vector_Type, &vec_k2, &resolu) || (resolu<=1)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 4 vector types and an int greater then 1\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 4 vector types and an int greater then 1" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -789,7 +789,7 @@ static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObjec
|
||||
vec_t2_tar->size != 3 ||
|
||||
vec_t3_tar->size != 3)
|
||||
) {
|
||||
PyErr_SetString( PyExc_TypeError, "expected 7, 3D vector types\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "expected 7, 3D vector types" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
|
||||
|
||||
argSize = PyTuple_GET_SIZE(args);
|
||||
if(argSize > MATRIX_MAX_DIM) { //bad arg nums
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size");
|
||||
return NULL;
|
||||
} else if (argSize == 0) { //return empty 4D matrix
|
||||
return (PyObject *) newMatrixObject(NULL, 4, 4, Py_NEW, NULL);
|
||||
@@ -143,13 +143,13 @@ static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
|
||||
if (PySequence_Check(argObject)) { //seq?
|
||||
if(seqSize){ //0 at first
|
||||
if(PySequence_Length(argObject) != seqSize){ //seq size not same
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
seqSize = PySequence_Length(argObject);
|
||||
}else{ //arg not a sequence
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -157,14 +157,14 @@ static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
|
||||
for (i = 0; i < argSize; i++){
|
||||
m = PyTuple_GET_ITEM(args, i);
|
||||
if (m == NULL) { // Failed to read sequence
|
||||
PyErr_SetString(PyExc_RuntimeError, "mathutils.Matrix(): failed to parse arguments...\n");
|
||||
PyErr_SetString(PyExc_RuntimeError, "mathutils.Matrix(): failed to parse arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (j = 0; j < seqSize; j++) {
|
||||
s = PySequence_GetItem(m, j);
|
||||
if (s == NULL) { // Failed to read sequence
|
||||
PyErr_SetString(PyExc_RuntimeError, "mathutils.Matrix(): failed to parse arguments...\n");
|
||||
PyErr_SetString(PyExc_RuntimeError, "mathutils.Matrix(): failed to parse arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
|
||||
Py_DECREF(s);
|
||||
|
||||
if(scalar==-1 && PyErr_Occurred()) { // parsed item is not a number
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -211,14 +211,14 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
if(!PyArg_ParseTuple(args, "fi|O", &angle, &matSize, &vec)) {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.RotationMatrix(angle, size, axis): expected float int and a string or vector\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.RotationMatrix(angle, size, axis): expected float int and a string or vector");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(vec && !VectorObject_Check(vec)) {
|
||||
axis= _PyUnicode_AsString((PyObject *)vec);
|
||||
if(axis==NULL || axis[0]=='\0' || axis[1]!='\0' || axis[0] < 'X' || axis[0] > 'Z') {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.RotationMatrix(): 3rd argument axis value must be a 3D vector or a string in 'X', 'Y', 'Z'\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.RotationMatrix(): 3rd argument axis value must be a 3D vector or a string in 'X', 'Y', 'Z'");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -233,20 +233,20 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
||||
angle-=(Py_PI*2);
|
||||
|
||||
if(matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): can only return a 2x2 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
if(matSize == 2 && (vec != NULL)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): cannot create a 2x2 rotation matrix around arbitrary axis\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): cannot create a 2x2 rotation matrix around arbitrary axis");
|
||||
return NULL;
|
||||
}
|
||||
if((matSize == 3 || matSize == 4) && (axis == NULL) && (vec == NULL)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): please choose an axis of rotation for 3d and 4d matrices\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): please choose an axis of rotation for 3d and 4d matrices");
|
||||
return NULL;
|
||||
}
|
||||
if(vec) {
|
||||
if(vec->size != 3) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): the vector axis must be a 3D vector\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): the vector axis must be a 3D vector");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
||||
}
|
||||
else {
|
||||
/* should never get here */
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): unknown error\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): unknown error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -325,11 +325,11 @@ static PyObject *C_Matrix_Translation(PyObject *cls, VectorObject * vec)
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
if(!VectorObject_Check(vec)) {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): expected vector\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): expected vector");
|
||||
return NULL;
|
||||
}
|
||||
if(vec->size != 3 && vec->size != 4) {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): vector must be 3D or 4D\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): vector must be 3D or 4D");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -369,16 +369,16 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
if(!PyArg_ParseTuple(args, "fi|O!", &factor, &matSize, &vector_Type, &vec)) {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Scale(): expected float int and optional vector\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Scale(): expected float int and optional vector");
|
||||
return NULL;
|
||||
}
|
||||
if(matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): can only return a 2x2 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): can only return a 2x2 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
if(vec) {
|
||||
if(vec->size > 2 && matSize == 2) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): please use 2D vectors when scaling in 2D\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): please use 2D vectors when scaling in 2D");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -460,16 +460,16 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
if(!PyArg_ParseTuple(args, "si|O!", &plane, &matSize, &vector_Type, &vec)) {
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.OrthoProjection(): expected string and int and optional vector\n");
|
||||
PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.OrthoProjection(): expected string and int and optional vector");
|
||||
return NULL;
|
||||
}
|
||||
if(matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.OrthoProjection(): can only return a 2x2 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.OrthoProjection(): can only return a 2x2 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
if(vec) {
|
||||
if(vec->size > 2 && matSize == 2) {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): please use 2D vectors when scaling in 2D\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): please use 2D vectors when scaling in 2D");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
||||
mat[4] = 1.0f;
|
||||
mat[8] = 1.0f;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: X, Y, XY, XZ, YZ\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: X, Y, XY, XZ, YZ");
|
||||
return NULL;
|
||||
}
|
||||
} else { //arbitrary plane
|
||||
@@ -520,7 +520,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
||||
mat[7] = -(vec->vec[1] * vec->vec[2]);
|
||||
mat[8] = 1 - (vec->vec[2] * vec->vec[2]);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: 'r' expected for axis designation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: 'r' expected for axis designation");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -562,11 +562,11 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
if(!PyArg_ParseTuple(args, "sfi", &plane, &factor, &matSize)) {
|
||||
PyErr_SetString(PyExc_TypeError,"mathutils.Matrix.Shear(): expected string float and int\n");
|
||||
PyErr_SetString(PyExc_TypeError,"mathutils.Matrix.Shear(): expected string float and int");
|
||||
return NULL;
|
||||
}
|
||||
if(matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.Shear(): can only return a 2x2 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.Shear(): can only return a 2x2 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
|
||||
mat[4] = 1.0f;
|
||||
mat[8] = 1.0f;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Shear(): expected: x, y, xy, xz, yz or wrong matrix size for shearing plane\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Shear(): expected: x, y, xy, xz, yz or wrong matrix size for shearing plane");
|
||||
return NULL;
|
||||
}
|
||||
if(matSize == 4) {
|
||||
@@ -706,7 +706,7 @@ PyObject *Matrix_toEuler(MatrixObject * self, PyObject *args)
|
||||
copy_m3_m4(tmat, (float (*)[4])self->contigPtr);
|
||||
mat= tmat;
|
||||
}else {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.to_euler(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.to_euler(): inappropriate matrix size - expects 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ PyObject *Matrix_RotationPart(MatrixObject * self)
|
||||
return NULL;
|
||||
|
||||
if(self->colSize < 3 || self->rowSize < 3){
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.rotation_part(): inappropriate matrix size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.rotation_part(): inappropriate matrix size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ PyObject *Matrix_scalePart(MatrixObject * self)
|
||||
else if(self->colSize == 3 && self->rowSize == 3)
|
||||
copy_m3_m3(mat, (float (*)[3])self->contigPtr);
|
||||
else {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.scale_part(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.scale_part(): inappropriate matrix size - expects 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
/* functionality copied from editobject.c apply_obmat */
|
||||
@@ -1024,7 +1024,7 @@ static PyObject *Matrix_decompose(MatrixObject * self)
|
||||
float size[3];
|
||||
|
||||
if(self->colSize != 4 || self->rowSize != 4) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.decompose(): inappropriate matrix size - expects 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.decompose(): inappropriate matrix size - expects 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,7 @@ PyObject *Matrix_Identity(MatrixObject * self)
|
||||
return NULL;
|
||||
|
||||
if(self->rowSize != self->colSize){
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.identity: only square matrices are supported\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.identity: only square matrices are supported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1353,27 +1353,27 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
|
||||
return -1;
|
||||
|
||||
if(i >= self->rowSize || i < 0){
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad column\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad column");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(PySequence_Check(ob)){
|
||||
size = PySequence_Length(ob);
|
||||
if(size != self->colSize){
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad sequence size\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad sequence size");
|
||||
return -1;
|
||||
}
|
||||
for (x = 0; x < size; x++) {
|
||||
m = PySequence_GetItem(ob, x);
|
||||
if (m == NULL) { /*Failed to read sequence*/
|
||||
PyErr_SetString(PyExc_RuntimeError, "matrix[attribute] = x: unable to read sequence\n");
|
||||
PyErr_SetString(PyExc_RuntimeError, "matrix[attribute] = x: unable to read sequence");
|
||||
return -1;
|
||||
}
|
||||
|
||||
f = PyNumber_Float(m);
|
||||
if(f == NULL) { /*parsed item not a number*/
|
||||
Py_DECREF(m);
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: sequence argument not a number\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: sequence argument not a number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1389,7 +1389,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
|
||||
(void)BaseMath_WriteCallback(self);
|
||||
return 0;
|
||||
}else{
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: expects a sequence of column size\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: expects a sequence of column size");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1436,7 +1436,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
|
||||
if(PySequence_Check(seq)){
|
||||
size = PySequence_Length(seq);
|
||||
if(size != (end - begin)){
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: size mismatch in slice assignment\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: size mismatch in slice assignment");
|
||||
return -1;
|
||||
}
|
||||
/*parse sub items*/
|
||||
@@ -1453,14 +1453,14 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
|
||||
sub_size = PySequence_Length(subseq);
|
||||
if(sub_size != self->colSize){
|
||||
Py_DECREF(subseq);
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: size mismatch in slice assignment\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: size mismatch in slice assignment");
|
||||
return -1;
|
||||
}
|
||||
for (y = 0; y < sub_size; y++) {
|
||||
m = PySequence_GetItem(subseq, y);
|
||||
if (m == NULL) { /*Failed to read sequence*/
|
||||
Py_DECREF(subseq);
|
||||
PyErr_SetString(PyExc_RuntimeError, "matrix[begin:end] = []: unable to read sequence\n");
|
||||
PyErr_SetString(PyExc_RuntimeError, "matrix[begin:end] = []: unable to read sequence");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1468,7 +1468,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
|
||||
if(f == -1 && PyErr_Occurred()) { /*parsed item not a number*/
|
||||
Py_DECREF(m);
|
||||
Py_DECREF(subseq);
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: sequence argument not a number\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: sequence argument not a number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1477,7 +1477,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
|
||||
}
|
||||
}else{
|
||||
Py_DECREF(subseq);
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation");
|
||||
return -1;
|
||||
}
|
||||
Py_DECREF(subseq);
|
||||
@@ -1490,7 +1490,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject *
|
||||
(void)BaseMath_WriteCallback(self);
|
||||
return 0;
|
||||
}else{
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1507,7 +1507,7 @@ static PyObject *Matrix_add(PyObject * m1, PyObject * m2)
|
||||
mat2 = (MatrixObject*)m2;
|
||||
|
||||
if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation....");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1540,7 +1540,7 @@ static PyObject *Matrix_sub(PyObject * m1, PyObject * m2)
|
||||
mat2 = (MatrixObject*)m2;
|
||||
|
||||
if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation....");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1601,7 +1601,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
|
||||
}
|
||||
|
||||
if(mat1==NULL){
|
||||
scalar=PyFloat_AsDouble(m1); // may not be a float...
|
||||
scalar=PyFloat_AsDouble(m1); // may not be a float
|
||||
if ((scalar == -1.0 && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX, this line annoys theeth, lets see if he finds it */
|
||||
for(x = 0; x < mat2->rowSize; x++) {
|
||||
for(y = 0; y < mat2->colSize; y++) {
|
||||
@@ -1616,7 +1616,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
|
||||
}
|
||||
else /* if(mat1) { */ {
|
||||
if(VectorObject_Check(m2)) { /* MATRIX*VECTOR */
|
||||
PyErr_SetString(PyExc_TypeError, "Matrix multiplication: Only 'vec * matrix' is supported, not the reverse.");
|
||||
PyErr_SetString(PyExc_TypeError, "Matrix multiplication: Only 'vec * matrix' is supported, not the reverse");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -1634,7 +1634,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Matrix multiplication: arguments not acceptable for this operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Matrix multiplication: arguments not acceptable for this operation");
|
||||
return NULL;
|
||||
}
|
||||
static PyObject* Matrix_inv(MatrixObject *self)
|
||||
@@ -1793,7 +1793,7 @@ static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)
|
||||
else if(self->colSize == 3 && self->rowSize == 3)
|
||||
copy_m3_m3(mat, (float (*)[3])self->contigPtr);
|
||||
else {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.median_scale: inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.median_scale: inappropriate matrix size - expects 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,7 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
|
||||
else if(self->colSize == 3 && self->rowSize == 3)
|
||||
return PyBool_FromLong(is_negative_m3((float (*)[3])self->contigPtr));
|
||||
else {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.is_negative: inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.is_negative: inappropriate matrix size - expects 3x3 or 4x4 matrix");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1921,7 +1921,7 @@ self->matrix self->contiguous_ptr (reference to data.xxx)
|
||||
[1]------------->[3]
|
||||
[4]
|
||||
[5]
|
||||
....
|
||||
|
||||
self->matrix[1][1] = self->contigPtr[4] */
|
||||
|
||||
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
@@ -1959,7 +1959,7 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type, PyType
|
||||
}else if (type == Py_NEW){
|
||||
self->contigPtr = PyMem_Malloc(rowSize * colSize * sizeof(float));
|
||||
if(self->contigPtr == NULL) { /*allocation failure*/
|
||||
PyErr_SetString( PyExc_MemoryError, "matrix(): problem allocating pointer space\n");
|
||||
PyErr_SetString(PyExc_MemoryError, "matrix(): problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
/*pointer array points to contigous memory*/
|
||||
|
||||
@@ -138,12 +138,12 @@ static char Quaternion_Cross_doc[] =
|
||||
" :return: The cross product.\n"
|
||||
" :rtype: :class:`Quaternion`\n";
|
||||
|
||||
static PyObject *Quaternion_Cross(QuaternionObject * self, QuaternionObject * value)
|
||||
static PyObject *Quaternion_Cross(QuaternionObject *self, QuaternionObject *value)
|
||||
{
|
||||
float quat[QUAT_SIZE];
|
||||
|
||||
if (!QuaternionObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "quat.cross(value): expected a quaternion argument" );
|
||||
PyErr_Format(PyExc_TypeError, "quat.cross(value): expected a quaternion argument, not %.200s", Py_TYPE(value)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ static char Quaternion_Dot_doc[] =
|
||||
static PyObject *Quaternion_Dot(QuaternionObject * self, QuaternionObject * value)
|
||||
{
|
||||
if (!QuaternionObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "quat.dot(value): expected a quaternion argument" );
|
||||
PyErr_Format(PyExc_TypeError, "quat.dot(value): expected a quaternion argument, not %.200s", Py_TYPE(value)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ static PyObject *Quaternion_Difference(QuaternionObject * self, QuaternionObject
|
||||
float quat[QUAT_SIZE];
|
||||
|
||||
if (!QuaternionObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "quat.difference(value): expected a quaternion argument" );
|
||||
PyErr_Format(PyExc_TypeError, "quat.difference(value): expected a quaternion argument, not %.200s", Py_TYPE(value)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ static PyObject *Quaternion_item(QuaternionObject * self, int i)
|
||||
if(i<0) i= QUAT_SIZE-i;
|
||||
|
||||
if(i < 0 || i >= QUAT_SIZE) {
|
||||
PyErr_SetString(PyExc_IndexError, "quaternion[attribute]: array index out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError, "quaternion[attribute]: array index out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -456,14 +456,14 @@ static int Quaternion_ass_item(QuaternionObject * self, int i, PyObject * ob)
|
||||
{
|
||||
float scalar= (float)PyFloat_AsDouble(ob);
|
||||
if(scalar==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
PyErr_SetString(PyExc_TypeError, "quaternion[index] = x: index argument not a number\n");
|
||||
PyErr_SetString(PyExc_TypeError, "quaternion[index] = x: index argument not a number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(i<0) i= QUAT_SIZE-i;
|
||||
|
||||
if(i < 0 || i >= QUAT_SIZE){
|
||||
PyErr_SetString(PyExc_IndexError, "quaternion[attribute] = x: array assignment index out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError, "quaternion[attribute] = x: array assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
self->quat[i] = scalar;
|
||||
@@ -604,7 +604,7 @@ static PyObject *Quaternion_add(PyObject * q1, PyObject * q2)
|
||||
QuaternionObject *quat1 = NULL, *quat2 = NULL;
|
||||
|
||||
if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Quaternion addition: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Quaternion addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
quat1 = (QuaternionObject*)q1;
|
||||
@@ -625,7 +625,7 @@ static PyObject *Quaternion_sub(PyObject * q1, PyObject * q2)
|
||||
QuaternionObject *quat1 = NULL, *quat2 = NULL;
|
||||
|
||||
if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Quaternion addition: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Quaternion addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Quaternion multiplication: arguments not acceptable for this operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Quaternion multiplication: arguments not acceptable for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ static char Vector_Resize2D_doc[] =
|
||||
static PyObject *Vector_Resize2D(VectorObject *self)
|
||||
{
|
||||
if(self->wrapped==Py_WRAP) {
|
||||
PyErr_SetString(PyExc_TypeError, "vector.resize2D(): cannot resize wrapped data - only python vectors\n");
|
||||
PyErr_SetString(PyExc_TypeError, "vector.resize2D(): cannot resize wrapped data - only python vectors");
|
||||
return NULL;
|
||||
}
|
||||
if(self->cb_user) {
|
||||
@@ -140,7 +140,7 @@ static PyObject *Vector_Resize2D(VectorObject *self)
|
||||
|
||||
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2));
|
||||
if(self->vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize2D(): problem allocating pointer space\n\n");
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize2D(): problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ static char Vector_Resize3D_doc[] =
|
||||
static PyObject *Vector_Resize3D(VectorObject *self)
|
||||
{
|
||||
if (self->wrapped==Py_WRAP) {
|
||||
PyErr_SetString(PyExc_TypeError, "vector.resize3D(): cannot resize wrapped data - only python vectors\n");
|
||||
PyErr_SetString(PyExc_TypeError, "vector.resize3D(): cannot resize wrapped data - only python vectors");
|
||||
return NULL;
|
||||
}
|
||||
if(self->cb_user) {
|
||||
@@ -170,7 +170,7 @@ static PyObject *Vector_Resize3D(VectorObject *self)
|
||||
|
||||
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3));
|
||||
if(self->vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize3D(): problem allocating pointer space\n\n");
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize3D(): problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ static PyObject *Vector_Resize4D(VectorObject *self)
|
||||
|
||||
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4));
|
||||
if(self->vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize4D(): problem allocating pointer space\n\n");
|
||||
PyErr_SetString(PyExc_MemoryError, "vector.resize4D(): problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
if(self->size == 2){
|
||||
@@ -294,7 +294,7 @@ static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
|
||||
return NULL;
|
||||
|
||||
if (self->size != 3) {
|
||||
PyErr_SetString( PyExc_TypeError, "only for 3D vectors\n" );
|
||||
PyErr_SetString(PyExc_TypeError, "only for 3D vectors");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -315,12 +315,12 @@ static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
|
||||
track = 5;
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString( PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString( PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -337,12 +337,12 @@ static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
|
||||
track = 2;
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString( PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString( PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, -X, Y, -Y, Z or -Z for track axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -360,18 +360,18 @@ static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
|
||||
up = 2;
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString( PyExc_ValueError, "only X, Y or Z for up axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, Y or Z for up axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString( PyExc_ValueError, "only X, Y or Z for up axis\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "only X, Y or Z for up axis");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (track == up) {
|
||||
PyErr_SetString( PyExc_ValueError, "Can't have the same axis for track and up\n" );
|
||||
PyErr_SetString(PyExc_ValueError, "Can't have the same axis for track and up");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ static PyObject *Vector_Reflect(VectorObject *self, VectorObject *value )
|
||||
float reflect[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.reflect(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.reflect(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -448,12 +448,12 @@ static PyObject *Vector_Cross(VectorObject *self, VectorObject *value )
|
||||
VectorObject *vecCross = NULL;
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.cross(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.cross(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self->size != 3 || value->size != 3) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.cross(value): expects both vectors to be 3D\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.cross(value): expects both vectors to be 3D");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -481,12 +481,12 @@ static PyObject *Vector_Dot(VectorObject *self, VectorObject *value )
|
||||
int x;
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.dot(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.dot(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self->size != value->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.dot(value): expects both vectors to have the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.dot(value): expects both vectors to have the same size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -523,19 +523,19 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.angle(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.angle(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self->size != value->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.angle(value): expects both vectors to have the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.angle(value): expects both vectors to have the same size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!BaseMath_ReadCallback(self) || !BaseMath_ReadCallback(value))
|
||||
return NULL;
|
||||
|
||||
//since size is the same....
|
||||
//since size is the same
|
||||
size = self->size;
|
||||
|
||||
for(x = 0; x < size; x++) {
|
||||
@@ -549,7 +549,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
|
||||
return fallback;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "vector.angle(other): zero length vectors have no valid angle\n");
|
||||
PyErr_SetString(PyExc_ValueError, "vector.angle(other): zero length vectors have no valid angle");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -582,12 +582,12 @@ static PyObject *Vector_Difference(VectorObject *self, VectorObject *value )
|
||||
float quat[4], vec_a[3], vec_b[3];
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.difference(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.difference(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self->size < 3 || value->size < 3) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.difference(value): expects both vectors to be size 3 or 4\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.difference(value): expects both vectors to be size 3 or 4");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -619,12 +619,12 @@ static PyObject *Vector_Project(VectorObject *self, VectorObject *value)
|
||||
int x, size;
|
||||
|
||||
if (!VectorObject_Check(value)) {
|
||||
PyErr_SetString( PyExc_TypeError, "vec.project(value): expected a vector argument" );
|
||||
PyErr_SetString(PyExc_TypeError, "vec.project(value): expected a vector argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self->size != value->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.project(value): expects both vectors to have the same size\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.project(value): expects both vectors to have the same size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ static PyObject *Vector_Project(VectorObject *self, VectorObject *value)
|
||||
return NULL;
|
||||
|
||||
|
||||
//since they are the same size...
|
||||
//since they are the same size
|
||||
size = self->size;
|
||||
|
||||
//get dot products
|
||||
@@ -709,7 +709,7 @@ static PyObject *Vector_Rotate(VectorObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
if(self->size != 3 || axis_vec->size != 3) {
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.rotate(angle, axis): expects both vectors to be 3D\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "vec.rotate(angle, axis): expects both vectors to be 3D");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ static PyObject *Vector_item(VectorObject *self, int i)
|
||||
if(i<0) i= self->size-i;
|
||||
|
||||
if(i < 0 || i >= self->size) {
|
||||
PyErr_SetString(PyExc_IndexError,"vector[index]: out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError,"vector[index]: out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -788,14 +788,14 @@ static int Vector_ass_item(VectorObject *self, int i, PyObject * ob)
|
||||
{
|
||||
float scalar;
|
||||
if((scalar=PyFloat_AsDouble(ob))==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
PyErr_SetString(PyExc_TypeError, "vector[index] = x: index argument not a number\n");
|
||||
PyErr_SetString(PyExc_TypeError, "vector[index] = x: index argument not a number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(i<0) i= self->size-i;
|
||||
|
||||
if(i < 0 || i >= self->size){
|
||||
PyErr_SetString(PyExc_IndexError, "vector[index] = x: assignment index out of range\n");
|
||||
PyErr_SetString(PyExc_IndexError, "vector[index] = x: assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
self->vec[i] = scalar;
|
||||
@@ -846,20 +846,20 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end,
|
||||
|
||||
size = PySequence_Length(seq);
|
||||
if(size != (end - begin)){
|
||||
PyErr_SetString(PyExc_TypeError, "vector[begin:end] = []: size mismatch in slice assignment\n");
|
||||
PyErr_SetString(PyExc_TypeError, "vector[begin:end] = []: size mismatch in slice assignment");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
v = PySequence_GetItem(seq, i);
|
||||
if (v == NULL) { /* Failed to read sequence */
|
||||
PyErr_SetString(PyExc_RuntimeError, "vector[begin:end] = []: unable to read sequence\n");
|
||||
PyErr_SetString(PyExc_RuntimeError, "vector[begin:end] = []: unable to read sequence");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((scalar=PyFloat_AsDouble(v)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
Py_DECREF(v);
|
||||
PyErr_SetString(PyExc_TypeError, "vector[begin:end] = []: sequence argument not a number\n");
|
||||
PyErr_SetString(PyExc_TypeError, "vector[begin:end] = []: sequence argument not a number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2)
|
||||
|
||||
/*VECTOR + VECTOR*/
|
||||
if(vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation");
|
||||
return NULL;
|
||||
}
|
||||
for(i = 0; i < vec1->size; i++) {
|
||||
@@ -909,7 +909,7 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2)
|
||||
return newVectorObject(vec, vec1->size, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -921,14 +921,14 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
|
||||
VectorObject *vec1 = NULL, *vec2 = NULL;
|
||||
|
||||
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
vec1 = (VectorObject*)v1;
|
||||
vec2 = (VectorObject*)v2;
|
||||
|
||||
if(vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -953,7 +953,7 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
|
||||
VectorObject *vec1 = NULL, *vec2 = NULL;
|
||||
|
||||
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
vec1 = (VectorObject*)v1;
|
||||
@@ -963,7 +963,7 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
|
||||
return NULL;
|
||||
|
||||
if(vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation");
|
||||
return NULL;
|
||||
}
|
||||
for(i = 0; i < vec1->size; i++) {
|
||||
@@ -981,14 +981,14 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
|
||||
VectorObject *vec1 = NULL, *vec2 = NULL;
|
||||
|
||||
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: arguments not valid for this operation....\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: arguments not valid for this operation");
|
||||
return NULL;
|
||||
}
|
||||
vec1 = (VectorObject*)v1;
|
||||
vec2 = (VectorObject*)v2;
|
||||
|
||||
if(vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1070,7 +1070,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
|
||||
double dot = 0.0f;
|
||||
|
||||
if(vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector multiplication: vectors must have the same dimensions for this operation\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Vector multiplication: vectors must have the same dimensions for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
|
||||
float tvec[3];
|
||||
|
||||
if(vec1->size != 3) {
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported");
|
||||
return NULL;
|
||||
}
|
||||
if(!BaseMath_ReadCallback(quat2)) {
|
||||
@@ -1128,7 +1128,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
|
||||
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1159,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
|
||||
QuaternionObject *quat2 = (QuaternionObject*)v2;
|
||||
|
||||
if(vec->size != 3) {
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1172,7 +1172,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
|
||||
mul_vn_fl(vec->vec, vec->size, scalar);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1190,7 +1190,7 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
|
||||
VectorObject *vec1 = NULL;
|
||||
|
||||
if(!VectorObject_Check(v1)) { /* not a vector */
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float");
|
||||
return NULL;
|
||||
}
|
||||
vec1 = (VectorObject*)v1; /* vector */
|
||||
@@ -1199,12 +1199,12 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
|
||||
return NULL;
|
||||
|
||||
if((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(scalar==0.0) {
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error.\n");
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1226,12 +1226,12 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
|
||||
return NULL;
|
||||
|
||||
if((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float\n");
|
||||
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(scalar==0.0) {
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error.\n");
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
|
||||
return NULL;
|
||||
}
|
||||
for(i = 0; i < vec1->size; i++) {
|
||||
@@ -1527,7 +1527,7 @@ static int Vector_setLength(VectorObject *self, PyObject * value )
|
||||
}
|
||||
|
||||
if (param < 0.0f) {
|
||||
PyErr_SetString( PyExc_TypeError, "cannot set a vectors length to a negative value" );
|
||||
PyErr_SetString(PyExc_TypeError, "cannot set a vectors length to a negative value");
|
||||
return -1;
|
||||
}
|
||||
if (param == 0.0f) {
|
||||
@@ -1580,7 +1580,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
|
||||
{
|
||||
axis_from = swizzleClosure & SWIZZLE_AXIS;
|
||||
if(axis_from >= self->size) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector does not have specified axis.");
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector does not have specified axis");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1627,7 +1627,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure
|
||||
axis_to = swizzleClosure & SWIZZLE_AXIS;
|
||||
if (axis_to >= self->size)
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector does not have specified axis.\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector does not have specified axis");
|
||||
return -1;
|
||||
}
|
||||
swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
|
||||
@@ -1646,7 +1646,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure
|
||||
}
|
||||
|
||||
if(axis_from != size_from) {
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector size does not match swizzle.\n");
|
||||
PyErr_SetString(PyExc_AttributeError, "Error: vector size does not match swizzle");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
||||
|
||||
if(WM_operator_poll_context((bContext*)C, ot, context) == FALSE) {
|
||||
const char *msg= CTX_wm_operator_poll_msg_get(C);
|
||||
PyErr_Format( PyExc_SystemError, "Operator bpy.ops.%.200s.poll() %s", opname, msg ? msg : "failed, context is incorrect");
|
||||
PyErr_Format(PyExc_SystemError, "Operator bpy.ops.%.200s.poll() %.200s", opname, msg ? msg : "failed, context is incorrect");
|
||||
CTX_wm_operator_poll_msg_set(C, NULL); /* better set to NULL else it could be used again */
|
||||
error_val= -1;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
|
||||
ot= WM_operatortype_find(opname, TRUE);
|
||||
|
||||
if (ot == NULL) {
|
||||
PyErr_Format( PyExc_SystemError, "_bpy.ops.as_string: operator \"%s\"could not be found", opname);
|
||||
PyErr_Format(PyExc_SystemError, "_bpy.ops.as_string: operator \"%.200s\"could not be found", opname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
|
||||
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); \
|
||||
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={...}):")) \
|
||||
@@ -149,7 +149,7 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
|
||||
#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); \
|
||||
PyErr_Format(PyExc_TypeError, #_func"(subtype='%s'): invalid subtype", pysubtype); \
|
||||
return NULL; \
|
||||
} \
|
||||
|
||||
@@ -410,7 +410,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
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.");
|
||||
PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
|
||||
return NULL; /* self's type was compatible but error getting the srna */
|
||||
}
|
||||
else if(srna==NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type.");
|
||||
PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -774,7 +774,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
|
||||
return NULL;
|
||||
|
||||
if(RNA_def_property_free_identifier(srna, id) != 1) {
|
||||
PyErr_Format(PyExc_TypeError, "RemoveProperty(): '%s' not a defined dynamic property.", id);
|
||||
PyErr_Format(PyExc_TypeError, "RemoveProperty(): '%s' not a defined dynamic property", id);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
|
||||
}
|
||||
else {
|
||||
if(PySet_GET_SIZE(value)) {
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: empty enum \"%.200s\" could not have any values assigned.", error_prefix, RNA_property_identifier(prop));
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: empty enum \"%.200s\" could not have any values assigned", error_prefix, RNA_property_identifier(prop));
|
||||
ret= -1;
|
||||
}
|
||||
else {
|
||||
@@ -861,7 +861,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
|
||||
if (strcmp(arg_name, "rna_type")==0) continue;
|
||||
|
||||
if (kw==NULL) {
|
||||
PyErr_Format( PyExc_TypeError, "%.200s: no keywords, expected \"%.200s\"", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: no keywords, expected \"%.200s\"", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
error_val= -1;
|
||||
break;
|
||||
}
|
||||
@@ -870,7 +870,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
|
||||
|
||||
if (item == NULL) {
|
||||
if(all_args) {
|
||||
PyErr_Format( PyExc_TypeError, "%.200s: keyword \"%.200s\" missing", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" missing", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
error_val = -1; /* pyrna_py_to_prop sets the error */
|
||||
break;
|
||||
}
|
||||
@@ -894,7 +894,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
|
||||
arg_name= NULL;
|
||||
}
|
||||
|
||||
PyErr_Format( PyExc_TypeError, "%.200s: keyword \"%.200s\" unrecognized", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" unrecognized", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
|
||||
error_val = -1;
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
|
||||
PyObject *ret;
|
||||
|
||||
if(func==NULL) {
|
||||
PyErr_Format( PyExc_RuntimeError, "%.200s: type attempted to get NULL function", RNA_struct_identifier(pyrna->ptr.type));
|
||||
PyErr_Format(PyExc_RuntimeError, "%.200s: type attempted to get NULL function", RNA_struct_identifier(pyrna->ptr.type));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
||||
} else /* continue... */
|
||||
#endif
|
||||
if (!PySequence_Check(value)) {
|
||||
PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence instead of %.200s instance.", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence instead of %.200s instance", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
/* done getting the length */
|
||||
@@ -1535,7 +1535,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "bpy_prop_collection[key]: invalid key, must be a string or an int instead of %.200s instance.", Py_TYPE(key)->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "bpy_prop_collection[key]: invalid key, must be a string or an int instead of %.200s instance", Py_TYPE(key)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1584,7 +1584,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
|
||||
int ret= 0;
|
||||
|
||||
if(value_orig == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct.");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1594,7 +1594,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
|
||||
|
||||
if(PySequence_Fast_GET_SIZE(value) != stop-start) {
|
||||
Py_DECREF(value);
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported.");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1810,12 +1810,12 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
|
||||
char *name = _PyUnicode_AsString(value);
|
||||
|
||||
if (!name) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct.__contains__: expected a string");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct.__contains__: expected a string");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct: this type doesnt support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct: this type doesnt support IDProperties");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1873,26 +1873,26 @@ static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key )
|
||||
char *name= _PyUnicode_AsString(key);
|
||||
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "this type doesn't support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(name==NULL) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct[key]: only strings are allowed as keys of ID properties");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct[key]: only strings are allowed as keys of ID properties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
group= RNA_struct_idprops(&self->ptr, 0);
|
||||
|
||||
if(group==NULL) {
|
||||
PyErr_Format( PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
|
||||
PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idprop= IDP_GetPropertyFromGroup(group, name);
|
||||
|
||||
if(idprop==NULL) {
|
||||
PyErr_Format( PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
|
||||
PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1932,7 +1932,7 @@ static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
|
||||
IDProperty *group;
|
||||
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1959,7 +1959,7 @@ static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
|
||||
IDProperty *group;
|
||||
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1986,7 +1986,7 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
|
||||
IDProperty *group;
|
||||
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2032,7 +2032,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
|
||||
}
|
||||
|
||||
if (prop==NULL) {
|
||||
PyErr_Format( PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2053,7 +2053,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
|
||||
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);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2065,7 +2065,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
|
||||
*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);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2586,7 +2586,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
|
||||
else if (self->ptr.type == &RNA_Context) {
|
||||
bContext *C = self->ptr.data;
|
||||
if(C==NULL) {
|
||||
PyErr_Format( PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name);
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name);
|
||||
ret= NULL;
|
||||
}
|
||||
else {
|
||||
@@ -2641,7 +2641,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
PyErr_Format( PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name);
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name);
|
||||
ret = NULL;
|
||||
#endif
|
||||
/* Include this incase this instance is a subtype of a python class
|
||||
@@ -2713,7 +2713,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
|
||||
char *attr_str= _PyUnicode_AsString(attr);
|
||||
int ret= RNA_def_property_free_identifier(srna, attr_str);
|
||||
if (ret == -1) {
|
||||
PyErr_Format(PyExc_TypeError, "struct_meta_idprop.detattr(): '%s' not a dynamic property.", attr_str);
|
||||
PyErr_Format(PyExc_TypeError, "struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2733,7 +2733,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
|
||||
}
|
||||
else if (name[0] != '_' && (prop= RNA_struct_find_property(&self->ptr, name))) {
|
||||
if (!RNA_property_editable_flag(&self->ptr, prop)) {
|
||||
PyErr_Format( PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(prop), RNA_struct_identifier(self->ptr.type) );
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(prop), RNA_struct_identifier(self->ptr.type) );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2855,7 +2855,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_Format( PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" not found", name);
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" not found", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2866,7 +2866,7 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
|
||||
|
||||
RNA_property_collection_add(&self->ptr, self->prop, &r_ptr);
|
||||
if(!r_ptr.data) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -2879,12 +2879,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
|
||||
int key= PyLong_AsLong(value);
|
||||
|
||||
if (key==-1 && PyErr_Occurred()) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!RNA_property_collection_remove(&self->ptr, self->prop, key)) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.remove() not supported for this collection");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove() not supported for this collection");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2896,12 +2896,12 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
|
||||
int key=0, pos=0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!RNA_property_collection_move(&self->ptr, self->prop, key, pos)) {
|
||||
PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.move() not supported for this collection");
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move() not supported for this collection");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3032,7 +3032,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
|
||||
|
||||
/* mostly copied from BPy_IDGroup_Map_GetItem */
|
||||
if(RNA_struct_idprops_check(self->ptr.type)==0) {
|
||||
PyErr_SetString( PyExc_TypeError, "this type doesn't support IDProperties");
|
||||
PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3114,7 +3114,7 @@ static int foreach_parse_args(
|
||||
*raw_type= PROP_RAW_UNSET;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
|
||||
PyErr_SetString( PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence" );
|
||||
PyErr_SetString(PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3138,7 +3138,7 @@ static int foreach_parse_args(
|
||||
|
||||
/* rna_access.c - rna_raw_access(...) uses this same method */
|
||||
if(target_tot != (*tot)) {
|
||||
PyErr_Format( PyExc_TypeError, "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d", *tot, target_tot);
|
||||
PyErr_Format(PyExc_TypeError, "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d", *tot, target_tot);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@@ -3147,7 +3147,7 @@ static int foreach_parse_args(
|
||||
/* check 'attr_tot' otherwise we dont know if any values were set
|
||||
* this isnt ideal because it means running on an empty list may fail silently when its not compatible. */
|
||||
if (*size == 0 && *attr_tot != 0) {
|
||||
PyErr_SetString( PyExc_AttributeError, "attribute does not support foreach method" );
|
||||
PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -3441,7 +3441,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct.", type->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct", type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -3465,7 +3465,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *U
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop.", type->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop", type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -4516,7 +4516,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
|
||||
}
|
||||
|
||||
if( !pyrna ) {
|
||||
PyErr_SetString( PyExc_MemoryError, "couldn't create bpy_struct object" );
|
||||
PyErr_SetString(PyExc_MemoryError, "couldn't create bpy_struct object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4556,7 +4556,7 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
|
||||
}
|
||||
|
||||
if( !pyrna ) {
|
||||
PyErr_SetString( PyExc_MemoryError, "couldn't create BPy_rna object" );
|
||||
PyErr_SetString(PyExc_MemoryError, "couldn't create BPy_rna object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4944,7 +4944,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
|
||||
if (base_class) {
|
||||
if (!PyObject_IsSubclass(py_class, base_class)) {
|
||||
PyErr_Format( PyExc_TypeError, "expected %.200s subclass of class \"%.200s\"", class_type, py_class_name);
|
||||
PyErr_Format(PyExc_TypeError, "expected %.200s subclass of class \"%.200s\"", class_type, py_class_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -4966,7 +4966,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
|
||||
if (item==NULL) {
|
||||
if ((flag & FUNC_REGISTER_OPTIONAL)==0) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, RNA_function_identifier(func));
|
||||
PyErr_Format(PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, RNA_function_identifier(func));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4976,14 +4976,14 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
Py_DECREF(item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */
|
||||
if(flag & FUNC_NO_SELF) {
|
||||
if (PyMethod_Check(item)==0) {
|
||||
PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
item= ((PyMethodObject *)item)->im_func;
|
||||
}
|
||||
else {
|
||||
if (PyFunction_Check(item)==0) {
|
||||
PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -5001,7 +5001,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
func_arg_count++;
|
||||
|
||||
if (arg_count != func_arg_count) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d", class_type, py_class_name, RNA_function_identifier(func), func_arg_count, arg_count);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d", class_type, py_class_name, RNA_function_identifier(func), func_arg_count, arg_count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -5043,7 +5043,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
#undef BPY_REPLACEMENT_STRING
|
||||
|
||||
if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, identifier);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, identifier);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -5186,14 +5186,14 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
else {
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
PyErr_Format(PyExc_TypeError, "could not find function %.200s in %.200s to execute callback.", RNA_function_identifier(func), RNA_struct_identifier(ptr->type));
|
||||
PyErr_Format(PyExc_TypeError, "could not find function %.200s in %.200s to execute callback", RNA_function_identifier(func), RNA_struct_identifier(ptr->type));
|
||||
err= -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* the error may be alredy set if the class instance couldnt be created */
|
||||
if(err != -1) {
|
||||
PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
|
||||
PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s", RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
|
||||
err= -1;
|
||||
}
|
||||
}
|
||||
@@ -5203,7 +5203,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
}
|
||||
else {
|
||||
if(ret_len==0 && ret != Py_None) {
|
||||
PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return None, got a %.200s type instead.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), Py_TYPE(ret)->tp_name);
|
||||
PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return None, got a %.200s type instead", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), Py_TYPE(ret)->tp_name);
|
||||
err= -1;
|
||||
}
|
||||
else if(ret_len==1) {
|
||||
@@ -5212,11 +5212,11 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
else if (ret_len > 1) {
|
||||
|
||||
if(PyTuple_Check(ret)==0) {
|
||||
PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return a tuple of size %d, got a %.200s type instead.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), ret_len, Py_TYPE(ret)->tp_name);
|
||||
PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return a tuple of size %d, got a %.200s type instead", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), ret_len, Py_TYPE(ret)->tp_name);
|
||||
err= -1;
|
||||
}
|
||||
else if (PyTuple_GET_SIZE(ret) != ret_len) {
|
||||
PyErr_Format(PyExc_RuntimeError, "class %.200s, function %.200s to returned %d items, expected %d.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), PyTuple_GET_SIZE(ret), ret_len);
|
||||
PyErr_Format(PyExc_RuntimeError, "class %.200s, function %.200s to returned %d items, expected %d", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), PyTuple_GET_SIZE(ret), ret_len);
|
||||
err= -1;
|
||||
}
|
||||
else {
|
||||
@@ -5368,7 +5368,7 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl
|
||||
const char *identifier;
|
||||
|
||||
if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
|
||||
PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass.");
|
||||
PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5380,7 +5380,7 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl
|
||||
/* fails in cases, cant use this check but would like to :| */
|
||||
/*
|
||||
if(RNA_struct_py_type_get(srna)) {
|
||||
PyErr_Format(PyExc_ValueError, "bpy.types.register(...): %.200s's parent class %.200s is alredy registered, this is not allowed.", ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna));
|
||||
PyErr_Format(PyExc_ValueError, "bpy.types.register(...): %.200s's parent class %.200s is alredy registered, this is not allowed", ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna));
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
@@ -5389,7 +5389,7 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl
|
||||
reg= RNA_struct_register(srna);
|
||||
|
||||
if(!reg) {
|
||||
PyErr_Format(PyExc_ValueError, "bpy.types.register(...): expected a subclass of a registerable rna type (%.200s does not support registration).", RNA_struct_identifier(srna));
|
||||
PyErr_Format(PyExc_ValueError, "bpy.types.register(...): expected a subclass of a registerable rna type (%.200s does not support registration)", RNA_struct_identifier(srna));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5463,7 +5463,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_
|
||||
|
||||
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
|
||||
PWM_cursor_wait(0);
|
||||
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
|
||||
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass");
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
@@ -5475,7 +5475,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_
|
||||
unreg= RNA_struct_unregister(srna);
|
||||
|
||||
if(!unreg) {
|
||||
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(...): expected a Type subclassed from a registerable rna type (no unregister supported).");
|
||||
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(...): expected a Type subclassed from a registerable rna type (no unregister supported)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5502,7 +5502,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_
|
||||
RNA_PROP_END;
|
||||
|
||||
if(prop_identifier) {
|
||||
PyErr_Format(PyExc_SystemError, "bpy.types.unregister(...): Cant unregister %s because %s.%s pointer property is using this.", RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier);
|
||||
PyErr_Format(PyExc_SystemError, "bpy.types.unregister(...): Cant unregister %s because %s.%s pointer property is using this", RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
|
||||
handle= PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
|
||||
|
||||
if(handle==NULL) {
|
||||
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed.");
|
||||
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
if (base_class) {
|
||||
if (!PyObject_IsSubclass(class, base_class)) {
|
||||
PyObject *name= PyObject_GetAttrString(base_class, "__name__");
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s subclass of class \"%s\"", class_type, name ? _PyUnicode_AsString(name):"<UNKNOWN>");
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s subclass of class \"%s\"", class_type, name ? _PyUnicode_AsString(name):"<UNKNOWN>");
|
||||
Py_XDECREF(name);
|
||||
return -1;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
|
||||
if (item==NULL) {
|
||||
if ((class_attrs->flag & BPY_CLASS_ATTR_OPTIONAL)==0) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class to have an \"%s\" attribute", class_type, class_attrs->name);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class to have an \"%s\" attribute", class_type, class_attrs->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -73,22 +73,22 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
switch(class_attrs->type) {
|
||||
case 's':
|
||||
if (PyUnicode_Check(item)==0) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute to be a string", class_type, class_attrs->name);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" attribute to be a string", class_type, class_attrs->name);
|
||||
return -1;
|
||||
}
|
||||
if(class_attrs->len != -1 && class_attrs->len < PyUnicode_GetSize(item)) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute string to be shorter then %d", class_type, class_attrs->name, class_attrs->len);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" attribute string to be shorter then %d", class_type, class_attrs->name, class_attrs->len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'l':
|
||||
if (PyList_Check(item)==0) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute to be a list", class_type, class_attrs->name);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" attribute to be a list", class_type, class_attrs->name);
|
||||
return -1;
|
||||
}
|
||||
if(class_attrs->len != -1 && class_attrs->len < PyList_GET_SIZE(item)) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute list to be shorter then %d", class_type, class_attrs->name, class_attrs->len);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" attribute list to be shorter then %d", class_type, class_attrs->name, class_attrs->len);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
@@ -99,7 +99,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
fitem= item; /* py 3.x */
|
||||
|
||||
if (PyFunction_Check(fitem)==0) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute to be a function", class_type, class_attrs->name);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" attribute to be a function", class_type, class_attrs->name);
|
||||
return -1;
|
||||
}
|
||||
if (class_attrs->arg_count >= 0) { /* -1 if we dont care*/
|
||||
@@ -108,7 +108,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
Py_DECREF(py_arg_count);
|
||||
|
||||
if (arg_count != class_attrs->arg_count) {
|
||||
PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" function to have %d args", class_type, class_attrs->name, class_attrs->arg_count);
|
||||
PyErr_Format(PyExc_AttributeError, "expected %s class \"%s\" function to have %d args", class_type, class_attrs->name, class_attrs->arg_count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, ch
|
||||
|
||||
if(value_len != length) {
|
||||
Py_DECREF(value);
|
||||
PyErr_Format(PyExc_TypeError, "%s: invalid sequence length. expected %d, got %d.", error_prefix, length, value_len);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s: invalid sequence length. expected %d, got %d", error_prefix, length, value_len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -240,14 +240,14 @@ int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, ch
|
||||
}
|
||||
else {
|
||||
Py_DECREF(value_fast);
|
||||
PyErr_Format(PyExc_TypeError, "%s: internal error %s is invalid.", error_prefix, type->tp_name);
|
||||
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);
|
||||
PyErr_Format(PyExc_TypeError, "%s: one or more items could not be used as a %s", error_prefix, type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user