diff options
Diffstat (limited to 'source/blender/python/api2_2x/vector.c')
-rw-r--r-- | source/blender/python/api2_2x/vector.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/python/api2_2x/vector.c b/source/blender/python/api2_2x/vector.c index a0afaf60c1e..bb862fe42f7 100644 --- a/source/blender/python/api2_2x/vector.c +++ b/source/blender/python/api2_2x/vector.c @@ -658,21 +658,17 @@ static PyObject *Vector_neg(VectorObject *self) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Vector_coerce(PyObject ** v1, PyObject ** v2) { - PyObject *coerced = NULL; - - if(!VectorObject_Check(*v2)) { - if(MatrixObject_Check(*v2) || PyFloat_Check(*v2) || PyInt_Check(*v2) || + if(MatrixObject_Check(*v2) || PyFloat_Check(*v2) || PyInt_Check(*v2) || QuaternionObject_Check(*v2) || PointObject_Check(*v2)) { - coerced = EXPP_incr_ret(*v2); - *v2 = newVectorObject(NULL,3,Py_NEW); - ((VectorObject*)*v2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "vector.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*v2); + *v2 = newVectorObject(NULL,3,Py_NEW); + ((VectorObject*)*v2)->coerced_object = coerced; + Py_INCREF (*v1); + return 0; } - EXPP_incr2(*v1, *v2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "vector.coerce(): unknown operand - can't coerce for numeric protocols"); } //------------------------tp_doc static char VectorObject_doc[] = "This is a wrapper for vector objects."; |