diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_ObjectActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ObjectActuator.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index df98d58b4e8..0d0cac3c084 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -34,10 +34,6 @@ #include "KX_PyMath.h" // For PyVecTo - should this include be put in PyObjectPlus? #include "KX_IPhysicsController.h" -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ @@ -387,74 +383,69 @@ PyAttributeDef KX_ObjectActuator::Attributes[] = { static int mathutils_kxobactu_vector_cb_index= -1; /* index for our callbacks */ -static int mathutils_obactu_generic_check(PyObject *self_v) +static int mathutils_obactu_generic_check(BaseMathObject *bmo) { - KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v); + KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); if(self==NULL) return 0; return 1; } -static int mathutils_obactu_vector_get(PyObject *self_v, int subtype, float *vec_from) +static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype) { - KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v); + KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); if(self==NULL) return 0; switch(subtype) { case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.getValue(vec_from); + self->m_linear_velocity.getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.getValue(vec_from); + self->m_angular_velocity.getValue(bmo->data); break; } return 1; } -static int mathutils_obactu_vector_set(PyObject *self_v, int subtype, float *vec_to) +static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) { - KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v); + KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); if(self==NULL) return 0; switch(subtype) { case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.setValue(vec_to); + self->m_linear_velocity.setValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.setValue(vec_to); + self->m_angular_velocity.setValue(bmo->data); break; } return 1; } -static int mathutils_obactu_vector_get_index(PyObject *self_v, int subtype, float *vec_from, int index) +static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index) { - float f[4]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(self_v, subtype, f)) + if(!mathutils_obactu_vector_get(bmo, subtype)) return 0; - - vec_from[index]= f[index]; return 1; } -static int mathutils_obactu_vector_set_index(PyObject *self_v, int subtype, float *vec_to, int index) +static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, int index) { - float f= vec_to[index]; + float f= bmo->data[index]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(self_v, subtype, vec_to)) + if(!mathutils_obactu_vector_get(bmo, subtype)) return 0; - vec_to[index]= f; - mathutils_obactu_vector_set(self_v, subtype, vec_to); - - return 1; + bmo->data[index]= f; + return mathutils_obactu_vector_set(bmo, subtype); } Mathutils_Callback mathutils_obactu_vector_cb = { @@ -476,6 +467,8 @@ int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *a if (!PyVecTo(value, self->m_linear_velocity)) return PY_SET_ATTR_FAIL; + self->UpdateFuzzyFlags(); + return PY_SET_ATTR_SUCCESS; } @@ -490,6 +483,8 @@ int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *a if (!PyVecTo(value, self->m_angular_velocity)) return PY_SET_ATTR_FAIL; + self->UpdateFuzzyFlags(); + return PY_SET_ATTR_SUCCESS; } |