Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-06-15 12:28:56 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-06-15 12:28:56 +0400
commit40981d872f0410caf1870194c8e15ebaed864dea (patch)
treeadde4556e99bbc684580f028c1d962369d9f2676 /source/blender/python/generic
parent68c8aecb465bf0c8e229c50958dc004bde7407b3 (diff)
parent81946b9138201800e495eb28addf254958feb1a4 (diff)
merge from trunk r37405
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/CMakeLists.txt5
-rw-r--r--source/blender/python/generic/bgl.c24
-rw-r--r--source/blender/python/generic/bgl.h2
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/python/generic/mathutils_Color.c278
-rw-r--r--source/blender/python/generic/mathutils_Euler.c2
-rw-r--r--source/blender/python/generic/mathutils_Matrix.c2
-rw-r--r--source/blender/python/generic/mathutils_Vector.c29
-rw-r--r--source/blender/python/generic/mathutils_geometry.c4
9 files changed, 309 insertions, 41 deletions
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index 5e4eae4f809..0889c77f9ad 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -25,6 +25,9 @@ set(INC
../../blenkernel
../../blenloader
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
${PYTHON_INCLUDE_DIRS}
)
@@ -60,4 +63,4 @@ set(SRC
)
-blender_add_lib(bf_python_ext "${SRC}" "${INC}")
+blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 4eb6d78bd7b..b5a693c397c 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -62,16 +62,16 @@ square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
buffer which is twice as deep as it is wide or high."
);
-static PyObject *Method_Buffer( PyObject * self, PyObject *args );
+static PyObject *Method_Buffer(PyObject *self, PyObject *args);
/* Buffer sequence methods */
-static int Buffer_len( PyObject * self );
-static PyObject *Buffer_item( PyObject * self, int i );
-static PyObject *Buffer_slice( PyObject * self, int begin, int end );
-static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
-static int Buffer_ass_slice( PyObject * self, int begin, int end,
- PyObject * seq );
+static int Buffer_len(PyObject *self);
+static PyObject *Buffer_item(PyObject *self, int i);
+static PyObject *Buffer_slice(PyObject *self, int begin, int end);
+static int Buffer_ass_item(PyObject *self, int i, PyObject *v);
+static int Buffer_ass_slice(PyObject *self, int begin, int end,
+ PyObject *seq);
static PySequenceMethods Buffer_SeqMethods = {
( lenfunc ) Buffer_len, /*sq_length */
@@ -86,11 +86,11 @@ static PySequenceMethods Buffer_SeqMethods = {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static void Buffer_dealloc( PyObject * self );
-static PyObject *Buffer_tolist( PyObject * self );
-static PyObject *Buffer_dimensions( PyObject * self );
-static PyObject *Buffer_getattr( PyObject * self, char *name );
-static PyObject *Buffer_repr( PyObject * self );
+static void Buffer_dealloc(PyObject *self);
+static PyObject *Buffer_tolist(PyObject *self);
+static PyObject *Buffer_dimensions(PyObject *self);
+static PyObject *Buffer_getattr(PyObject *self, char *name);
+static PyObject *Buffer_repr(PyObject *self);
PyTypeObject BGL_bufferType = {
PyVarObject_HEAD_INIT(NULL, 0)
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index a870e82d4fd..81b570c8505 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -55,7 +55,7 @@ int BGL_typeSize( int type );
/*@ For Python access to OpenGL functions requiring a pointer. */
typedef struct _Buffer {
PyObject_VAR_HEAD
- PyObject * parent;
+ PyObject *parent;
int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
int ndimensions;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index cb145cc453b..f0158fe72c3 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -217,7 +217,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
}
-static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
+static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
PyObject *exception, *err, *tb;
char *name;
@@ -270,7 +270,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
* our reload() module, to handle reloading in-memory scripts
*/
-static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module)
+static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
{
PyObject *exception, *err, *tb;
PyObject *newmodule= NULL;
diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c
index 09e3493cd09..c59cb501d86 100644
--- a/source/blender/python/generic/mathutils_Color.c
+++ b/source/blender/python/generic/mathutils_Color.c
@@ -186,7 +186,7 @@ static PyObject *Color_item(ColorObject * self, int i)
}
//----------------------------object[]-------------------------
//sequence accessor (set)
-static int Color_ass_item(ColorObject * self, int i, PyObject * value)
+static int Color_ass_item(ColorObject * self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
@@ -233,7 +233,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end)
}
//----------------------------object[z:y]------------------------
//sequence slice (set)
-static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * seq)
+static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
{
int i, size;
float col[COLOR_SIZE];
@@ -344,13 +344,279 @@ static PyMappingMethods Color_AsMapping = {
(objobjargproc)Color_ass_subscript
};
+/* numeric */
+
+
+/* addition: obj + obj */
+static PyObject *Color_add(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1 = NULL, *color2 = NULL;
+ float col[COLOR_SIZE];
+
+ if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
+ PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation");
+ return NULL;
+ }
+ color1 = (ColorObject*)v1;
+ color2 = (ColorObject*)v2;
+
+ if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ return NULL;
+
+ add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
+
+ return newColorObject(col, Py_NEW, Py_TYPE(v1));
+}
+
+/* addition in-place: obj += obj */
+static PyObject *Color_iadd(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1 = NULL, *color2 = NULL;
+
+ if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
+ PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation");
+ return NULL;
+ }
+ color1 = (ColorObject*)v1;
+ color2 = (ColorObject*)v2;
+
+ if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ return NULL;
+
+ add_vn_vn(color1->col, color2->col, COLOR_SIZE);
+
+ (void)BaseMath_WriteCallback(color1);
+ Py_INCREF(v1);
+ return v1;
+}
+
+/* subtraction: obj - obj */
+static PyObject *Color_sub(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1 = NULL, *color2 = NULL;
+ float col[COLOR_SIZE];
+
+ if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
+ PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation");
+ return NULL;
+ }
+ color1 = (ColorObject*)v1;
+ color2 = (ColorObject*)v2;
+
+ if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ return NULL;
+
+ sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
+
+ return newColorObject(col, Py_NEW, Py_TYPE(v1));
+}
+
+/* subtraction in-place: obj -= obj */
+static PyObject *Color_isub(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1= NULL, *color2= NULL;
+
+ if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
+ PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation");
+ return NULL;
+ }
+ color1 = (ColorObject*)v1;
+ color2 = (ColorObject*)v2;
+
+ if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ return NULL;
+
+ sub_vn_vn(color1->col, color2->col, COLOR_SIZE);
+
+ (void)BaseMath_WriteCallback(color1);
+ Py_INCREF(v1);
+ return v1;
+}
+
+static PyObject *color_mul_float(ColorObject *color, const float scalar)
+{
+ float tcol[COLOR_SIZE];
+ mul_vn_vn_fl(tcol, color->col, COLOR_SIZE, scalar);
+ return newColorObject(tcol, Py_NEW, Py_TYPE(color));
+}
+
+
+static PyObject *Color_mul(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1 = NULL, *color2 = NULL;
+ float scalar;
+
+ if ColorObject_Check(v1) {
+ color1= (ColorObject *)v1;
+ if(BaseMath_ReadCallback(color1) == -1)
+ return NULL;
+ }
+ if ColorObject_Check(v2) {
+ color2= (ColorObject *)v2;
+ if(BaseMath_ReadCallback(color2) == -1)
+ return NULL;
+ }
+
+
+ /* make sure v1 is always the vector */
+ if (color1 && color2) {
+ /* col * col, dont support yet! */
+ }
+ else if (color1) {
+ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */
+ return color_mul_float(color1, scalar);
+ }
+ }
+ else if (color2) {
+ if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * COLOR */
+ return color_mul_float(color2, scalar);
+ }
+ }
+ else {
+ BLI_assert(!"internal error");
+ }
+
+ PyErr_Format(PyExc_TypeError, "Color multiplication: not supported between '%.200s' and '%.200s' types", Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
+ return NULL;
+}
+
+static PyObject *Color_div(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color1 = NULL;
+ float scalar;
+
+ if ColorObject_Check(v1) {
+ color1= (ColorObject *)v1;
+ if(BaseMath_ReadCallback(color1) == -1)
+ return NULL;
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "Color division not supported in this order");
+ return NULL;
+ }
+
+ /* make sure v1 is always the vector */
+ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */
+ if(scalar==0.0f) {
+ PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error");
+ return NULL;
+ }
+ return color_mul_float(color1, 1.0f / scalar);
+ }
+
+ PyErr_Format(PyExc_TypeError, "Color multiplication: not supported between '%.200s' and '%.200s' types", Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
+ return NULL;
+}
+
+/* mulplication in-place: obj *= obj */
+static PyObject *Color_imul(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color = (ColorObject *)v1;
+ float scalar;
+
+ if(BaseMath_ReadCallback(color) == -1)
+ return NULL;
+
+ /* only support color *= float */
+ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR *= FLOAT */
+ mul_vn_fl(color->col, COLOR_SIZE, scalar);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "Color multiplication: arguments not acceptable for this operation");
+ return NULL;
+ }
+
+ (void)BaseMath_WriteCallback(color);
+ Py_INCREF(v1);
+ return v1;
+}
+
+/* mulplication in-place: obj *= obj */
+static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
+{
+ ColorObject *color = (ColorObject *)v1;
+ float scalar;
+
+ if(BaseMath_ReadCallback(color) == -1)
+ return NULL;
+
+ /* only support color /= float */
+ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR /= FLOAT */
+ if(scalar==0.0f) {
+ PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error");
+ return NULL;
+ }
+
+ mul_vn_fl(color->col, COLOR_SIZE, 1.0f / scalar);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "Color multiplication: arguments not acceptable for this operation");
+ return NULL;
+ }
+
+ (void)BaseMath_WriteCallback(color);
+ Py_INCREF(v1);
+ return v1;
+}
+
+/* -obj
+ returns the negative of this object*/
+static PyObject *Color_neg(ColorObject *self)
+{
+ float tcol[COLOR_SIZE];
+
+ if(BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ negate_vn_vn(tcol, self->col, COLOR_SIZE);
+ return newColorObject(tcol, Py_NEW, Py_TYPE(self));
+}
+
+
+static PyNumberMethods Color_NumMethods = {
+ (binaryfunc) Color_add, /*nb_add*/
+ (binaryfunc) Color_sub, /*nb_subtract*/
+ (binaryfunc) Color_mul, /*nb_multiply*/
+ NULL, /*nb_remainder*/
+ NULL, /*nb_divmod*/
+ NULL, /*nb_power*/
+ (unaryfunc) Color_neg, /*nb_negative*/
+ (unaryfunc) NULL, /*tp_positive*/
+ (unaryfunc) NULL, /*tp_absolute*/
+ (inquiry) NULL, /*tp_bool*/
+ (unaryfunc) NULL, /*nb_invert*/
+ NULL, /*nb_lshift*/
+ (binaryfunc)NULL, /*nb_rshift*/
+ NULL, /*nb_and*/
+ NULL, /*nb_xor*/
+ NULL, /*nb_or*/
+ NULL, /*nb_int*/
+ NULL, /*nb_reserved*/
+ NULL, /*nb_float*/
+ Color_iadd, /* nb_inplace_add */
+ Color_isub, /* nb_inplace_subtract */
+ Color_imul, /* nb_inplace_multiply */
+ NULL, /* nb_inplace_remainder */
+ NULL, /* nb_inplace_power */
+ NULL, /* nb_inplace_lshift */
+ NULL, /* nb_inplace_rshift */
+ NULL, /* nb_inplace_and */
+ NULL, /* nb_inplace_xor */
+ NULL, /* nb_inplace_or */
+ NULL, /* nb_floor_divide */
+ Color_div, /* nb_true_divide */
+ NULL, /* nb_inplace_floor_divide */
+ Color_idiv, /* nb_inplace_true_divide */
+ NULL, /* nb_index */
+};
+
/* color channel, vector.r/g/b */
static PyObject *Color_getChannel(ColorObject * self, void *type)
{
return Color_item(self, GET_INT_FROM_POINTER(type));
}
-static int Color_setChannel(ColorObject * self, PyObject * value, void * type)
+static int Color_setChannel(ColorObject * self, PyObject *value, void * type)
{
return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
@@ -369,7 +635,7 @@ static PyObject *Color_getChannelHSV(ColorObject * self, void *type)
return PyFloat_FromDouble(hsv[i]);
}
-static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type)
+static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type)
{
float hsv[3];
int i= GET_INT_FROM_POINTER(type);
@@ -412,7 +678,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
return ret;
}
-static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure))
+static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closure))
{
float hsv[3];
@@ -473,7 +739,7 @@ PyTypeObject color_Type = {
NULL, //tp_setattr
NULL, //tp_compare
(reprfunc) Color_repr, //tp_repr
- NULL, //tp_as_number
+ &Color_NumMethods, //tp_as_number
&Color_SeqMethods, //tp_as_sequence
&Color_AsMapping, //tp_as_mapping
NULL, //tp_hash
diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c
index 9adf0ee905b..4281c7bf6c5 100644
--- a/source/blender/python/generic/mathutils_Euler.c
+++ b/source/blender/python/generic/mathutils_Euler.c
@@ -419,7 +419,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end)
}
//----------------------------object[z:y]------------------------
//sequence slice (set)
-static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * seq)
+static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
{
int i, size;
float eul[EULER_SIZE];
diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c
index 982a8e63282..4b7f9dc0d97 100644
--- a/source/blender/python/generic/mathutils_Matrix.c
+++ b/source/blender/python/generic/mathutils_Matrix.c
@@ -1485,7 +1485,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
return newMatrixObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat));
}
-static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
+static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
{
float scalar;
diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c
index fd8d1b5f481..d0ba94474d4 100644
--- a/source/blender/python/generic/mathutils_Vector.c
+++ b/source/blender/python/generic/mathutils_Vector.c
@@ -869,8 +869,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end)
return tuple;
}
/* sequence slice (set): vector[a:b] = value */
-static int Vector_ass_slice(VectorObject *self, int begin, int end,
- PyObject * seq)
+static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *seq)
{
int y, size = 0;
float vec[MAX_DIMENSIONS];
@@ -899,7 +898,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end,
/* Numeric Protocols */
/* addition: obj + obj */
-static PyObject *Vector_add(PyObject * v1, PyObject * v2)
+static PyObject *Vector_add(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
float vec[MAX_DIMENSIONS];
@@ -926,7 +925,7 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2)
}
/* addition in-place: obj += obj */
-static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
+static PyObject *Vector_iadd(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
@@ -953,7 +952,7 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
}
/* subtraction: obj - obj */
-static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
+static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
float vec[MAX_DIMENSIONS];
@@ -979,7 +978,7 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
}
/* subtraction in-place: obj -= obj */
-static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
+static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
{
VectorObject *vec1= NULL, *vec2= NULL;
@@ -1055,7 +1054,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar)
return newVectorObject(tvec, vec->size, Py_NEW, Py_TYPE(vec));
}
-static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
+static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
float scalar;
@@ -1116,12 +1115,12 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
mul_qt_v3(quat2->quat, tvec);
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1));
}
- else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */
+ else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC * FLOAT */
return vector_mul_float(vec1, scalar);
}
}
else if (vec2) {
- if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */
+ if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * VEC */
return vector_mul_float(vec2, scalar);
}
}
@@ -1134,7 +1133,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
}
/* mulplication in-place: obj *= obj */
-static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
+static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
{
VectorObject *vec = (VectorObject *)v1;
float scalar;
@@ -1168,7 +1167,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
}
mul_qt_v3(quat2->quat, vec->vec);
}
- else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*=FLOAT */
+ else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC *= FLOAT */
mul_vn_fl(vec->vec, vec->size, scalar);
}
else {
@@ -1182,7 +1181,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
}
/* divid: obj / obj */
-static PyObject *Vector_div(PyObject * v1, PyObject * v2)
+static PyObject *Vector_div(PyObject *v1, PyObject *v2)
{
int i;
float vec[4], scalar;
@@ -1214,7 +1213,7 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
}
/* divide in-place: obj /= obj */
-static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
+static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
{
int i;
float scalar;
@@ -1489,7 +1488,7 @@ static PyObject *Vector_getAxis(VectorObject *self, void *type)
return vector_item_internal(self, GET_INT_FROM_POINTER(type), TRUE);
}
-static int Vector_setAxis(VectorObject *self, PyObject * value, void *type)
+static int Vector_setAxis(VectorObject *self, PyObject *value, void *type)
{
return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, TRUE);
}
@@ -1596,7 +1595,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
Returns 0 on success and -1 on failure. On failure, the vector will be
unchanged. */
-static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure)
+static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
{
size_t size_from;
float scalarVal;
diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c
index c4917199e59..53c066d1a85 100644
--- a/source/blender/python/generic/mathutils_geometry.c
+++ b/source/blender/python/generic/mathutils_geometry.c
@@ -169,7 +169,7 @@ PyDoc_STRVAR(M_Geometry_intersect_line_line_doc,
);
static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject *args)
{
- PyObject * tuple;
+ PyObject *tuple;
VectorObject *vec1, *vec2, *vec3, *vec4;
float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3];
@@ -720,7 +720,7 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
return 0;
}
-static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
+static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
{
int len, i;
PyObject *list_item;