Applied patch #5247 by scabootssca. This adds an instant replace mesh feature.

This commit is contained in:
Charlie Carley 2007-03-26 03:35:01 +00:00
parent c97be098f7
commit 7fd8ba99bb
2 changed files with 20 additions and 3 deletions

@ -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 */

@ -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);
};