static int pyGBufferTriangle_setCenter(pyGBufferTriangle* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "center should be an hsVector3");
        return -1;
    }
    self->fThis->fCenter = *((pyVector3*)value)->fThis;
    return 0;
}
Beispiel #2
0
static int pyPickedEventData_setHitPoint(pyPickedEventData* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "hitPoint should be an hsVector3");
        return -1;
    }
    self->fThis->setHitPoint(*((pyVector3*)value)->fThis);
    return 0;
}
Beispiel #3
0
static int pyCullPoly_setCenter(pyCullPoly* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "center should be an hsVector3");
        return -1;
    }
    self->fThis->setCenter(*((pyVector3*)value)->fThis);
    return 0;
}
Beispiel #4
0
static int pyAffineParts_setK(pyAffineParts* self, PyObject* value, void*) {
    if (!pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "K should be an hsVector3");
        return -1;
    }
    self->fThis->fK = *((pyVector3*)value)->fThis;
    return 0;
}
Beispiel #5
0
static int pyScaleKey_setOutTan(pyScaleKey* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "outTan should be an hsVector3");
        return -1;
    }
    self->fThis->fOutTan = *((pyVector3*)value)->fThis;
    return 0;
}
Beispiel #6
0
static int pyTempVertex_setPosition(pyTempVertex* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "position must be an hsVector3");
        return -1;
    }
    self->fThis->fPosition = *((pyVector3*)value)->fThis;
    return 0;
}
Beispiel #7
0
static int pyViewFaceModifier_setOffset(pyViewFaceModifier* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "offset should be an hsVector3");
        return -1;
    }
    self->fThis->setOffset(*((pyVector3*)value)->fThis);
    return 0;
}
static int pyDynamicEnvMap_setPosition(pyDynamicEnvMap* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "position should be a plVector3");
        return -1;
    }
    self->fThis->setPosition(*reinterpret_cast<pyVector3 *>(value)->fThis);
    return 0;
}
static int pySpanTemplateVertex_setNormal(pySpanTemplateVertex* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "normalll should be an hsVector3");
        return -1;
    }
    self->fThis->fNormal = *((pyVector3*)value)->fThis;
    return 0;
}
Beispiel #10
0
static int pyGenericPhysical_setDims(pyGenericPhysical* self, PyObject* value, void*) {
    if (value == NULL || !pyVector3_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "dimensions should be an hsVector3");
        return -1;
    }
    self->fThis->setDimensions(*((pyVector3*)value)->fThis);
    return 0;
}
Beispiel #11
0
static PyObject* pyVector3_dotP(pyVector3* self, PyObject* args) {
    pyVector3* vec;
    if (!PyArg_ParseTuple(args, "O", &vec)) {
        PyErr_SetString(PyExc_TypeError, "dotP expects an hsVector3");
        return NULL;
    }
    if (!pyVector3_Check((PyObject*)vec)) {
        PyErr_SetString(PyExc_TypeError, "dotP expects an hsVector3");
        return NULL;
    }
    return PyFloat_FromDouble(self->fThis->dotP(*vec->fThis));
}
Beispiel #12
0
static PyObject* pyVector3_crossP(pyVector3* self, PyObject* args) {
    pyVector3* vec;
    if (!PyArg_ParseTuple(args, "O", &vec)) {
        PyErr_SetString(PyExc_TypeError, "crossP expects an hsVector3");
        return NULL;
    }
    if (!pyVector3_Check((PyObject*)vec)) {
        PyErr_SetString(PyExc_TypeError, "crossP expects an hsVector3");
        return NULL;
    }
    return pyVector3_FromVector3(self->fThis->crossP(*vec->fThis));
}
Beispiel #13
0
static PyObject* pyMatrix44_ScaleMat(PyObject*, PyObject* args) {
    pyVector3* vec;
    if (!PyArg_ParseTuple(args, "O", &vec)) {
        PyErr_SetString(PyExc_TypeError, "ScaleMat expects an hsVector3");
        return NULL;
    }
    if (!pyVector3_Check((PyObject*)vec)) {
        PyErr_SetString(PyExc_TypeError, "ScaleMat expects an hsVector3");
        return NULL;
    }
    return pyMatrix44_FromMatrix44(hsMatrix44::ScaleMat(*vec->fThis));
}
Beispiel #14
0
static PyObject* pyMatrix44_multVector(pyMatrix44* self, PyObject* args) {
    pyVector3* vec;
    if (!PyArg_ParseTuple(args, "O", &vec)) {
        PyErr_SetString(PyExc_TypeError, "multVector expects an hsVector3");
        return NULL;
    }
    if (!pyVector3_Check((PyObject*)vec)) {
        PyErr_SetString(PyExc_TypeError, "multVector expects an hsVector3");
        return NULL;
    }
    hsVector3 result = self->fThis->multVector(*vec->fThis);
    return pyVector3_FromVector3(result);
}
Beispiel #15
0
static PyObject* pyMatrix44_setScale(pyMatrix44* self, PyObject* args) {
    pyVector3* vec;
    if (!PyArg_ParseTuple(args, "O", &vec)) {
        PyErr_SetString(PyExc_TypeError, "setScale expects an hsVector3");
        return NULL;
    }
    if (!pyVector3_Check((PyObject*)vec)) {
        PyErr_SetString(PyExc_TypeError, "setScale expects an hsVector3");
        return NULL;
    }
    self->fThis->setScale(*vec->fThis);
    Py_INCREF(Py_None);
    return Py_None;
}
Beispiel #16
0
static PyObject* pyVector3_multiply(PyObject* left, PyObject* right) {
    if (pyVector3_Check(left)) {
        if (pyVector3_Check(right)) {
            PyErr_SetString(PyExc_TypeError, "Vector Multiplication should use dotP and crossP");
            return NULL;
        } else if (PyFloat_Check(right)) {
            return pyVector3_FromVector3(*((pyVector3*)left)->fThis * PyFloat_AsDouble(right));
        } else {
            PyErr_SetString(PyExc_TypeError, "Incompatible Types");
            return NULL;
        }
    } else if (pyVector3_Check(right)) {
        if (PyFloat_Check(left)) {
            return pyVector3_FromVector3(*((pyVector3*)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;
    }
}
Beispiel #17
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;
}
Beispiel #18
0
static int pyTempVertex_setUVs(pyTempVertex* self, PyObject* value, void*) {
    if (value == NULL || !PySequence_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "uvs must be a sequence of hsVector3");
        return -1;
    }
    size_t size = (PySequence_Size(value) > 8) ? 8 : PySequence_Size(value);
    for (size_t i = 0; i < size; ++i) {
        if (!pyVector3_Check(PySequence_Fast_GET_ITEM(value, i))) {
            PyErr_SetString(PyExc_TypeError, "uvs must be a sequence of hsVector3");
            return -1;
        }
    }

    for (size_t i = 0; i < size; ++i)
        self->fThis->fUVs[i] = *((pyVector3*)PySequence_Fast_GET_ITEM(value, i))->fThis;
    return 0;
}
PY_GETSET_SETTER_DECL(OneTimeParticleGenerator, direction) {
    PY_PROPERTY_CHECK_NULL(direction);
    pySequenceFastRef seq(value);
    if (!seq.isSequence()) {
        PyErr_SetString(PyExc_TypeError, "direction should be a sequence of hsVector3 objects");
        return -1;
    }
    std::vector<hsVector3> dir(seq.size());
    for (size_t i = 0; i < dir.size(); ++i) {
        PyObject* vec = seq.get(i);
        if (!pyVector3_Check(vec)) {
            PyErr_SetString(PyExc_TypeError, "direction should be a sequence of hsVector3 objects");
            return -1;
        }
        dir[i] = *((pyVector3*)vec)->fThis;
    }
    self->fThis->setDirection(dir);
    return 0;
}
Beispiel #20
0
static int pyCullPoly_setVerts(pyCullPoly* self, PyObject* value, void*) {
    if (value == NULL) {
        self->fThis->setVerts(std::vector<hsVector3>());
        return 0;
    }
    if (!PyList_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "verts should be a list of hsVector3s");
        return -1;
    }
    std::vector<hsVector3> verts(PyList_Size(value));
    for (size_t i=0; i<verts.size(); i++) {
        PyObject* item = PyList_GetItem(value, i);
        if (!pyVector3_Check(item)) {
            PyErr_SetString(PyExc_TypeError, "verts should be a list of hsVector3s");
            return -1;
        }
        verts[i] = *((pyVector3*)item)->fThis;
    }
    self->fThis->setVerts(verts);
    return 0;
}
Beispiel #21
0
static int pySpanInstance_setPosDeltas(pySpanInstance* self, PyObject* value, void*) {
    std::vector<hsVector3> deltas;
    if (value == NULL) {
        self->fThis->setPosDeltas(deltas);
        return 0;
    }
    if (!PyList_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "posDeltas should be a list of hsVector3 objects");
        return -1;
    }
    deltas.resize(PyList_Size(value));
    for (size_t i=0; i<deltas.size(); i++) {
        PyObject* itm = PyList_GetItem(value, i);
        if (!pyVector3_Check(itm)) {
            PyErr_SetString(PyExc_TypeError, "posDeltas should be a list of hsVector3 objects");
            return -1;
        }
        deltas[i] = *((pyVector3*)itm)->fThis;
    }
    self->fThis->setPosDeltas(deltas);
    return 0;
}