Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_ParentActuator.cpp
| Context not available. | |||||
| #include "KX_ParentActuator.h" | #include "KX_ParentActuator.h" | ||||
| #include "KX_GameObject.h" | #include "KX_GameObject.h" | ||||
| #include "KX_PythonInit.h" | #include "KX_Globals.h" | ||||
| #include "EXP_PyObjectPlus.h" | #include "EXP_PyObjectPlus.h" | ||||
| Context not available. | |||||
| return false; | return false; | ||||
| } | } | ||||
| void KX_ParentActuator::Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map) | void KX_ParentActuator::Relink(std::map<void *, void *>& obj_map) | ||||
| { | { | ||||
| void **h_obj = (*obj_map)[m_ob]; | void *h_obj = obj_map[m_ob]; | ||||
| if (h_obj) { | if (h_obj) { | ||||
| if (m_ob) | if (m_ob) | ||||
| m_ob->UnregisterActuator(this); | m_ob->UnregisterActuator(this); | ||||
| m_ob = (SCA_IObject*)(*h_obj); | m_ob = (SCA_IObject *)h_obj; | ||||
| m_ob->RegisterActuator(this); | m_ob->RegisterActuator(this); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| return false; // do nothing on negative events | return false; // do nothing on negative events | ||||
| KX_GameObject *obj = (KX_GameObject*) GetParent(); | KX_GameObject *obj = (KX_GameObject*) GetParent(); | ||||
| KX_Scene *scene = KX_GetActiveScene(); | |||||
| switch (m_mode) { | switch (m_mode) { | ||||
| case KX_PARENT_SET: | case KX_PARENT_SET: | ||||
| if (m_ob) | if (m_ob) | ||||
| obj->SetParent(scene, (KX_GameObject*)m_ob, m_addToCompound, m_ghost); | obj->SetParent((KX_GameObject*)m_ob, m_addToCompound, m_ghost); | ||||
| break; | break; | ||||
| case KX_PARENT_REMOVE: | case KX_PARENT_REMOVE: | ||||
| obj->RemoveParent(scene); | obj->RemoveParent(); | ||||
| break; | break; | ||||
| }; | }; | ||||
| Context not available. | |||||
| KX_PYATTRIBUTE_INT_RW("mode", KX_PARENT_NODEF+1, KX_PARENT_MAX-1, true, KX_ParentActuator, m_mode), | KX_PYATTRIBUTE_INT_RW("mode", KX_PARENT_NODEF+1, KX_PARENT_MAX-1, true, KX_ParentActuator, m_mode), | ||||
| KX_PYATTRIBUTE_BOOL_RW("compound", KX_ParentActuator, m_addToCompound), | KX_PYATTRIBUTE_BOOL_RW("compound", KX_ParentActuator, m_addToCompound), | ||||
| KX_PYATTRIBUTE_BOOL_RW("ghost", KX_ParentActuator, m_ghost), | KX_PYATTRIBUTE_BOOL_RW("ghost", KX_ParentActuator, m_ghost), | ||||
| { NULL } //Sentinel | KX_PYATTRIBUTE_NULL //Sentinel | ||||
| }; | }; | ||||
| PyObject *KX_ParentActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) | PyObject *KX_ParentActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) | ||||
| Context not available. | |||||