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:
authorCampbell Barton <ideasman42@gmail.com>2011-03-27 21:12:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-27 21:12:59 +0400
commit9c8f1e2ef487483bc374feaed9ff709e07638623 (patch)
tree1157b72533f1b2c2e2082d91562bd9a2da4290fb /source/blender/python/generic
parent4237c0393a9d1f089f01dd7c4b223b1f61b15023 (diff)
imbuf, mathutils & readfile: floats were being implicitly promoted to doubles, adjust to use floats.
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/mathutils.c2
-rw-r--r--source/blender/python/generic/mathutils_Matrix.c6
-rw-r--r--source/blender/python/generic/mathutils_Quaternion.c8
-rw-r--r--source/blender/python/generic/mathutils_Vector.c12
-rw-r--r--source/blender/python/generic/mathutils_geometry.c2
5 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index 7cb1728f817..e94f7f798fc 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -66,7 +66,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
i= size;
do {
i--;
- if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0) && PyErr_Occurred()) {
+ if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
PyErr_Format(PyExc_ValueError, "%.200s: sequence index %d expected a number, found '%.200s' type, ", error_prefix, i, Py_TYPE(item)->tp_name);
Py_DECREF(value_fast);
return -1;
diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c
index c048058f63c..936c761bf90 100644
--- a/source/blender/python/generic/mathutils_Matrix.c
+++ b/source/blender/python/generic/mathutils_Matrix.c
@@ -542,7 +542,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
if(matSize == 2) {
float const factor= PyFloat_AsDouble(fac);
- if(factor==-1.0 && PyErr_Occurred()) {
+ if(factor==-1.0f && PyErr_Occurred()) {
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Shear(): the factor to be a float");
return NULL;
}
@@ -1520,12 +1520,12 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
}
}
else if(mat2) {
- if (((scalar= PyFloat_AsDouble(m1)) == -1.0 && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
+ if (((scalar= PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
return matrix_mul_float(mat2, scalar);
}
}
else if(mat1) {
- if (((scalar= PyFloat_AsDouble(m2)) == -1.0 && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
+ if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
return matrix_mul_float(mat1, scalar);
}
}
diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c
index 75d79d5afac..43d3cbc62b0 100644
--- a/source/blender/python/generic/mathutils_Quaternion.c
+++ b/source/blender/python/generic/mathutils_Quaternion.c
@@ -723,12 +723,12 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
}
/* the only case this can happen (for a supported type is "FLOAT*QUAT") */
else if(quat2) { /* FLOAT*QUAT */
- if(((scalar= PyFloat_AsDouble(q1)) == -1.0 && PyErr_Occurred())==0) {
+ if(((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) {
return quat_mul_float(quat2, scalar);
}
}
else if (quat1) { /* QUAT*FLOAT */
- if((((scalar= PyFloat_AsDouble(q2)) == -1.0 && PyErr_Occurred())==0)) {
+ if((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) {
return quat_mul_float(quat1, scalar);
}
}
@@ -837,7 +837,7 @@ static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closur
return NULL;
normalize_qt_qt(tquat, self->quat);
- return PyFloat_FromDouble(2.0 * (saacos(tquat[0])));
+ return PyFloat_FromDouble(2.0f * (saacos(tquat[0])));
}
static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
@@ -856,7 +856,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
angle= PyFloat_AsDouble(value);
- if(angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ if(angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError, "quaternion.angle = value: float expected");
return -1;
}
diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c
index 0ea380d1ee6..f1e417b154e 100644
--- a/source/blender/python/generic/mathutils_Vector.c
+++ b/source/blender/python/generic/mathutils_Vector.c
@@ -719,7 +719,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
if(BaseMath_ReadCallback(self) == -1)
return NULL;
- ifac= 1.0 - fac;
+ ifac= 1.0f - fac;
for(x = 0; x < size; x++) {
vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
@@ -1111,12 +1111,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.0 && 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.0 && PyErr_Occurred())==0) { /* VEC*FLOAT */
+ if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */
return vector_mul_float(vec2, scalar);
}
}
@@ -1163,7 +1163,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
}
mul_qt_v3(quat2->quat, vec->vec);
}
- else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && 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 {
@@ -1197,7 +1197,7 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
return NULL;
}
- if(scalar==0.0) {
+ if(scalar==0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
return NULL;
}
@@ -1223,7 +1223,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
return NULL;
}
- if(scalar==0.0) {
+ if(scalar==0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
return NULL;
}
diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c
index a0991e00d07..fc821f2697a 100644
--- a/source/blender/python/generic/mathutils_geometry.c
+++ b/source/blender/python/generic/mathutils_geometry.c
@@ -114,7 +114,7 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
/* if determinant is near zero, ray lies in plane of triangle */
det= dot_v3v3(e1, pvec);
- if (det > -0.000001 && det < 0.000001) {
+ if (det > -0.000001f && det < 0.000001f) {
Py_RETURN_NONE;
}