various warnings fixes - mostly casting and initialization issues
This commit is contained in:
@@ -302,7 +302,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * args )
|
||||
else if( StringEqual( str, "curtime" ) )
|
||||
ret = PyFloat_FromDouble( frame_to_float( G.scene->r.cfra ) );
|
||||
else if( StringEqual( str, "rt" ) )
|
||||
ret = PyInt_FromLong( frame_to_float( G.rt ) );
|
||||
ret = PyInt_FromLong( (long)frame_to_float( G.rt ) );
|
||||
else if( StringEqual( str, "staframe" ) )
|
||||
ret = PyInt_FromLong( G.scene->r.sfra );
|
||||
else if( StringEqual( str, "endframe" ) )
|
||||
|
||||
@@ -887,12 +887,12 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
|
||||
param = &cam->clipend;
|
||||
break;
|
||||
case EXPP_CAM_ATTR_DRAWSIZE:
|
||||
min = 0.1;
|
||||
min = 0.1f;
|
||||
max = 10.0;
|
||||
param = &cam->drawsize;
|
||||
break;
|
||||
case EXPP_CAM_ATTR_SCALE:
|
||||
min = 0.01;
|
||||
min = 0.01f;
|
||||
max = 1000.0;
|
||||
param = &cam->ortho_scale;
|
||||
break;
|
||||
|
||||
@@ -466,9 +466,9 @@ static int kinematic_setter( BPy_Constraint *self, int type, PyObject *value )
|
||||
case EXPP_CONSTR_CHAINLEN:
|
||||
return EXPP_setIValueClamped( value, &con->rootbone, 0, 255, 'i' );
|
||||
case EXPP_CONSTR_POSWEIGHT:
|
||||
return EXPP_setFloatClamped( value, &con->weight, 0.01, 1.0 );
|
||||
return EXPP_setFloatClamped( value, &con->weight, 0.01f, 1.0 );
|
||||
case EXPP_CONSTR_ROTWEIGHT:
|
||||
return EXPP_setFloatClamped( value, &con->orientweight, 0.01, 1.0 );
|
||||
return EXPP_setFloatClamped( value, &con->orientweight, 0.01f, 1.0 );
|
||||
case EXPP_CONSTR_ROTATE:
|
||||
return EXPP_setBitfield( value, &con->flag, CONSTRAINT_IK_ROT, 'h' );
|
||||
case EXPP_CONSTR_USETIP:
|
||||
|
||||
@@ -1318,7 +1318,7 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
|
||||
min = (float)PyFloat_AsDouble( mino );
|
||||
max = (float)PyFloat_AsDouble( maxo );
|
||||
|
||||
range= fabs(max-min); /* Click step will be a 10th of the range. */
|
||||
range= (float)fabs(max-min); /* Click step will be a 10th of the range. */
|
||||
if (!range) range= 1.0f; /* avoid any odd errors */
|
||||
|
||||
/* set the precission to display*/
|
||||
|
||||
@@ -225,7 +225,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
|
||||
return newVectorObject(newvec, 2, Py_NEW);
|
||||
}
|
||||
|
||||
yi = ((b1y / fabs(b1x - b2x)) * fabs(b2x - a1x)) + ((b2y / fabs(b1x - b2x)) * fabs(b1x - a1x));
|
||||
yi = (float)(((b1y / fabs(b1x - b2x)) * fabs(b2x - a1x)) + ((b2y / fabs(b1x - b2x)) * fabs(b1x - a1x)));
|
||||
|
||||
if (yi > MAX2(a1y, a2y)) {/* New point above seg1's vert line */
|
||||
Py_RETURN_NONE;
|
||||
@@ -241,7 +241,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
|
||||
}
|
||||
|
||||
/* Can skip vert line check for seg 2 since its covered above. */
|
||||
xi = ((b1x / fabs(b1y - b2y)) * fabs(b2y - a1y)) + ((b2x / fabs(b1y - b2y)) * fabs(b1y - a1y));
|
||||
xi = (float)(((b1x / fabs(b1y - b2y)) * fabs(b2y - a1y)) + ((b2x / fabs(b1y - b2y)) * fabs(b1y - a1y)));
|
||||
if (xi > MAX2(a1x, a2x)) { /* New point right of hoz line1's */
|
||||
Py_RETURN_NONE;
|
||||
} else if (xi < MIN2(a1x, a2x)) { /*New point left of seg1's hoz line */
|
||||
|
||||
@@ -211,7 +211,7 @@ PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
|
||||
char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
|
||||
{
|
||||
IDProperty *prop = NULL, *prop2=NULL, *prev=NULL;
|
||||
IDPropertyTemplate val;
|
||||
IDPropertyTemplate val = {0};
|
||||
|
||||
if (PyFloat_Check(ob)) {
|
||||
val.f = (float) PyFloat_AsDouble(ob);
|
||||
|
||||
@@ -589,9 +589,9 @@ static int Metaball_setWiresize( BPy_Metaball * self, PyObject * value )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
param = PyFloat_AsDouble( value );
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
|
||||
self->metaball->wiresize = EXPP_ClampFloat(param, 0.05, 1.0);
|
||||
self->metaball->wiresize = EXPP_ClampFloat(param, 0.05f, 1.0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -608,9 +608,9 @@ static int Metaball_setRendersize( BPy_Metaball * self, PyObject * value )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
param = PyFloat_AsDouble( value );
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
|
||||
self->metaball->rendersize = EXPP_ClampFloat(param, 0.05, 1.0);
|
||||
self->metaball->rendersize = EXPP_ClampFloat(param, 0.05f, 1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ static int Metaball_setThresh( BPy_Metaball * self, PyObject * value )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
param = PyFloat_AsDouble( value );
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
|
||||
self->metaball->thresh = EXPP_ClampFloat(param, 0.0, 5.0);
|
||||
return 0;
|
||||
@@ -862,7 +862,7 @@ static int Metaelem_setStiffness( BPy_Metaelem *self, PyObject *value)
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
self->metaelem->s = EXPP_ClampFloat(PyFloat_AsDouble( value ), 0.0, 10.0);
|
||||
self->metaelem->s = EXPP_ClampFloat((float)PyFloat_AsDouble( value ), 0.0, 10.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -881,7 +881,7 @@ static int Metaelem_setRadius( BPy_Metaelem *self, PyObject *value)
|
||||
"expected float argument" );
|
||||
|
||||
self->metaelem->rad = /* is 5000 too small? */
|
||||
EXPP_ClampFloat(PyFloat_AsDouble( value ), 0.0, 5000.0);
|
||||
EXPP_ClampFloat((float)PyFloat_AsDouble( value ), 0.0, 5000.0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ static int ActionStrip_setRepeat( BPy_ActionStrip * self, PyObject * value )
|
||||
"This strip has been removed!" );
|
||||
|
||||
return EXPP_setFloatClamped( value, &self->strip->repeat,
|
||||
0.001, 1000.0f );
|
||||
0.001f, 1000.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -862,7 +862,7 @@ static int ActionStrip_setStrideLength( BPy_ActionStrip * self, PyObject * value
|
||||
"This strip has been removed!" );
|
||||
|
||||
return EXPP_setFloatClamped( value, &self->strip->stridelen,
|
||||
0.0001, 1000.0 );
|
||||
0.0001f, 1000.0 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1027,8 +1027,8 @@ static PyObject *ActionStrip_snapToFrame( BPy_ActionStrip *self )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"This strip has been removed!" );
|
||||
|
||||
strip->start= floor(strip->start+0.5);
|
||||
strip->end= floor(strip->end+0.5);
|
||||
strip->start= (float)floor(strip->start+0.5);
|
||||
strip->end= (float)floor(strip->end+0.5);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -1398,7 +1398,7 @@ static PyObject *ActionStrips_append( BPy_ActionStrips *self, PyObject * args )
|
||||
|
||||
strip->act = act;
|
||||
calc_action_range( strip->act, &strip->actstart, &strip->actend, 1 );
|
||||
strip->start = G.scene->r.cfra;
|
||||
strip->start = (float)G.scene->r.cfra;
|
||||
strip->end = strip->start + ( strip->actend - strip->actstart );
|
||||
/* simple prevention of zero strips */
|
||||
if( strip->start > strip->end-2 )
|
||||
|
||||
@@ -3283,7 +3283,7 @@ static int Object_setRBMass( BPy_Object * self, PyObject * args )
|
||||
if( !flt )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
value = PyFloat_AS_DOUBLE( flt );
|
||||
value = (float)PyFloat_AS_DOUBLE( flt );
|
||||
Py_DECREF( flt );
|
||||
|
||||
if( value < 0.0f )
|
||||
@@ -3983,7 +3983,7 @@ static int setFloatAttr( BPy_Object *self, PyObject *value, void *type )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
param = PyFloat_AsDouble( value );
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
|
||||
switch( (int)type ) {
|
||||
case EXPP_OBJ_ATTR_LOC_X:
|
||||
@@ -4654,7 +4654,7 @@ static int Object_setRBRadius( BPy_Object * self, PyObject * args )
|
||||
if( !flt )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
value = PyFloat_AS_DOUBLE( flt );
|
||||
value = (float)PyFloat_AS_DOUBLE( flt );
|
||||
Py_DECREF( flt );
|
||||
|
||||
if( value < 0.0f )
|
||||
|
||||
@@ -1004,7 +1004,7 @@ static int PoseBone_setStretch(BPy_PoseBone *self, PyObject *value, void *closur
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
ikstretch = PyFloat_AsDouble(value);
|
||||
ikstretch = (float)PyFloat_AsDouble(value);
|
||||
if (ikstretch<0) ikstretch = 0.0;
|
||||
if (ikstretch>1) ikstretch = 1.0;
|
||||
self->posechannel->ikstretch = ikstretch;
|
||||
@@ -1028,9 +1028,9 @@ static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
stiff = PyFloat_AsDouble(value);
|
||||
stiff = (float)PyFloat_AsDouble(value);
|
||||
if (stiff<0) stiff = 0;
|
||||
if (stiff>0.990) stiff = 0.990;
|
||||
if (stiff>0.990) stiff = 0.990f;
|
||||
self->posechannel->stiffness[(int)axis] = stiff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -571,10 +571,10 @@ static PyGetSetDef BPy_Text_getseters[] = {
|
||||
/*****************************************************************************/
|
||||
PyTypeObject Text_Type = {
|
||||
PyObject_HEAD_INIT( NULL )
|
||||
NULL, /* ob_size */
|
||||
0, /* ob_size */
|
||||
"Blender Text", /* tp_name */
|
||||
sizeof( BPy_Text ), /* tp_basicsize */
|
||||
NULL, /* tp_itemsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
( destructor ) Text_dealloc, /* tp_dealloc */
|
||||
NULL, /* tp_print */
|
||||
|
||||
@@ -108,7 +108,7 @@ static PyObject *M_MeshPrim_Plane( PyObject *self_unused, PyObject *args )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected optional float arg" );
|
||||
|
||||
size *= sqrt(2.0)/2.0;
|
||||
size *= (float)(sqrt(2.0)/2.0);
|
||||
return make_mesh( 0, "Plane", 4, 0, 0, size, -size, 0, 1 );
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ static PyObject *M_MeshPrim_Cube( PyObject *self_unused, PyObject *args )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected optional float arg" );
|
||||
|
||||
size *= sqrt(2.0)/2.0;
|
||||
size *= (float)(sqrt(2.0)/2.0);
|
||||
return make_mesh( 1, "Cube", 4, 0, 0, size, -size, 1, 1 );
|
||||
}
|
||||
|
||||
static PyObject *M_MeshPrim_Circle( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int tot = 32;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|if", &tot, &size ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
@@ -143,7 +143,7 @@ static PyObject *M_MeshPrim_Circle( PyObject *self_unused, PyObject *args )
|
||||
static PyObject *M_MeshPrim_Cylinder( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int tot = 32;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
float len = 1.0;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
|
||||
@@ -160,7 +160,7 @@ static PyObject *M_MeshPrim_Cylinder( PyObject *self_unused, PyObject *args )
|
||||
static PyObject *M_MeshPrim_Tube( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int tot = 32;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
float len = 1.0;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
|
||||
@@ -177,7 +177,7 @@ static PyObject *M_MeshPrim_Tube( PyObject *self_unused, PyObject *args )
|
||||
static PyObject *M_MeshPrim_Cone( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int tot = 32;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
float len = 1.0;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
|
||||
@@ -212,7 +212,7 @@ static PyObject *M_MeshPrim_UVsphere( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int segs = 32;
|
||||
int rings = 32;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|iif", &segs, &rings, &size ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
@@ -228,7 +228,7 @@ static PyObject *M_MeshPrim_UVsphere( PyObject *self_unused, PyObject *args )
|
||||
static PyObject *M_MeshPrim_Icosphere( PyObject *self_unused, PyObject *args )
|
||||
{
|
||||
int subdiv = 2;
|
||||
float size = 2.0*sqrt(2.0);
|
||||
float size = (float)(2.0*sqrt(2.0));
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|if", &subdiv, &size ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
|
||||
@@ -1061,7 +1061,7 @@ static int Vector_setLength( VectorObject * self, PyObject * value )
|
||||
dot= dot/param;
|
||||
|
||||
for(i = 0; i < self->size; i++){
|
||||
self->vec[i]= self->vec[i] / dot;
|
||||
self->vec[i]= self->vec[i] / (float)dot;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user