diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 05:32:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 05:32:37 +0400 |
commit | dd918da8de8b885d90420dc86351a4996dbd6ea6 (patch) | |
tree | 71941227e76d9fd815b451c07a4f6a610720c6db /source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp | |
parent | e9ca43521f99c6b9baf6d9278f85323086fcade2 (diff) |
ReplaceMesh Actuator option to replace the physics mesh and display mesh + python api options.
When the mesh field is left blank and Physics option is enabled, it reinstances the physics mesh from the existing mesh.
like calling gameOb.reinstancePhysicsMesh() from python.
Diffstat (limited to 'source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index 00842d7012a..6bb9385889f 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -96,6 +96,8 @@ PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = { PyAttributeDef KX_SCA_ReplaceMeshActuator::Attributes[] = { KX_PYATTRIBUTE_RW_FUNCTION("mesh", KX_SCA_ReplaceMeshActuator, pyattr_get_mesh, pyattr_set_mesh), + KX_PYATTRIBUTE_BOOL_RW ("useDisplayMesh", KX_SCA_ReplaceMeshActuator, m_use_gfx), + KX_PYATTRIBUTE_BOOL_RW ("usePhysicsMesh", KX_SCA_ReplaceMeshActuator, m_use_phys), { NULL } //Sentinel }; @@ -179,11 +181,15 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh, KX_SCA_ReplaceMeshActuator::KX_SCA_ReplaceMeshActuator(SCA_IObject *gameobj, class RAS_MeshObject *mesh, SCA_IScene* scene, + bool use_gfx, + bool use_phys, PyTypeObject* T) : SCA_IActuator(gameobj, T), m_mesh(mesh), - m_scene(scene) + m_scene(scene), + m_use_gfx(use_gfx), + m_use_phys(use_phys) { } /* End of constructor */ @@ -205,7 +211,8 @@ bool KX_SCA_ReplaceMeshActuator::Update() if (bNegativeEvent) return false; // do nothing on negative events - if (m_mesh) m_scene->ReplaceMesh(GetParent(),m_mesh); + if (m_mesh || m_use_phys) /* NULL mesh is ok if were updating physics */ + m_scene->ReplaceMesh(GetParent(),m_mesh, m_use_gfx, m_use_phys); return false; } @@ -227,7 +234,7 @@ CValue* KX_SCA_ReplaceMeshActuator::GetReplica() void KX_SCA_ReplaceMeshActuator::InstantReplaceMesh() { - if (m_mesh) m_scene->ReplaceMesh(GetParent(),m_mesh); + if (m_mesh) m_scene->ReplaceMesh(GetParent(),m_mesh, m_use_gfx, m_use_phys); } /* eof */ |