From 9ed079bf5cbe8a5a371190a8dedec970bcbd3ac2 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 19 Jul 2008 07:45:19 +0000 Subject: BGE patch: Relink actuators with target within group when duplicating group; generalize protection against object deletion for all actuators that point to objects. Certain actuators hold a pointer to an objects: Property, SceneCamera, AddObject, Camera, Parent, TractTo. When a group is duplicated, the actuators that point to objects within the group will be relinked to point to the replicated objects and not to the original objects. This helps to setup self-contained group with a camera following a character for example. This feature also works when adding a single object (and all its children) with the AddObject actuator. The second part of the patch extends the protection against object deletion to all the actuators of the above list (previously, only the TrackTo, AddObject and Property actuators were protected). In case the target object of these actuators is deleted, the BGE won't crash. --- source/gameengine/Ketsji/KX_ParentActuator.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/gameengine/Ketsji/KX_ParentActuator.h') diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index 86dcd4e6c12..5255abf2e42 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -47,7 +47,7 @@ class KX_ParentActuator : public SCA_IActuator int m_mode; /** Object to set as parent */ - CValue *m_ob; + SCA_IObject *m_ob; @@ -62,12 +62,15 @@ class KX_ParentActuator : public SCA_IActuator KX_ParentActuator(class SCA_IObject* gameobj, int mode, - CValue *ob, + SCA_IObject *ob, PyTypeObject* T=&Type); virtual ~KX_ParentActuator(); virtual bool Update(); virtual CValue* GetReplica(); + virtual void ProcessReplica(); + virtual void KX_ParentActuator::Relink(GEN_Map *obj_map); + virtual bool KX_ParentActuator::UnlinkObject(SCA_IObject* clientobj); /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ -- cgit v1.2.3