PyObject* VRPyTransform::getCollisions(VRPyTransform* self) { if (!self->valid()) return NULL; auto cols = self->objPtr->getPhysics()->getCollisions(); PyObject* res = PyList_New(cols.size()); int i=0; for (auto c : cols) { PyObject* cres = PyTuple_New(3); PyTuple_SetItem(cres, 0, toPyTuple(c.pos1)); PyTuple_SetItem(cres, 1, toPyTuple(c.pos2)); PyTuple_SetItem(cres, 2, toPyTuple(c.norm)); PyList_SetItem(res, i, cres); i++; } return res; }
PyObject* VRPyPath::getPoints(VRPyPath* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyPath::getPoints - Object is invalid"); return NULL; } auto pnts = self->obj->getPoints(); if (pnts.size() == 0) return PyList_New(0); PyObject* res = PyList_New(pnts.size()); for (uint i=0; i<pnts.size(); i++) { PyObject* pnt = PyList_New(4); PyList_SetItem(pnt, 0, toPyTuple(pnts[i].p)); PyList_SetItem(pnt, 1, toPyTuple(pnts[i].n)); PyList_SetItem(pnt, 2, toPyTuple(pnts[i].c)); PyList_SetItem(pnt, 3, toPyTuple(pnts[i].u)); PyList_SetItem(res, i, pnt); } return res; }
PyObject* VRPyTransform::getCollisions(VRPyTransform* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::setGhost, Object is invalid"); return NULL; } auto cols = self->obj->getPhysics()->getCollisions(); PyObject* res = PyList_New(cols.size()); int i=0; for (auto c : cols) { PyObject* cres = PyTuple_New(3); PyTuple_SetItem(cres, 0, toPyTuple(c.pos1)); PyTuple_SetItem(cres, 1, toPyTuple(c.pos2)); PyTuple_SetItem(cres, 2, toPyTuple(c.norm)); PyList_SetItem(res, i, cres); i++; } return res; }
PyObject* VRPyPath::getPositions(VRPyPath* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyPath::getPositions - Object is invalid"); return NULL; } auto pos = self->obj->getPositions(); if (pos.size() == 0) return PyList_New(0); PyObject* res = PyList_New(pos.size()); for (uint i=0; i<pos.size(); i++) PyList_SetItem(res, i, toPyTuple(pos[i])); return res; }
PyObject* VRPyTransform::getConstraintAngleWith(VRPyTransform* self, PyObject *args) { if (!self->valid()) return NULL; VRPyTransform *t; int rotationOrPosition = 0; if (! PyArg_ParseTuple(args, "Oi",&t, &rotationOrPosition)) return NULL; OSG::Vec3f a = OSG::Vec3f(0.0,0.0,0.0); //cout << (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),rotationOrPosition)); if(rotationOrPosition == 0) { a[0] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),0)); a[1] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),1)); a[2] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),2)); } else if(rotationOrPosition == 1) { a[0] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),3)); a[1] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),4)); a[2] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),5)); } //Py_RETURN_TRUE; return toPyTuple(a); }
PyObject* VRPyRecorder::getUp(VRPyRecorder* self, PyObject* args) { return toPyTuple(self->obj->getUp( parseInt(args) ) ); }
PyObject* VRPyColorChooser::getLastColor(VRPyColorChooser* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyColorChooser::getColor - Object is invalid"); return NULL; } return toPyTuple( self->obj->getLastColor() ); }
PyObject* VRPyTransform::getTorque(VRPyTransform* self) { if (!self->valid()) return NULL; OSG::Vec3f i = self->objPtr->getPhysics()->getForce(); return toPyTuple(i); }
PyObject* VRPyTransform::getScale(VRPyTransform* self) { if (!self->valid()) return NULL; return toPyTuple(self->objPtr->getScale()); }
PyObject* VRPyTransform::getWorldDir(VRPyTransform* self) { if (!self->valid()) return NULL; return toPyTuple(self->objPtr->getWorldDirection()); }
PyObject* VRPyTransform::getTorque(VRPyTransform* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getTorque: C Object is invalid"); return NULL; } OSG::Vec3f i = self->obj->getPhysics()->getForce(); return toPyTuple(i); }
PyObject* VRPyTransform::getScale(VRPyTransform* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getScale, Object is invalid"); return NULL; } return toPyTuple(self->obj->getScale()); }
PyObject* VRPyTransform::getWFrom(VRPyTransform* self) { if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getWFrom, Object is invalid"); return NULL; } return toPyTuple(self->obj->getWorldPosition()); }
PyObject* VRPyMaterial::getSpecular(VRPyMaterial* self) { if (self->objPtr == 0) { PyErr_SetString(err, "VRPyMaterial::getSpecular, C obj is invalid"); return NULL; } return toPyTuple(self->objPtr->getSpecular()); }