forked from bartvdbraak/blender
BGE C++ API
Some functions used ProcessReplica(replica); others replica->ProcessReplica() Use the second method everywhere so the PyObjectPlus's ProcessReplica() can be called from its subclasses. Note that PyObjectPlus's ProcessReplica isnt used yet.
This commit is contained in:
parent
c09b1a985c
commit
a8592d09d0
@ -74,16 +74,17 @@ CValue* BL_ArmatureObject::GetReplica()
|
||||
// this will copy properties and so on...
|
||||
CValue::AddDataToReplica(replica);
|
||||
|
||||
ProcessReplica(replica);
|
||||
replica->ProcessReplica();
|
||||
return replica;
|
||||
}
|
||||
|
||||
void BL_ArmatureObject::ProcessReplica(BL_ArmatureObject *replica)
|
||||
void BL_ArmatureObject::ProcessReplica()
|
||||
{
|
||||
KX_GameObject::ProcessReplica(replica);
|
||||
bPose *pose= m_pose;
|
||||
KX_GameObject::ProcessReplica();
|
||||
|
||||
replica->m_pose = NULL;
|
||||
game_copy_pose(&replica->m_pose, m_pose);
|
||||
m_pose = NULL;
|
||||
game_copy_pose(&m_pose, pose);
|
||||
}
|
||||
|
||||
BL_ArmatureObject::~BL_ArmatureObject()
|
||||
|
@ -45,7 +45,7 @@ class BL_ArmatureObject : public KX_GameObject
|
||||
public:
|
||||
double GetLastFrame ();
|
||||
short GetActivePriority();
|
||||
virtual void ProcessReplica(BL_ArmatureObject *replica);
|
||||
virtual void ProcessReplica();
|
||||
class BL_ActionActuator * GetActiveAction();
|
||||
|
||||
BL_ArmatureObject(
|
||||
|
@ -41,16 +41,12 @@ BL_DeformableGameObject::~BL_DeformableGameObject()
|
||||
delete m_pDeformer; // __NLA : Temporary until we decide where to put this
|
||||
}
|
||||
|
||||
void BL_DeformableGameObject::ProcessReplica(KX_GameObject* replica)
|
||||
void BL_DeformableGameObject::ProcessReplica()
|
||||
{
|
||||
BL_MeshDeformer *deformer;
|
||||
KX_GameObject::ProcessReplica(replica);
|
||||
|
||||
if (m_pDeformer) {
|
||||
deformer = (BL_MeshDeformer*)m_pDeformer->GetReplica(replica);
|
||||
((BL_DeformableGameObject*)replica)->m_pDeformer = deformer;
|
||||
}
|
||||
KX_GameObject::ProcessReplica();
|
||||
|
||||
if (m_pDeformer)
|
||||
m_pDeformer= (BL_MeshDeformer*)m_pDeformer->GetReplica(this);
|
||||
}
|
||||
|
||||
CValue* BL_DeformableGameObject::GetReplica()
|
||||
@ -61,7 +57,7 @@ CValue* BL_DeformableGameObject::GetReplica()
|
||||
// this will copy properties and so on...
|
||||
CValue::AddDataToReplica(replica);
|
||||
|
||||
ProcessReplica(replica);
|
||||
replica->ProcessReplica();
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
m_pDeformer->Relink (map);
|
||||
KX_GameObject::Relink(map);
|
||||
};
|
||||
void ProcessReplica(KX_GameObject* replica);
|
||||
void ProcessReplica();
|
||||
|
||||
BL_DeformableGameObject(Object* blendobj, void* sgReplicationInfo, SG_Callbacks callbacks) :
|
||||
KX_GameObject(sgReplicationInfo,callbacks),
|
||||
|
@ -810,6 +810,14 @@ PyObject *PyObjectPlus::PyisA(PyObject *value) // Python wrapper for isA
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void PyObjectPlus::ProcessReplica()
|
||||
{
|
||||
/* Clear the proxy, will be created again if needed with GetProxy()
|
||||
* otherwise the PyObject will point to the wrong reference */
|
||||
m_proxy= NULL;
|
||||
}
|
||||
|
||||
/* Utility function called by the macro py_getattro_up()
|
||||
* for getting ob.__dict__() values from our PyObject
|
||||
* this is used by python for doing dir() on an object, so its good
|
||||
|
@ -450,6 +450,12 @@ public:
|
||||
|
||||
static PyObject *GetProxy_Ext(PyObjectPlus *self, PyTypeObject *tp);
|
||||
static PyObject *NewProxy_Ext(PyObjectPlus *self, PyTypeObject *tp, bool py_owns);
|
||||
|
||||
/**
|
||||
* Makes sure any internal data owned by this class is deep copied.
|
||||
*/
|
||||
virtual void ProcessReplica();
|
||||
|
||||
};
|
||||
|
||||
PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
|
||||
|
@ -72,15 +72,10 @@ CValue* KX_Camera::GetReplica()
|
||||
|
||||
// this will copy properties and so on...
|
||||
CValue::AddDataToReplica(replica);
|
||||
ProcessReplica(replica);
|
||||
replica->ProcessReplica();
|
||||
|
||||
return replica;
|
||||
}
|
||||
|
||||
void KX_Camera::ProcessReplica(KX_Camera* replica)
|
||||
{
|
||||
KX_GameObject::ProcessReplica(replica);
|
||||
}
|
||||
|
||||
MT_Transform KX_Camera::GetWorldToCamera() const
|
||||
{
|
||||
|
@ -146,15 +146,6 @@ public:
|
||||
virtual CValue*
|
||||
GetReplica(
|
||||
);
|
||||
|
||||
/**
|
||||
* Inherited from CValue -- Makes sure any internal
|
||||
* data owned by this class is deep copied. Called internally
|
||||
*/
|
||||
virtual void
|
||||
ProcessReplica(
|
||||
KX_Camera* replica
|
||||
);
|
||||
|
||||
MT_Transform GetWorldToCamera() const;
|
||||
MT_Transform GetCameraToWorld() const;
|
||||
|
@ -331,16 +331,16 @@ void KX_GameObject::RemoveParent(KX_Scene *scene)
|
||||
}
|
||||
}
|
||||
|
||||
void KX_GameObject::ProcessReplica(KX_GameObject* replica)
|
||||
void KX_GameObject::ProcessReplica()
|
||||
{
|
||||
replica->m_pPhysicsController1 = NULL;
|
||||
replica->m_pGraphicController = NULL;
|
||||
replica->m_pSGNode = NULL;
|
||||
replica->m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info);
|
||||
replica->m_pClient_info->m_gameobject = replica;
|
||||
replica->m_state = 0;
|
||||
m_pPhysicsController1 = NULL;
|
||||
m_pGraphicController = NULL;
|
||||
m_pSGNode = NULL;
|
||||
m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info);
|
||||
m_pClient_info->m_gameobject = this;
|
||||
m_state = 0;
|
||||
if(m_attr_dict)
|
||||
replica->m_attr_dict= PyDict_Copy(m_attr_dict);
|
||||
m_attr_dict= PyDict_Copy(m_attr_dict);
|
||||
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ CValue* KX_GameObject::GetReplica()
|
||||
|
||||
// this will copy properties and so on...
|
||||
CValue::AddDataToReplica(replica);
|
||||
ProcessReplica(replica);
|
||||
replica->ProcessReplica();
|
||||
|
||||
return replica;
|
||||
}
|
||||
|
@ -279,9 +279,7 @@ public:
|
||||
* data owned by this class is deep copied. Called internally
|
||||
*/
|
||||
virtual void
|
||||
ProcessReplica(
|
||||
KX_GameObject* replica
|
||||
);
|
||||
ProcessReplica();
|
||||
|
||||
/**
|
||||
* Return the linear velocity of the game object.
|
||||
|
@ -85,7 +85,7 @@ CValue* KX_LightObject::GetReplica()
|
||||
// this will copy properties and so on...
|
||||
CValue::AddDataToReplica(replica);
|
||||
|
||||
ProcessReplica(replica);
|
||||
replica->ProcessReplica();
|
||||
|
||||
replica->m_lightobj.m_worldmatrix = replica->GetOpenGLMatrixPtr();
|
||||
m_rendertools->AddLight(&replica->m_lightobj);
|
||||
|
Loading…
Reference in New Issue
Block a user