remove redundant argument from mathutils callbacks

This commit is contained in:
2010-04-27 19:21:36 +00:00
parent f9fbfd9297
commit 124c55fcc3
6 changed files with 84 additions and 84 deletions

View File

@@ -646,7 +646,7 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb)
int _BaseMathObject_ReadCallback(BaseMathObject *self) int _BaseMathObject_ReadCallback(BaseMathObject *self)
{ {
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
if(cb->get(self, self->cb_subtype, self->data)) if(cb->get(self, self->cb_subtype))
return 1; return 1;
PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
@@ -656,7 +656,7 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self)
int _BaseMathObject_WriteCallback(BaseMathObject *self) int _BaseMathObject_WriteCallback(BaseMathObject *self)
{ {
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
if(cb->set(self, self->cb_subtype, self->data)) if(cb->set(self, self->cb_subtype))
return 1; return 1;
PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
@@ -666,7 +666,7 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self)
int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
{ {
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
if(cb->get_index(self, self->cb_subtype, self->data, index)) if(cb->get_index(self, self->cb_subtype, index))
return 1; return 1;
PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
@@ -676,7 +676,7 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
{ {
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
if(cb->set_index(self, self->cb_subtype, self->data, index)) if(cb->set_index(self, self->cb_subtype, index))
return 1; return 1;
PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);

View File

@@ -89,10 +89,10 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
typedef struct Mathutils_Callback Mathutils_Callback; typedef struct Mathutils_Callback Mathutils_Callback;
typedef int (*BaseMathCheckFunc)(BaseMathObject *); /* checks the user is still valid */ typedef int (*BaseMathCheckFunc)(BaseMathObject *); /* checks the user is still valid */
typedef int (*BaseMathGetFunc)(BaseMathObject *, int, float *); /* gets the vector from the user */ typedef int (*BaseMathGetFunc)(BaseMathObject *, int); /* gets the vector from the user */
typedef int (*BaseMathSetFunc)(BaseMathObject *, int, float *); /* sets the users vector values once the vector is modified */ typedef int (*BaseMathSetFunc)(BaseMathObject *, int); /* sets the users vector values once the vector is modified */
typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, float *, int); /* same as above but only for an index */ typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, float *, int); /* same as above but only for an index */ typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
struct Mathutils_Callback { struct Mathutils_Callback {
BaseMathCheckFunc check; BaseMathCheckFunc check;

View File

@@ -43,7 +43,7 @@ static int mathutils_matrix_vector_check(BaseMathObject *bmo)
return BaseMath_ReadCallback(self); return BaseMath_ReadCallback(self);
} }
static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype, float *vec_from) static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype)
{ {
MatrixObject *self= (MatrixObject *)bmo->cb_user; MatrixObject *self= (MatrixObject *)bmo->cb_user;
int i; int i;
@@ -52,12 +52,12 @@ static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype, float *
return 0; return 0;
for(i=0; i < self->colSize; i++) for(i=0; i < self->colSize; i++)
vec_from[i]= self->matrix[subtype][i]; bmo->data[i]= self->matrix[subtype][i];
return 1; return 1;
} }
static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype, float *vec_to) static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype)
{ {
MatrixObject *self= (MatrixObject *)bmo->cb_user; MatrixObject *self= (MatrixObject *)bmo->cb_user;
int i; int i;
@@ -66,31 +66,31 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype, float *
return 0; return 0;
for(i=0; i < self->colSize; i++) for(i=0; i < self->colSize; i++)
self->matrix[subtype][i]= vec_to[i]; self->matrix[subtype][i]= bmo->data[i];
BaseMath_WriteCallback(self); BaseMath_WriteCallback(self);
return 1; return 1;
} }
static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{ {
MatrixObject *self= (MatrixObject *)bmo->cb_user; MatrixObject *self= (MatrixObject *)bmo->cb_user;
if(!BaseMath_ReadCallback(self)) if(!BaseMath_ReadCallback(self))
return 0; return 0;
vec_from[index]= self->matrix[subtype][index]; bmo->data[index]= self->matrix[subtype][index];
return 1; return 1;
} }
static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index) static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, int index)
{ {
MatrixObject *self= (MatrixObject *)bmo->cb_user; MatrixObject *self= (MatrixObject *)bmo->cb_user;
if(!BaseMath_ReadCallback(self)) if(!BaseMath_ReadCallback(self))
return 0; return 0;
self->matrix[subtype][index]= vec_to[index]; self->matrix[subtype][index]= bmo->data[index];
BaseMath_WriteCallback(self); BaseMath_WriteCallback(self);
return 1; return 1;

View File

@@ -74,13 +74,13 @@ static int mathutils_rna_generic_check(BaseMathObject *bmo)
return self->prop ? 1:0; return self->prop ? 1:0;
} }
static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype, float *vec_from) static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
if(self->prop==NULL) if(self->prop==NULL)
return 0; return 0;
RNA_property_float_get_array(&self->ptr, self->prop, vec_from); RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
/* Euler order exception */ /* Euler order exception */
if(subtype==MATHUTILS_CB_SUBTYPE_EUL) { if(subtype==MATHUTILS_CB_SUBTYPE_EUL) {
@@ -92,7 +92,7 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype, float *vec
return 1; return 1;
} }
static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype, float *vec_to) static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
float min, max; float min, max;
@@ -104,11 +104,11 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype, float *vec
if(min != FLT_MIN || max != FLT_MAX) { if(min != FLT_MIN || max != FLT_MAX) {
int i, len= RNA_property_array_length(&self->ptr, self->prop); int i, len= RNA_property_array_length(&self->ptr, self->prop);
for(i=0; i<len; i++) { for(i=0; i<len; i++) {
CLAMP(vec_to[i], min, max); CLAMP(bmo->data[i], min, max);
} }
} }
RNA_property_float_set_array(&self->ptr, self->prop, vec_to); RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
/* Euler order exception */ /* Euler order exception */
@@ -124,26 +124,26 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype, float *vec
return 1; return 1;
} }
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
if(self->prop==NULL) if(self->prop==NULL)
return 0; return 0;
vec_from[index]= RNA_property_float_get_index(&self->ptr, self->prop, index); bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
return 1; return 1;
} }
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index) static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
if(self->prop==NULL) if(self->prop==NULL)
return 0; return 0;
RNA_property_float_clamp(&self->ptr, self->prop, &vec_to[index]); RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
RNA_property_float_set_index(&self->ptr, self->prop, index, vec_to[index]); RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
return 1; return 1;
} }
@@ -160,35 +160,35 @@ Mathutils_Callback mathutils_rna_array_cb = {
/* bpyrna matrix callbacks */ /* bpyrna matrix callbacks */
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */ static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype, float *mat_from) static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
if(self->prop==NULL) if(self->prop==NULL)
return 0; return 0;
RNA_property_float_get_array(&self->ptr, self->prop, mat_from); RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
return 1; return 1;
} }
static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype, float *mat_to) static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
{ {
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
if(self->prop==NULL) if(self->prop==NULL)
return 0; return 0;
/* can ignore clamping here */ /* can ignore clamping here */
RNA_property_float_set_array(&self->ptr, self->prop, mat_to); RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
return 1; return 1;
} }
Mathutils_Callback mathutils_rna_matrix_cb = { Mathutils_Callback mathutils_rna_matrix_cb = {
(BaseMathCheckFunc) mathutils_rna_generic_check, mathutils_rna_generic_check,
(BaseMathGetFunc) mathutils_rna_matrix_get, mathutils_rna_matrix_get,
(BaseMathSetFunc) mathutils_rna_matrix_set, mathutils_rna_matrix_set,
(BaseMathGetIndexFunc) NULL, NULL,
(BaseMathSetIndexFunc) NULL NULL
}; };
/* same as RNA_enum_value_from_id but raises an exception */ /* same as RNA_enum_value_from_id but raises an exception */

