diff options
author | Charlie Carley <snailrose@gmail.com> | 2007-03-26 07:35:01 +0400 |
---|---|---|
committer | Charlie Carley <snailrose@gmail.com> | 2007-03-26 07:35:01 +0400 |
commit | 7fd8ba99bb536ae7927fe53de7f283207f193680 (patch) | |
tree | ad8a3035cebea2cacc5fb63a868b113fadfa2b65 /source/gameengine | |
parent | c97be098f7db70f09d7047b7d69de7cf2c6ced70 (diff) |
Applied patch #5247 by scabootssca. This adds an instant replace mesh feature.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 21 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index 452c92a77ec..221d531a1c2 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -83,9 +83,11 @@ PyParentObject KX_SCA_ReplaceMeshActuator::Parents[] = { PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = { - {"setMesh", (PyCFunction) KX_SCA_ReplaceMeshActuator::sPySetMesh, METH_VARARGS, SetMesh_doc}, - KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, getMesh), - {NULL,NULL} //Sentinel + {"setMesh", (PyCFunction) KX_SCA_ReplaceMeshActuator::sPySetMesh, METH_VARARGS, SetMesh_doc}, + + KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, instantReplaceMesh), + KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, getMesh), + {NULL,NULL} //Sentinel }; @@ -135,6 +137,14 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh, return PyString_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr())); } + +KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh, +"instantReplaceMesh() : immediately replace mesh without delay\n") +{ + InstantReplaceMesh(); + Py_Return; +} + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ @@ -191,4 +201,9 @@ CValue* KX_SCA_ReplaceMeshActuator::GetReplica() return replica; }; +void KX_SCA_ReplaceMeshActuator::InstantReplaceMesh() +{ + if (m_mesh) m_scene->ReplaceMesh(GetParent(),m_mesh); +} + /* eof */ diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h index c1b1fd6735d..339fce54c49 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h @@ -76,10 +76,12 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator _getattr( const STR_String& attr ); + void InstantReplaceMesh(); /* 1. setMesh */ KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,SetMesh); KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,getMesh); + KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh); }; |