Exemplo n.º 1
0
static int pyGenericPhysical_setRot(pyGenericPhysical* self, PyObject* value, void*) {
    if (value == NULL || !pyQuat_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "rot should be an hsQuat");
        return -1;
    }
    self->fThis->setRot(*((pyQuat*)value)->fThis);
    return 0;
}
Exemplo n.º 2
0
static int pyAffineParts_setU(pyAffineParts* self, PyObject* value, void*) {
    if (!pyQuat_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "U should be an hsUuat");
        return -1;
    }
    self->fThis->fU = *((pyQuat*)value)->fThis;
    return 0;
}
Exemplo n.º 3
0
static int pyQuatKey_setValue(pyQuatKey* self, PyObject* value, void*) {
    if (value == NULL || !pyQuat_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "value should be an hsQuat");
        return -1;
    }
    self->fThis->fValue = *((pyQuat*)value)->fThis;
    return 0;
}
Exemplo n.º 4
0
static PyObject* pyQuat_multiply(PyObject* left, PyObject* right) {
    if (pyQuat_Check(left)) {
        if (pyQuat_Check(right)) {
            return pyQuat_FromQuat(*((pyQuat*)left)->fThis * *((pyQuat*)right)->fThis);
        } else if (PyFloat_Check(right)) {
            return pyQuat_FromQuat(*((pyQuat*)left)->fThis * PyFloat_AsDouble(right));
        } else {
            PyErr_SetString(PyExc_TypeError, "Incompatible Types");
            return NULL;
        }
    } else if (pyQuat_Check(right)) {
        if (PyFloat_Check(left)) {
            return pyQuat_FromQuat(*((pyQuat*)right)->fThis * PyFloat_AsDouble(left));
        } else {
            PyErr_SetString(PyExc_TypeError, "Incompatible Types");
            return NULL;
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "This should not happen");
        return NULL;
    }
}
 static PyObject* pyCompressedQuatKey64_setValue(pyCompressedQuatKey64* self, PyObject* args) {
     pyQuat* value;
     int type;
     if (!PyArg_ParseTuple(args, "Oi", &value, &type)) {
         PyErr_SetString(PyExc_TypeError, "setValue expects hsQuat, int");
         return NULL;
     }
     if (!pyQuat_Check((PyObject*)value)) {
         PyErr_SetString(PyExc_TypeError, "setValue expects hsQuat, int");
         return NULL;
     }
     self->fThis->setQuat(*value->fThis, type);
     Py_INCREF(Py_None);
     return Py_None;
 }
Exemplo n.º 6
0
static int pyScaleKey_setValue(pyScaleKey* self, PyObject* value, void*) {
    if (value == NULL || !PyTuple_Check(value) || PyTuple_Size(value) != 2) {
        PyErr_SetString(PyExc_TypeError, "value should be a tuple (hsVector3, hsQuat)");
        return -1;
    }
    PyObject* s = PyTuple_GetItem(value, 0);
    PyObject* q = PyTuple_GetItem(value, 1);
    if (!pyVector3_Check(s) || !pyQuat_Check(q)) {
        PyErr_SetString(PyExc_TypeError, "value should be a tuple (hsVector3, hsQuat)");
        return -1;
    }
    self->fThis->fS = *((pyVector3*)s)->fThis;
    self->fThis->fQ = *((pyQuat*)q)->fThis;
    return 0;
}