View File

@@ -1261,7 +1261,7 @@ static int mathutils_kxgameob_generic_check(BaseMathObject *bmo)
return 1; return 1;
} }
static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float *vec_from) static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
{ {
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
@@ -1269,39 +1269,39 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float
switch(subtype) { switch(subtype) {
case MATHUTILS_VEC_CB_POS_LOCAL: case MATHUTILS_VEC_CB_POS_LOCAL:
self->NodeGetLocalPosition().getValue(vec_from); self->NodeGetLocalPosition().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_POS_GLOBAL: case MATHUTILS_VEC_CB_POS_GLOBAL:
self->NodeGetWorldPosition().getValue(vec_from); self->NodeGetWorldPosition().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_SCALE_LOCAL: case MATHUTILS_VEC_CB_SCALE_LOCAL:
self->NodeGetLocalScaling().getValue(vec_from); self->NodeGetLocalScaling().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_SCALE_GLOBAL: case MATHUTILS_VEC_CB_SCALE_GLOBAL:
self->NodeGetWorldScaling().getValue(vec_from); self->NodeGetWorldScaling().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_INERTIA_LOCAL: case MATHUTILS_VEC_CB_INERTIA_LOCAL:
if(!self->GetPhysicsController()) return 0; if(!self->GetPhysicsController()) return 0;
self->GetPhysicsController()->GetLocalInertia().getValue(vec_from); self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_OBJECT_COLOR: case MATHUTILS_VEC_CB_OBJECT_COLOR:
self->GetObjectColor().getValue(vec_from); self->GetObjectColor().getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_LINVEL_LOCAL: case MATHUTILS_VEC_CB_LINVEL_LOCAL:
if(!self->GetPhysicsController()) return 0; if(!self->GetPhysicsController()) return 0;
self->GetLinearVelocity(true).getValue(vec_from); self->GetLinearVelocity(true).getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_LINVEL_GLOBAL: case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
if(!self->GetPhysicsController()) return 0; if(!self->GetPhysicsController()) return 0;
self->GetLinearVelocity(false).getValue(vec_from); self->GetLinearVelocity(false).getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_ANGVEL_LOCAL: case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
if(!self->GetPhysicsController()) return 0; if(!self->GetPhysicsController()) return 0;
self->GetAngularVelocity(true).getValue(vec_from); self->GetAngularVelocity(true).getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
if(!self->GetPhysicsController()) return 0; if(!self->GetPhysicsController()) return 0;
self->GetAngularVelocity(false).getValue(vec_from); self->GetAngularVelocity(false).getValue(bmo->data);
break; break;
} }
@@ -1309,7 +1309,7 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float
return 1; return 1;
} }
static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float *vec_to) static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype)
{ {
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
@@ -1317,15 +1317,15 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float
switch(subtype) { switch(subtype) {
case MATHUTILS_VEC_CB_POS_LOCAL: case MATHUTILS_VEC_CB_POS_LOCAL:
self->NodeSetLocalPosition(MT_Point3(vec_to)); self->NodeSetLocalPosition(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f); self->NodeUpdateGS(0.f);
break; break;
case MATHUTILS_VEC_CB_POS_GLOBAL: case MATHUTILS_VEC_CB_POS_GLOBAL:
self->NodeSetWorldPosition(MT_Point3(vec_to)); self->NodeSetWorldPosition(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f); self->NodeUpdateGS(0.f);
break; break;
case MATHUTILS_VEC_CB_SCALE_LOCAL: case MATHUTILS_VEC_CB_SCALE_LOCAL:
self->NodeSetLocalScale(MT_Point3(vec_to)); self->NodeSetLocalScale(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f); self->NodeUpdateGS(0.f);
break; break;
case MATHUTILS_VEC_CB_SCALE_GLOBAL: case MATHUTILS_VEC_CB_SCALE_GLOBAL:
@@ -1334,46 +1334,46 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float
/* read only */ /* read only */
break; break;
case MATHUTILS_VEC_CB_OBJECT_COLOR: case MATHUTILS_VEC_CB_OBJECT_COLOR:
self->SetObjectColor(MT_Vector4(vec_to)); self->SetObjectColor(MT_Vector4(bmo->data));
break; break;
case MATHUTILS_VEC_CB_LINVEL_LOCAL: case MATHUTILS_VEC_CB_LINVEL_LOCAL:
self->setLinearVelocity(MT_Point3(vec_to),true); self->setLinearVelocity(MT_Point3(bmo->data),true);
break; break;
case MATHUTILS_VEC_CB_LINVEL_GLOBAL: case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
self->setLinearVelocity(MT_Point3(vec_to),false); self->setLinearVelocity(MT_Point3(bmo->data),false);
break; break;
case MATHUTILS_VEC_CB_ANGVEL_LOCAL: case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
self->setAngularVelocity(MT_Point3(vec_to),true); self->setAngularVelocity(MT_Point3(bmo->data),true);
break; break;
case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
self->setAngularVelocity(MT_Point3(vec_to),false); self->setAngularVelocity(MT_Point3(bmo->data),false);
break; break;
} }
return 1; return 1;
} }
static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{ {
float f[4]; float f[4];
/* lazy, avoid repeteing the case statement */ /* lazy, avoid repeteing the case statement */
if(!mathutils_kxgameob_vector_get(bmo, subtype, f)) if(!mathutils_kxgameob_vector_get(bmo, subtype))
return 0; return 0;
vec_from[index]= f[index]; bmo->data[index]= f[index];
return 1; return 1;
} }
static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index) static int mathutils_kxgameob_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 */ /* lazy, avoid repeteing the case statement */
if(!mathutils_kxgameob_vector_get(bmo, subtype, vec_to)) if(!mathutils_kxgameob_vector_get(bmo, subtype))
return 0; return 0;
vec_to[index]= f; bmo->data[index]= f;
mathutils_kxgameob_vector_set(bmo, subtype, vec_to); mathutils_kxgameob_vector_set(bmo, subtype);
return 1; return 1;
} }
@@ -1392,18 +1392,18 @@ Mathutils_Callback mathutils_kxgameob_vector_cb = {
static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */ static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */
static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype, float *mat_from) static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype)
{ {
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
return 0; return 0;
switch(subtype) { switch(subtype) {
case MATHUTILS_MAT_CB_ORI_LOCAL: case MATHUTILS_MAT_CB_ORI_LOCAL:
self->NodeGetLocalOrientation().getValue3x3(mat_from); self->NodeGetLocalOrientation().getValue3x3(bmo->data);
break; break;
case MATHUTILS_MAT_CB_ORI_GLOBAL: case MATHUTILS_MAT_CB_ORI_GLOBAL:
self->NodeGetWorldOrientation().getValue3x3(mat_from); self->NodeGetWorldOrientation().getValue3x3(bmo->data);
break; break;
} }
@@ -1411,7 +1411,7 @@ static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype, float
} }
static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype, float *mat_to) static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype)
{ {
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
@@ -1420,12 +1420,12 @@ static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype, float
MT_Matrix3x3 mat3x3; MT_Matrix3x3 mat3x3;
switch(subtype) { switch(subtype) {
case MATHUTILS_MAT_CB_ORI_LOCAL: case MATHUTILS_MAT_CB_ORI_LOCAL:
mat3x3.setValue3x3(mat_to); mat3x3.setValue3x3(bmo->data);
self->NodeSetLocalOrientation(mat3x3); self->NodeSetLocalOrientation(mat3x3);
self->NodeUpdateGS(0.f); self->NodeUpdateGS(0.f);
break; break;
case MATHUTILS_MAT_CB_ORI_GLOBAL: case MATHUTILS_MAT_CB_ORI_GLOBAL:
mat3x3.setValue3x3(mat_to); mat3x3.setValue3x3(bmo->data);
self->NodeSetLocalOrientation(mat3x3); self->NodeSetLocalOrientation(mat3x3);
self->NodeUpdateGS(0.f); self->NodeUpdateGS(0.f);
break; break;

View File

@@ -392,7 +392,7 @@ static int mathutils_obactu_generic_check(BaseMathObject *bmo)
return 1; return 1;
} }
static int mathutils_obactu_vector_get(BaseMathObject *bmo, 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(bmo->cb_user); KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
@@ -400,17 +400,17 @@ static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype, float *
switch(subtype) { switch(subtype) {
case MATHUTILS_VEC_CB_LINV: case MATHUTILS_VEC_CB_LINV:
self->m_linear_velocity.getValue(vec_from); self->m_linear_velocity.getValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_ANGV: case MATHUTILS_VEC_CB_ANGV:
self->m_angular_velocity.getValue(vec_from); self->m_angular_velocity.getValue(bmo->data);
break; break;
} }
return 1; return 1;
} }
static int mathutils_obactu_vector_set(BaseMathObject *bmo, 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(bmo->cb_user); KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL) if(self==NULL)
@@ -418,37 +418,37 @@ static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype, float *
switch(subtype) { switch(subtype) {
case MATHUTILS_VEC_CB_LINV: case MATHUTILS_VEC_CB_LINV:
self->m_linear_velocity.setValue(vec_to); self->m_linear_velocity.setValue(bmo->data);
break; break;
case MATHUTILS_VEC_CB_ANGV: case MATHUTILS_VEC_CB_ANGV:
self->m_angular_velocity.setValue(vec_to); self->m_angular_velocity.setValue(bmo->data);
break; break;
} }
return 1; return 1;
} }
static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{ {
float f[4]; float f[4];
/* lazy, avoid repeteing the case statement */ /* lazy, avoid repeteing the case statement */
if(!mathutils_obactu_vector_get(bmo, subtype, f)) if(!mathutils_obactu_vector_get(bmo, subtype))
return 0; return 0;
vec_from[index]= f[index]; bmo->data[index]= f[index];
return 1; return 1;
} }
static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, 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 */ /* lazy, avoid repeteing the case statement */
if(!mathutils_obactu_vector_get(bmo, subtype, vec_to)) if(!mathutils_obactu_vector_get(bmo, subtype))
return 0; return 0;
vec_to[index]= f; bmo->data[index]= f;
mathutils_obactu_vector_set(bmo, subtype, vec_to); mathutils_obactu_vector_set(bmo, subtype);
return 1; return 1;
} }