Skip to content

Commit

Permalink
UPBGE: Remove use of void * in python attributes callbacks.
Browse files Browse the repository at this point in the history
Previously all the python callbacks were using void pointer to the instance to
work from, but using a void * failed in some cast case.

For example if you have a diamond inheritance solved by using a virtual inheritance
the cast to void * then later to the class type will failed giving a correct
base class:

Base *base = new Final();
static_cast<Final *>(base) --> valid access to Final
static_cast<Final *>((void *)base) --> invalid access to Final

This behaviour is due of the C cast behavior for void * which is different than
the C++ cast behavior.

To solve any of these tenious issue, the usage of void * is replaced by
PyObjectPlus * in all the python attributes functions. This as also the advantage
to let static_cast check at compilation cast incompatiblity like the error in
BL_ArmatureConstraint detected and solved in this commit.
  • Loading branch information
panzergame committed Jan 18, 2017
1 parent da3a600 commit 6173a6a
Show file tree
Hide file tree
Showing 127 changed files with 967 additions and 966 deletions.
14 changes: 7 additions & 7 deletions source/gameengine/Converter/BL_ActionActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,13 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
KX_PYATTRIBUTE_NULL //Sentinel
};

PyObject *BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ActionActuator::pyattr_get_action(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
}

int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ActionActuator::pyattr_set_action(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);

Expand Down Expand Up @@ -597,7 +597,7 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF

}

PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ActionActuator::pyattr_get_channel_names(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
PyErr_SetString(PyExc_NotImplementedError, "BL_ActionActuator.channelNames no longer works, please use BL_ArmatureObject.channels instead");
return NULL;
Expand Down Expand Up @@ -628,13 +628,13 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
#endif
}

PyObject *BL_ActionActuator::pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ActionActuator::pyattr_get_use_continue(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
return PyBool_FromLong(self->m_flag & ACT_FLAG_CONTINUE);
}

int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ActionActuator::pyattr_set_use_continue(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);

Expand All @@ -646,13 +646,13 @@ int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUT
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ActionActuator::pyattr_get_frame(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
return PyFloat_FromDouble(((KX_GameObject*)self->m_gameobj)->GetActionFrame(self->m_layer));
}

int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ActionActuator::pyattr_set_frame(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);

Expand Down
20 changes: 10 additions & 10 deletions source/gameengine/Converter/BL_ActionActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ class BL_ActionActuator : public SCA_IActuator
KX_PYMETHOD_O(BL_ActionActuator,GetChannel)
KX_PYMETHOD_DOC(BL_ActionActuator,setChannel)

static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);

