Пример #1
0
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;
}
Пример #2
0
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;
}
Пример #3
0
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;
}
Пример #4
0
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;
}
Пример #5
0
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);
}
Пример #6
0
PyObject* VRPyRecorder::getUp(VRPyRecorder* self, PyObject* args) { return toPyTuple(self->obj->getUp( parseInt(args) ) ); }
Пример #7
0
PyObject* VRPyColorChooser::getLastColor(VRPyColorChooser* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyColorChooser::getColor - Object is invalid"); return NULL; }
    return toPyTuple( self->obj->getLastColor() );
}
Пример #8
0
PyObject* VRPyTransform::getTorque(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    OSG::Vec3f i = self->objPtr->getPhysics()->getForce();
    return toPyTuple(i);
}
Пример #9
0
PyObject* VRPyTransform::getScale(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    return toPyTuple(self->objPtr->getScale());
}
Пример #10
0
PyObject* VRPyTransform::getWorldDir(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    return toPyTuple(self->objPtr->getWorldDirection());
}
Пример #11
0
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);
}
Пример #12
0
PyObject* VRPyTransform::getScale(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getScale, Object is invalid"); return NULL; }
    return toPyTuple(self->obj->getScale());
}
Пример #13
0
PyObject* VRPyTransform::getWFrom(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getWFrom, Object is invalid"); return NULL; }
    return toPyTuple(self->obj->getWorldPosition());
}
Пример #14
0
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());
}