Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
| Context not available. | |||||
| static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)"; | static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)"; | ||||
| static char gPyGetConstraints__doc__[] = "getConstraints(KX_GameObject obj)"; | |||||
| static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)"; | static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)"; | ||||
| static char gPyGetCharacter__doc__[] = "getCharacter(KX_GameObject obj)"; | static char gPyGetCharacter__doc__[] = "getCharacter(KX_GameObject obj)"; | ||||
| static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)"; | static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)"; | ||||
| Context not available. | |||||
| &pivotX,&pivotY,&pivotZ); | &pivotX,&pivotY,&pivotZ); | ||||
| #endif | #endif | ||||
| } | } | ||||
| else if (len == 7) | |||||
| { | |||||
| #if defined(_WIN64) | |||||
| success = PyArg_ParseTuple(args,"LLifffi",&physicsid,&physicsid2,&constrainttype, | |||||
| &pivotX,&pivotY,&pivotZ,&flag); | |||||
| #else | |||||
| success = PyArg_ParseTuple(args,"llifffi",&physicsid,&physicsid2,&constrainttype, | |||||
| &pivotX,&pivotY,&pivotZ,&flag); | |||||
| #endif | |||||
| } | |||||
moguri: Is this for this patch or another patch? It doesn't seem related. Maybe I'm just missing some… | |||||
hg1AuthorUnsubmitted Not Done Inline ActionsNo. I deliberately put this in this patch. I thought it is not necessary to make an extra patch for this. hg1: No. I deliberately put this in this patch. I thought it is not necessary to make an extra… | |||||
| else if (len == 9) | else if (len == 9) | ||||
| { | { | ||||
| #if defined(_WIN64) | #if defined(_WIN64) | ||||
| Context not available. | |||||
| } | } | ||||
| static PyObject* gPyGetConstraints(PyObject* self, | |||||
moguriUnsubmitted Not Done Inline ActionsI'm currently not to fond of the extra constraints data code being added to KX_GameObject to handle this. Maybe there is a better way to do this? For example, can we get a list of KX_ConstraintWrappers from the KX_GameObject's PHY_IPhysicsController? This would probably work in a similar fashion as getting vehicle constraint wrappers. moguri: I'm currently not to fond of the extra constraints data code being added to KX_GameObject to… | |||||
hg1AuthorUnsubmitted Not Done Inline ActionsThis will cause a crash. (Edit on line 80) hg1: This will cause a crash. (Edit on line 80) | |||||
| PyObject* args, | |||||
| PyObject* kwds) | |||||
| { | |||||
| PyObject* pyob; | |||||
| KX_GameObject *ob; | |||||
| if (!PyArg_ParseTuple(args,"O", &pyob)) | |||||
| return NULL; | |||||
| if (!ConvertPythonToGameObject(pyob, &ob, false, "bge.constraints.getConstraints(value)")) | |||||
| return NULL; | |||||
| if (PHY_GetActiveEnvironment()) { | |||||
| int elemets = ob->GetConstraintsData().size(); | |||||
| if (elemets > 0) { | |||||
| PyObject *pyWrapperList = PyList_New(elemets); | |||||
| for (int i=0; i < elemets; i++) { | |||||
| ConstraintData *tmp = ob->GetConstraintsData()[i]; | |||||
| KX_ConstraintWrapper *wrapper = new KX_ConstraintWrapper((enum PHY_ConstraintType)tmp->m_constraintType, tmp->m_constraintId, tmp->m_physenv); | |||||
| PyList_SET_ITEM(pyWrapperList, i, wrapper->NewProxy(true)); | |||||
| } | |||||
| return pyWrapperList; | |||||
| } | |||||
| } | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| static PyObject *gPyGetAppliedImpulse(PyObject *self, | static PyObject *gPyGetAppliedImpulse(PyObject *self, | ||||
| Context not available. | |||||
| {"createConstraint",(PyCFunction) gPyCreateConstraint, | {"createConstraint",(PyCFunction) gPyCreateConstraint, | ||||
| METH_VARARGS, (const char *)gPyCreateConstraint__doc__}, | METH_VARARGS, (const char *)gPyCreateConstraint__doc__}, | ||||
| {"getConstraints",(PyCFunction) gPyGetConstraints, | |||||
| METH_VARARGS, (const char *)gPyGetConstraints__doc__}, | |||||
| {"getVehicleConstraint",(PyCFunction) gPyGetVehicleConstraint, | {"getVehicleConstraint",(PyCFunction) gPyGetVehicleConstraint, | ||||
| METH_VARARGS, (const char *)gPyGetVehicleConstraint__doc__}, | METH_VARARGS, (const char *)gPyGetVehicleConstraint__doc__}, | ||||
| Context not available. | |||||
| KX_MACRO_addTypesToDict(d, ANGULAR_CONSTRAINT, PHY_ANGULAR_CONSTRAINT); | KX_MACRO_addTypesToDict(d, ANGULAR_CONSTRAINT, PHY_ANGULAR_CONSTRAINT); | ||||
| KX_MACRO_addTypesToDict(d, CONETWIST_CONSTRAINT, PHY_CONE_TWIST_CONSTRAINT); | KX_MACRO_addTypesToDict(d, CONETWIST_CONSTRAINT, PHY_CONE_TWIST_CONSTRAINT); | ||||
| KX_MACRO_addTypesToDict(d, VEHICLE_CONSTRAINT, PHY_VEHICLE_CONSTRAINT); | KX_MACRO_addTypesToDict(d, VEHICLE_CONSTRAINT, PHY_VEHICLE_CONSTRAINT); | ||||
| KX_MACRO_addTypesToDict(d, GENERIC_6DOF_CONSTRAINT, PHY_GENERIC_6DOF_CONSTRAINT); | |||||
| // Check for errors | // Check for errors | ||||
| if (PyErr_Occurred()) { | if (PyErr_Occurred()) { | ||||
| Context not available. | |||||
Is this for this patch or another patch? It doesn't seem related. Maybe I'm just missing some context.