diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-22 18:42:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-22 18:42:00 +0400 |
commit | 5553d2c0142539c754575ce471c2676e0d5dff34 (patch) | |
tree | 7842bd82afbc5cf797594dbee03fb881039e37b9 /source/gameengine/Converter | |
parent | a8592d09d0173bab0e3eb66a315146e164cf14a4 (diff) |
BGE C++ API
PyObjectPlus::ProcessReplica() is now called when any of its subclasses are replicated.
This is important because PyObjectPlus::ProcessReplica() NULL's the 'm_proxy' python pointer I added recently.
Without this a replicated subclass of PyObjectPlus could have an invalid pointer (crashing the BGE).
This change also means CValue::AddDataToReplica() can be moved into CValue::ProcessReplica() since ProcessReplica is always called.
Diffstat (limited to 'source/gameengine/Converter')
6 files changed, 7 insertions, 17 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 3002005ae3f..e06008ff891 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -66,9 +66,9 @@ BL_ActionActuator::~BL_ActionActuator() game_free_pose(m_blendpose); } -void BL_ActionActuator::ProcessReplica(){ -// bPose *oldpose = m_pose; -// bPose *oldbpose = m_blendpose; +void BL_ActionActuator::ProcessReplica() +{ + SCA_IActuator::ProcessReplica(); m_pose = NULL; m_blendpose = NULL; @@ -84,9 +84,6 @@ void BL_ActionActuator::SetBlendTime (float newtime){ CValue* BL_ActionActuator::GetReplica() { BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName()); replica->ProcessReplica(); - - // this will copy properties and so on... - CValue::AddDataToReplica(replica); return replica; } diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 04e2c55e7dd..b00b493193d 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -70,10 +70,6 @@ BL_ArmatureObject::BL_ArmatureObject( CValue* BL_ArmatureObject::GetReplica() { BL_ArmatureObject* replica = new BL_ArmatureObject(*this); - - // this will copy properties and so on... - CValue::AddDataToReplica(replica); - replica->ProcessReplica(); return replica; } diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 618744dc1f3..241ff8d2aaf 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -53,10 +53,6 @@ CValue* BL_DeformableGameObject::GetReplica() { BL_DeformableGameObject* replica = new BL_DeformableGameObject(*this);//m_float,GetName()); - - // this will copy properties and so on... - CValue::AddDataToReplica(replica); - replica->ProcessReplica(); return replica; } diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index 6113f88e331..79ee6be47f0 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -87,6 +87,7 @@ RAS_Deformer *BL_ModifierDeformer::GetReplica(class KX_GameObject* replica) void BL_ModifierDeformer::ProcessReplica() { + /* Note! - This is not inherited from PyObjectPlus */ BL_ShapeDeformer::ProcessReplica(); m_dm = NULL; m_lastModifierUpdate = -1; diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index a447ffb8aa9..60d26b9a99f 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -61,6 +61,7 @@ BL_ShapeActionActuator::~BL_ShapeActionActuator() void BL_ShapeActionActuator::ProcessReplica() { + SCA_IActuator::ProcessReplica(); m_localtime=m_startframe; m_lastUpdate=-1; } @@ -74,9 +75,6 @@ CValue* BL_ShapeActionActuator::GetReplica() { BL_ShapeActionActuator* replica = new BL_ShapeActionActuator(*this);//m_float,GetName()); replica->ProcessReplica(); - - // this will copy properties and so on... - CValue::AddDataToReplica(replica); return replica; } diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index ae3e1a10005..3267dbce410 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -156,6 +156,8 @@ RAS_Deformer *BL_SkinDeformer::GetReplica(class KX_GameObject* replica) BL_SkinDeformer *result; result = new BL_SkinDeformer(*this); + /* Not inherited from PyObjectPlus so this isnt needed */ + /* Just call a dummy function below, will be optimized out */ result->ProcessReplica(); return result; } |