static int CheckBlendTime(void *self, const PyAttributeDef*)
static PyObject* pyattr_get_action(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_channel_names(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_use_continue(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_use_continue(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_frame(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_frame(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);

static int CheckBlendTime(PyObjectPlus *self, const PyAttributeDef*)
{
BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);

Expand All @@ -93,7 +93,7 @@ class BL_ActionActuator : public SCA_IActuator
return 0;
}

static int CheckType(void *self, const PyAttributeDef*)
static int CheckType(PyObjectPlus *self, const PyAttributeDef*)
{
BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);

Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Converter/BL_ArmatureActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ PyAttributeDef BL_ArmatureActuator::Attributes[] = {
KX_PYATTRIBUTE_NULL //Sentinel
};

PyObject *BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureActuator::pyattr_get_object(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
KX_GameObject *target = (attrdef->m_name == "target") ? actuator->m_gametarget : actuator->m_gamesubtarget;
Expand All @@ -237,7 +237,7 @@ PyObject *BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYA
return target->GetProxy();
}

int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ArmatureActuator::pyattr_set_object(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
KX_GameObject* &target = (attrdef->m_name == "target") ? actuator->m_gametarget : actuator->m_gamesubtarget;
Expand All @@ -257,7 +257,7 @@ int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBU
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_ArmatureActuator::pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureActuator::pyattr_get_constraint(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
BL_ArmatureConstraint* constraint = actuator->m_constraint;
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Converter/BL_ArmatureActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class BL_ArmatureActuator : public SCA_IActuator
#ifdef WITH_PYTHON

/* These are used to get and set m_target */
static PyObject *pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject *pyattr_get_constraint(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_object(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);

#endif /* WITH_PYTHON */

Expand Down
15 changes: 8 additions & 7 deletions source/gameengine/Converter/BL_ArmatureChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = {
KX_PYATTRIBUTE_NULL //Sentinel
};

PyObject *BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureChannel::py_attr_getattr(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
bPoseChannel* channel = self->m_posechannel;
Expand Down Expand Up @@ -174,7 +174,7 @@ PyObject *BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYAT
return NULL;
}

int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ArmatureChannel::py_attr_setattr(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
bPoseChannel* channel = self->m_posechannel;
Expand All @@ -199,9 +199,10 @@ int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUT
return PY_SET_ATTR_FAIL;
}

PyObject *BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureChannel::py_attr_get_joint_rotation(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
bPoseChannel* pchan = static_cast<bPoseChannel*>(self_v);
BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
bPoseChannel* pchan = self->m_posechannel;
// decompose the pose matrix in euler rotation
float rest_mat[3][3];
float pose_mat[3][3];
Expand Down Expand Up @@ -297,7 +298,7 @@ PyObject *BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
return Vector_CreatePyObject(joints, 3, NULL);
}

int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ArmatureChannel::py_attr_set_joint_rotation(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
bPoseChannel* pchan = self->m_posechannel;
Expand Down Expand Up @@ -439,7 +440,7 @@ PyAttributeDef BL_ArmatureBone::AttributesPtr[] = {
KX_PYATTRIBUTE_NULL //Sentinel
};

PyObject *BL_ArmatureBone::py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureBone::py_bone_get_parent(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
Bone* bone = reinterpret_cast<Bone*>(self);
if (bone->parent) {
Expand All @@ -449,7 +450,7 @@ PyObject *BL_ArmatureBone::py_bone_get_parent(void *self, const struct KX_PYATTR
Py_RETURN_NONE;
}

PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureBone::py_bone_get_children(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
Bone* bone = reinterpret_cast<Bone*>(self);
Bone* child;
Expand Down
12 changes: 6 additions & 6 deletions source/gameengine/Converter/BL_ArmatureChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class BL_ArmatureChannel : public CValue
// Python access
virtual PyObject *py_repr(void);

static PyObject *py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject *py_attr_get_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_set_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject *py_attr_getattr(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject *py_attr_get_joint_rotation(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_set_joint_rotation(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
#endif /* WITH_PYTHON */
};

Expand All @@ -90,8 +90,8 @@ class BL_ArmatureBone : public PyObjectPlus

#ifdef WITH_PYTHON
static PyObject *py_bone_repr(PyObject *self);
static PyObject *py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *py_bone_get_parent(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *py_bone_get_children(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
#endif

};
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_ArmatureConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ PyAttributeDef BL_ArmatureConstraint::Attributes[] = {
};


PyObject *BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureConstraint::py_attr_getattr(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureConstraint* self = static_cast<BL_ArmatureConstraint*>(self_v);
bConstraint* constraint = self->m_constraint;
Expand Down Expand Up @@ -352,7 +352,7 @@ PyObject *BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P
return NULL;
}

int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int BL_ArmatureConstraint::py_attr_setattr(PyObjectPlus *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ArmatureConstraint* self = static_cast<BL_ArmatureConstraint*>(self_v);
bConstraint* constraint = self->m_constraint;
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_ArmatureConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class BL_ArmatureConstraint : public CValue
// Python access
virtual PyObject *py_repr(void);

static PyObject *py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject *py_attr_getattr(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
#endif /* WITH_PYTHON */
};

Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_ArmatureObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,13 @@ PyAttributeDef BL_ArmatureObject::Attributes[] = {
KX_PYATTRIBUTE_NULL //Sentinel
};

PyObject *BL_ArmatureObject::pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureObject::pyattr_get_constraints(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureObject *self = static_cast<BL_ArmatureObject *>(self_v);
return self->m_controlledConstraints->GetProxy();
}

PyObject *BL_ArmatureObject::pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject *BL_ArmatureObject::pyattr_get_channels(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ArmatureObject *self = static_cast<BL_ArmatureObject *>(self_v);
self->LoadChannels(); // make sure we have the channels
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_ArmatureObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ class BL_ArmatureObject : public KX_GameObject
#ifdef WITH_PYTHON

// PYTHON
static PyObject *pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_constraints(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_channels(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, update);
KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, draw);

Expand Down
10 changes: 5 additions & 5 deletions source/gameengine/Converter/KX_LibLoadStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ PyTypeObject KX_LibLoadStatus::Type = {
};


PyObject* KX_LibLoadStatus::pyattr_get_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject* KX_LibLoadStatus::pyattr_get_onfinish(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);

Expand All @@ -198,7 +198,7 @@ PyObject* KX_LibLoadStatus::pyattr_get_onfinish(void *self_v, const KX_PYATTRIBU
Py_RETURN_NONE;
}

int KX_LibLoadStatus::pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int KX_LibLoadStatus::pyattr_set_onfinish(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);

Expand All @@ -216,7 +216,7 @@ int KX_LibLoadStatus::pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}

PyObject* KX_LibLoadStatus::pyattr_get_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject* KX_LibLoadStatus::pyattr_get_onprogress(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);

Expand All @@ -228,7 +228,7 @@ PyObject* KX_LibLoadStatus::pyattr_get_onprogress(void *self_v, const KX_PYATTRI
Py_RETURN_NONE;
}

int KX_LibLoadStatus::pyattr_set_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
int KX_LibLoadStatus::pyattr_set_onprogress(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);

Expand All @@ -246,7 +246,7 @@ int KX_LibLoadStatus::pyattr_set_onprogress(void *self_v, const KX_PYATTRIBUTE_D
return PY_SET_ATTR_SUCCESS;
}

PyObject* KX_LibLoadStatus::pyattr_get_timetaken(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
PyObject* KX_LibLoadStatus::pyattr_get_timetaken(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);

Expand Down
10 changes: 5 additions & 5 deletions source/gameengine/Converter/KX_LibLoadStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class KX_LibLoadStatus : public PyObjectPlus
void AddProgress(float progress);

#ifdef WITH_PYTHON
static PyObject* pyattr_get_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_onfinish(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_onfinish(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_onprogress(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_onprogress(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);

static PyObject* pyattr_get_timetaken(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_timetaken(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
#endif
};

Expand Down
12 changes: 6 additions & 6 deletions source/gameengine/Expressions/EXP_PyObjectPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ typedef struct PyObjectPlus_Proxy {
/// Opposite of BGE_PROXY_REF.
#define BGE_PROXY_FROM_REF(_self) (((PyObjectPlus *)_self)->GetProxy())
/// Same as 'BGE_PROXY_REF' but doesn't incref.
#define BGE_PROXY_FROM_REF_BORROW(_self) _bge_proxy_from_ref_borrow((void *)_self)
#define BGE_PROXY_FROM_REF_BORROW(_self) _bge_proxy_from_ref_borrow(_self)


/** This must be the first line of each
Expand Down Expand Up @@ -354,9 +354,9 @@ enum KX_PYATTRIBUTE_ACCESS {
};

struct KX_PYATTRIBUTE_DEF;
typedef int (*KX_PYATTRIBUTE_CHECK_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
typedef int (*KX_PYATTRIBUTE_SET_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
typedef PyObject *(*KX_PYATTRIBUTE_GET_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
typedef int (*KX_PYATTRIBUTE_CHECK_FUNCTION)(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
typedef int (*KX_PYATTRIBUTE_SET_FUNCTION)(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
typedef PyObject *(*KX_PYATTRIBUTE_GET_FUNCTION)(PyObjectPlus *self, const struct KX_PYATTRIBUTE_DEF *attrdef);

typedef struct KX_PYATTRIBUTE_DEF {
/// Name of the python attribute.
Expand Down Expand Up @@ -611,7 +611,7 @@ class PyObjectPlus
static int py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef);

/// Kindof dumb, always returns True, the false case is checked for, before this function gets accessed.
static PyObject *pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_invalid(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);

static PyObject *GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr);
/** self=NULL => proxy to generic pointer detached from GE object
Expand Down Expand Up @@ -646,7 +646,7 @@ class PyObjectPlus
#ifdef WITH_PYTHON
PyObject *PyUnicode_FromStdString(const std::string& str);

inline PyObject *_bge_proxy_from_ref_borrow(void *self_v)
inline PyObject *_bge_proxy_from_ref_borrow(PyObjectPlus *self_v)
{
PyObject *self_proxy = BGE_PROXY_FROM_REF(self_v);
/* this is typically _very_ bad practice,
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Expressions/EXP_Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CValue : public PyObjectPlus

virtual CValue *ConvertPythonToValue(PyObject *pyobj, const bool do_type_exception, const char *error_prefix);

static PyObject *pyattr_get_name(void *self, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_name(PyObjectPlus *self, const KX_PYATTRIBUTE_DEF *attrdef);

virtual PyObject *ConvertKeysToPython(void);
#endif // WITH_PYTHON
Expand Down
Loading

0 comments on commit 6173a6a

Please sign in to comment.