[#18840] Joystick sensor lag

if(SDL_PollEvent(&sdl_event)) // if -> while fixed it
removed 'm_buttonnum' was misleading, wasn't used as you expect.

Added gravity to variable to world to be used by collada.
This commit is contained in:
2009-05-28 13:44:32 +00:00
parent 6ac072e1bd
commit 8c4620f3d3
6 changed files with 55 additions and 39 deletions

View File

@@ -106,6 +106,8 @@ static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args );
static PyObject *World_setCurrent( BPy_World * self );
static PyObject *World_getTextures( BPy_World * self );
static int World_setTextures( BPy_World * self, PyObject * value );
static PyObject *World_getGravity( BPy_World * self );
static int World_setGravity( BPy_World * self, PyObject * value );
static PyObject *World_copy( BPy_World * self );
@@ -259,6 +261,9 @@ static PyGetSetDef BPy_World_getseters[] = {
"world ipo", NULL},
{"textures", (getter)World_getTextures, (setter)World_setTextures,
"The World's texture list as a tuple",
NULL},
{"gravity", (getter)World_getGravity, (setter)World_setGravity,
"Physics gravity setting",
NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
@@ -1136,3 +1141,21 @@ static int World_setTextures( BPy_World * self, PyObject * value )
Py_DECREF(value);
return 0;
}
static PyObject *World_getGravity( BPy_World * self )
{
return PyFloat_FromDouble(self->world->gravity);
}
static int World_setGravity( BPy_World * self, PyObject * value )
{
float f = PyFloat_AsDouble(value);
if (f==-1 && PyErr_Occurred())
return EXPP_ReturnIntError( PyExc_TypeError, "expected a float or int" );
if (f<0.0f)f= 0.0f;
else if (f>25.0f)f= 25.0f;
self->world->gravity= f;
return 0;
}

View File

@@ -84,6 +84,8 @@ class World:
@ivar ipo: The world type ipo linked to this world object.
@type textures: a tuple of Blender MTex objects.
@ivar textures: The World's texture list. Empty texture channels contains None.
@type gravity: float
@ivar gravity: World physics gravity setting between 0.0 and 25.0
"""
def getRange():