Example #1
0
static int pyVector3___init__(pyVector3* self, PyObject* args, PyObject* kwds) {
    float x = 0.0f, y = 0.0f, z = 0.0f;
    PyObject* init = NULL;
    static char* kwlist[] = { _pycs("X"), _pycs("Y"), _pycs("Z"), NULL };
    static char* kwlist2[] = { _pycs("vector"), NULL };

    if (PyArg_ParseTupleAndKeywords(args, kwds, "fff", kwlist, &x, &y, &z)) {
        (*self->fThis) = hsVector3(x, y, z);
    } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "|O", kwlist2, &init)) {
        if (init == NULL) {
            (*self->fThis) = hsVector3();
            return 0;
        }
        if (pyVector3_Check(init)) {
            (*self->fThis) = (*((pyVector3*)init)->fThis);
        } else {
            PyErr_SetString(PyExc_TypeError, "__init__ expects a vector");
            return -1;
        }
    } else {
        return -1;
    }

    return 0;
}
Example #2
0
static PyObject* pyGLTexture_get_level_data(pyGLTexture* self, PyObject* args, PyObject* kwargs) {
    static char* kwlist[] = { _pycs("level"), _pycs("calc_alpha"), _pycs("bgra"),
                              _pycs("quiet"), _pycs("fast"), NULL };
    GLint level = 0;
    bool calc_alpha = false;
    bool bgra = false;
    bool quiet = false;
    bool fast = false;
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ibbbb", kwlist, &level, &calc_alpha, &bgra, &quiet, &fast)) {
        PyErr_SetString(PyExc_TypeError, "get_level_data expects an optional int, bool, bool, bool, bool");
        return NULL;
    }

    _LevelData data = _get_level_data(self, level, bgra, quiet);
    if (fast)
        return pyBuffer_Steal(data.m_data, data.m_dataSize);

    // OpenGL returns a flipped image, so we must reflip it.
    size_t row_stride = data.m_width * 4;
    uint8_t* sptr = data.m_data;
    uint8_t* eptr = data.m_data + (data.m_dataSize - row_stride);
    uint8_t* temp = new uint8_t[row_stride];
    do {
        memcpy(temp, sptr, row_stride);
        memcpy(sptr, eptr, row_stride);
        memcpy(eptr, temp, row_stride);
    } while ((sptr += row_stride) < (eptr -= row_stride));
    delete[] temp;

    // Detail blend
    PyObjectRef is_detail_map = PyObject_GetAttrString(self->m_textureKey, "is_detail_map");
    if (PyLong_AsLong(is_detail_map) != 0) {
        if (_generate_detail_map(self, data.m_data, data.m_dataSize, level) != 0) {
            delete[] data.m_data;
            PyErr_SetString(PyExc_RuntimeError, "error while baking detail map");
            return NULL;
        }
    }

    if (calc_alpha) {
        for (size_t i = 0; i < data.m_dataSize; i += 4)
            data.m_data[i + 3] = (data.m_data[i + 0] + data.m_data[i + 1] + data.m_data[i + 2]) / 3;
    }

    return pyBuffer_Steal(data.m_data, data.m_dataSize);
}
Example #3
0
static int pyQuat___init__(pyQuat* self, PyObject* args, PyObject* kwds) {
    float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
    PyObject* init = NULL;
    static char* kwlist[] = { _pycs("X"), _pycs("Y"), _pycs("Z"), _pycs("W"), NULL };
    static char* kwlist2[] = { _pycs("quat"), NULL };
    static char* kwlist3[] = { _pycs("angle"), _pycs("axis"), NULL };

    if (PyArg_ParseTupleAndKeywords(args, kwds, "ffff", kwlist, &x, &y, &z, &w)) {
        (*self->fThis) = hsQuat(x, y, z, w);
    } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "fO", kwlist3, &w, &init)) {
        if (pyVector3_Check(init)) {
            (*self->fThis) = hsQuat(w, *((pyVector3*)init)->fThis);
            return 0;
        } else {
            PyErr_SetString(PyExc_TypeError, "__init__ expects a quaternion or an angle and axis");
            return -1;
        }
    } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "|O", kwlist2, &init)) {
        if (init == NULL) {
            (*self->fThis) = hsQuat();
            return 0;
        }
        if (pyQuat_Check(init)) {
            (*self->fThis) = (*((pyQuat*)init)->fThis);
        } else {
            PyErr_SetString(PyExc_TypeError, "__init__ expects a quaternion or an angle and axis");
            return -1;
        }
    } else {
        return -1;
    }

    return 0;
}
Example #4
0
static int pyStream___init__(pyStream* self, PyObject* args, PyObject* kwds) {
    static char* kwlist[] = { _pycs("ver"), NULL };

    int ver = PlasmaVer::pvUnknown;
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist, &ver))
        return -1;

    self->fThis->setVer((PlasmaVer)ver);
    return 0;
}
Example #5
0
static int pyMipmap___init__(pyMipmap* self, PyObject* args, PyObject* kwds) {
    const char* name = "";
    int width, height, numLevels, compType, format;
    int dxtLevel = plBitmap::kDXTError;
    static char* kwlist[] = { _pycs("name"), _pycs("width"), _pycs("height"),
                              _pycs("numLevels"), _pycs("compType"),
                              _pycs("format"), _pycs("dxtLevel"), NULL };

    if (PyArg_ParseTupleAndKeywords(args, kwds, "siiiii|i", kwlist,
                                    &name, &width, &height, &numLevels,
                                    &compType, &format, &dxtLevel)) {
        self->fThis->init(name);
        self->fThis->Create(width, height, numLevels, compType,
                            (plBitmap::ColorFormat)format, dxtLevel);
        return 0;
    } else if (PyErr_Clear(), PyArg_ParseTuple(args, "|s", &name)) {
        self->fThis->init(name);
        return 0;
    }

    PyErr_SetString(PyExc_TypeError, "__init__ expects an optional string, or a set of creation parameters");
    return -1;
}
}

static PyMethodDef pyInterfaceInfoModifier_Methods[] = {
    { "clearIntfKeys", (PyCFunction)pyInterfaceInfoModifier_clearKeys, METH_NOARGS,
      "Remove all interface keys" },
    { "addIntfKey", (PyCFunction)pyInterfaceInfoModifier_addKey, METH_VARARGS,
      "Params: key\n"
      "Add an interface key" },
    { "delIntfKey", (PyCFunction)pyInterfaceInfoModifier_delKey, METH_NOARGS,
      "Params: idx\n"
      "Remove an interface key" },
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyInterfaceInfoModifier_GetSet[] = {
    { _pycs("intfKeys"), (getter)pyInterfaceInfoModifier_getIntfKeys,
        (setter)pyInterfaceInfoModifier_setIntfKeys, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyInterfaceInfoModifier_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyPlasma.plInterfaceInfoModifier", /* tp_name */
    sizeof(pyInterfaceInfoModifier),    /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
        self->fThis->setKey(plKey());
        return 0;
    } else if (pyKey_Check(value)) {
        self->fThis->setKey(*((pyKey*)value)->fThis);
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "key should be a plKey");
        return -1;
    }
}
static PyMethodDef pyVariableEventData_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyVariableEventData_GetSet[] = {
    { _pycs("name"), (getter)pyVariableEventData_getName,
        (setter)pyVariableEventData_setName, NULL, NULL },
    { _pycs("dataType"), (getter)pyVariableEventData_getDataType,
        (setter)pyVariableEventData_setDataType, NULL, NULL },
    { _pycs("number"), (getter)pyVariableEventData_getNumber,
        (setter)pyVariableEventData_setNumber, NULL, NULL },
    { _pycs("key"), (getter)pyVariableEventData_getKey,
        (setter)pyVariableEventData_setKey, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyVariableEventData_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyPlasma.proVariableEventData",    /* tp_name */
    sizeof(pyVariableEventData),        /* tp_basicsize */
    0,                                  /* tp_itemsize */
static int pyLimitedDirLightInfo_setDepth(pyLimitedDirLightInfo* self, PyObject* value, void*) {
    if (value == NULL || !PyFloat_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "depth should be a float");
        return -1;
    }
    self->fThis->setDepth(PyFloat_AsDouble(value));
    return 0;
}

static PyMethodDef pyLimitedDirLightInfo_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyLimitedDirLightInfo_GetSet[] = {
    { _pycs("width"), (getter)pyLimitedDirLightInfo_getWidth,
        (setter)pyLimitedDirLightInfo_setWidth, NULL, NULL },
    { _pycs("height"), (getter)pyLimitedDirLightInfo_getHeight,
        (setter)pyLimitedDirLightInfo_setHeight, NULL, NULL },
    { _pycs("depth"), (getter)pyLimitedDirLightInfo_getDepth,
        (setter)pyLimitedDirLightInfo_setDepth, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyLimitedDirLightInfo_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyPlasma.plLimitedDirLightInfo",   /* tp_name */
    sizeof(pyLimitedDirLightInfo),      /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
Example #9
0
    }
    self->fThis->setVStartIdx(PyInt_AsLong(value));
    return 0;
}

static int pyVertexSpan_setVLength(pyVertexSpan* self, PyObject* value, void*) {
    if (value == NULL || !PyInt_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "VLength should be an int");
        return -1;
    }
    self->fThis->setVLength(PyInt_AsLong(value));
    return 0;
}

static PyGetSetDef pyVertexSpan_GetSet[] = {
    { _pycs("groupIdx"), (getter)pyVertexSpan_getGroupIdx,
        (setter)pyVertexSpan_setGroupIdx, _pycs("The Buffer Group index"), NULL },
    { _pycs("VBufferIdx"), (getter)pyVertexSpan_getVBufferIdx,
        (setter)pyVertexSpan_setVBufferIdx, _pycs("The Vertex Buffer index"), NULL },
    { _pycs("cellIdx"), (getter)pyVertexSpan_getCellIdx,
        (setter)pyVertexSpan_setCellIdx, _pycs("The Cell Buffer index"), NULL },
    { _pycs("cellOffset"), (getter)pyVertexSpan_getCellOffset,
        (setter)pyVertexSpan_setCellOffset, _pycs("The Cell offset"), NULL },
    { _pycs("VStartIdx"), (getter)pyVertexSpan_getVStartIdx,
        (setter)pyVertexSpan_setVStartIdx,
        _pycs("The first vertex in this Span"), NULL },
    { _pycs("VLength"), (getter)pyVertexSpan_getVLength,
        (setter)pyVertexSpan_setVLength,
        _pycs("The number of vertices in this Span"), NULL },
    { NULL, NULL, NULL, NULL, NULL }
};
        return 0;
    } else if (pyKey_Check(value)) {
        self->fThis->setPhysical(*((pyKey*)value)->fThis);
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "physical should be a plKey");
        return -1;
    }
}

PyMethodDef pySimulationInterface_Methods[] = {
    { NULL, NULL, 0, NULL }
};

PyGetSetDef pySimulationInterface_GetSet[] = {
    { _pycs("physical"), (getter)pySimulationInterface_getPhysical,
        (setter)pySimulationInterface_setPhysical, _pycs("The Physical key"), NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pySimulationInterface_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plSimulationInterface", /* tp_name */
    sizeof(pySimulationInterface),      /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
    }
    self->fThis->setCmd((unsigned char)PyInt_AsLong(value));
    return 0;
}

static int pyExcludeRegionMsg_setSynchFlags(pyExcludeRegionMsg* self, PyObject* value, void*) {
    if (value == NULL || !PyInt_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "synchFlags should be an int");
        return -1;
    }
    self->fThis->setSynchFlags(PyInt_AsLong(value));
    return 0;
}

static PyGetSetDef pyExcludeRegionMsg_GetSet[] = {
    { _pycs("cmd"), (getter)pyExcludeRegionMsg_getCmd, (setter)pyExcludeRegionMsg_setCmd, NULL, NULL },
    { _pycs("synchFlags"), (getter)pyExcludeRegionMsg_getSynchFlags, (setter)pyExcludeRegionMsg_setSynchFlags, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyExcludeRegionMsg_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plExcludeRegionMsg",    /* tp_name */
    sizeof(pyExcludeRegionMsg),         /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
Example #12
0
}

static PyMethodDef pyBounds_Methods[] = {
    { "ClassName", (PyCFunction)pyBounds_ClassName, METH_NOARGS,
      "Returns the RTTI Class name of this Bounds object" },
    { "read", (PyCFunction)pyBounds_read, METH_VARARGS,
      "Params: stream\n"
      "Read this Bounds object from the stream" },
    { "write", (PyCFunction)pyBounds_write, METH_VARARGS,
      "Params: stream\n"
      "Write this Bounds object to the stream" },
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyBounds_GetSet[] = {
    { _pycs("type"), (getter)pyBounds_getType, (setter)pyBounds_setType, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyBounds_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.hsBounds",              /* tp_name */
    sizeof(pyBounds),                   /* tp_basicsize */
    0,                                  /* tp_itemsize */

    (destructor)pyBounds_dealloc,       /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
    NULL,                               /* tp_repr */
Example #13
0
    }
    self->fThis->fChop = (float)PyFloat_AsDouble(value);
    return 0;
}

static int pyWaveState7_setAngleDev(pyWaveState7* self, PyObject* value, void*) {
    if (value == NULL || !PyFloat_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "angleDev should be a float");
        return -1;
    }
    self->fThis->fAngleDev = (float)PyFloat_AsDouble(value);
    return 0;
}

static PyGetSetDef pyWaveState7_GetSet[] = {
    { _pycs("maxLength"), (getter)pyWaveState7_getMaxLength, (setter)pyWaveState7_setMaxLength, NULL, NULL },
    { _pycs("minLength"), (getter)pyWaveState7_getMinLength, (setter)pyWaveState7_setMinLength, NULL, NULL },
    { _pycs("ampOverLen"), (getter)pyWaveState7_getAmpOverLen, (setter)pyWaveState7_setAmpOverLen, NULL, NULL },
    { _pycs("chop"), (getter)pyWaveState7_getChop, (setter)pyWaveState7_setChop, NULL, NULL },
    { _pycs("angleDev"), (getter)pyWaveState7_getAngleDev, (setter)pyWaveState7_setAngleDev, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyWaveState7_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plWaveState7",          /* tp_name */
    sizeof(pyWaveState7),               /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
Example #14
0
        return 0;
    } else if (pyKey_Check(value)) {
        self->fThis->setHittee(*((pyKey*)value)->fThis);
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "hittee should be a plKey");
        return -1;
    }
}

static PyMethodDef pyCollisionEventData_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyCollisionEventData_GetSet[] = {
    { _pycs("enter"), (getter)pyCollisionEventData_getEnter,
        (setter)pyCollisionEventData_setEnter, NULL, NULL },
    { _pycs("hitter"), (getter)pyCollisionEventData_getHitter,
        (setter)pyCollisionEventData_setHitter, NULL, NULL },
    { _pycs("hittee"), (getter)pyCollisionEventData_getHittee,
        (setter)pyCollisionEventData_setHittee, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyCollisionEventData_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.proCollisionEventData", /* tp_name */
    sizeof(pyCollisionEventData),       /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
Example #15
0
static PyObject* pyMatrix33Key_getValue(pyMatrix33Key* self, void*) {
    return pyMatrix33_FromMatrix33(self->fThis->fValue);
}

static int pyMatrix33Key_setValue(pyMatrix33Key* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix33_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "value should be an hsMatrix33");
        return -1;
    }
    self->fThis->fValue = *((pyMatrix33*)value)->fThis;
    return 0;
}

static PyGetSetDef pyMatrix33Key_GetSet[] = {
    { _pycs("value"), (getter)pyMatrix33Key_getValue,
        (setter)pyMatrix33Key_setValue, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyMatrix33Key_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.hsMatrix33Key",         /* tp_name */
    sizeof(pyMatrix33Key),              /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
}

PyMethodDef pyCoordinateInterface_Methods[] = {
    { "clearChildren", (PyCFunction)pyCoordinateInterface_clearChildren, METH_NOARGS,
      "Removes all children from the Coordinate Interface" },
    { "addChild", (PyCFunction)pyCoordinateInterface_addChild, METH_VARARGS,
      "Params: key\n"
      "Adds a child object to this Coordinate Interface" },
    { "delChild", (PyCFunction)pyCoordinateInterface_delChild, METH_VARARGS,
      "Params: idx\n"
      "Removes a child object from this Coordinate Interface" },
    { NULL, NULL, 0, NULL }
};

PyGetSetDef pyCoordinateInterface_GetSet[] = {
    { _pycs("localToWorld"), (getter)pyCoordinateInterface_getL2W,
        (setter)pyCoordinateInterface_setL2W,
        _pycs("Local -> World transform matrix"), NULL },
    { _pycs("worldToLocal"), (getter)pyCoordinateInterface_getW2L,
        (setter)pyCoordinateInterface_setW2L,
        _pycs("World -> Local transform matrix"), NULL },
    { _pycs("localToParent"), (getter)pyCoordinateInterface_getL2P,
        (setter)pyCoordinateInterface_setL2P,
        _pycs("Local -> Parent transform matrix"), NULL },
    { _pycs("parentToLocal"), (getter)pyCoordinateInterface_getP2L,
        (setter)pyCoordinateInterface_setP2L,
        _pycs("Parent -> Local transform matrix"), NULL },
    { _pycs("children"), (getter)pyCoordinateInterface_getChildren,
        (setter)pyCoordinateInterface_setChildren,
        _pycs("Child Objects"), NULL },
    { NULL, NULL, NULL, NULL, NULL }
Example #17
0
    Py_INCREF(Py_None);
    return Py_None;
}

PyMethodDef pyClothingItem_Methods[] = {
    { "getMesh", (PyCFunction)pyClothingItem_getMesh, METH_VARARGS,
      "Params: lod\n"
      "Gets the Key of the mesh for the specified LOD" },
    { "setMesh", (PyCFunction)pyClothingItem_setMesh, METH_VARARGS,
      "Params: lod, mesh\n"
      "Sets the Key of the mesh for the specified LOD" },
    { NULL, NULL, 0, NULL }
};

PyGetSetDef pyClothingItem_GetSet[] = {
    { _pycs("description"), (getter)pyClothingItem_getDescription,
        (setter)pyClothingItem_setDescription, NULL, NULL },
    { _pycs("itemName"), (getter)pyClothingItem_getItemName,
        (setter)pyClothingItem_setItemName, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyClothingItem_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plClothingItem",        /* tp_name */
    sizeof(pyClothingItem),             /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
Example #18
0
static int pySpawnedEventData_setSpawnee(pySpawnedEventData* self, PyObject* value, void*) {
    if (value == NULL || value == Py_None) {
        self->fThis->setSpawnee(plKey());
        return 0;
    } else if (pyKey_Check(value)) {
        self->fThis->setSpawnee(*((pyKey*)value)->fThis);
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "spawnee should be a plKey");
        return -1;
    }
}

static PyGetSetDef pySpawnedEventData_GetSet[] = {
    { _pycs("spawner"), (getter)pySpawnedEventData_getSpawner,
        (setter)pySpawnedEventData_setSpawner, NULL, NULL },
    { _pycs("spawnee"), (getter)pySpawnedEventData_getSpawnee,
        (setter)pySpawnedEventData_setSpawnee, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pySpawnedEventData_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.proSpawnedEventData",   /* tp_name */
    sizeof(pySpawnedEventData),         /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
Example #19
0
static int pyAGApplicator_setChannelName(pyAGApplicator* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "channelName should be a string");
        return -1;
    }
    IConvertApplicator(self)->setChannelName(PyStr_To_PlStr(value));
    return 0;
}

static PyMethodDef pyAGApplicator_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyAGApplicator_GetSet[] = {
    { _pycs("channel"), (getter)pyAGApplicator_getChannel,
        (setter)pyAGApplicator_setChannel, NULL, NULL },
    { _pycs("enabled"), (getter)pyAGApplicator_getEnabled,
        (setter)pyAGApplicator_setEnabled, NULL, NULL },
    { _pycs("channelName"), (getter)pyAGApplicator_getChannelName,
        (setter)pyAGApplicator_setChannelName, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyAGApplicator_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plAGApplicator",        /* tp_name */
    sizeof(pyAGApplicator),             /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
Example #20
0
        {   "clearApplicators", (PyCFunction)pyAGAnim_clearApps, METH_NOARGS,
            "Remove all plAGApplicators from the anim"
        },
        {   "addApplicator", (PyCFunction)pyAGAnim_addApplicator, METH_VARARGS,
            "Params: applicator\n"
            "Add a plAGApplicator to the anim"
        },
        {   "delApplicator", (PyCFunction)pyAGAnim_delApplicator, METH_VARARGS,
            "Params: idx\n"
            "Delete a plAGApplicator from the anim"
        },
        { NULL, NULL, 0, NULL }
    };

    static PyGetSetDef pyAGAnim_GetSet[] = {
        { _pycs("blend"), (getter)pyAGAnim_getBlend, (setter)pyAGAnim_setBlend, NULL, NULL },
        { _pycs("start"), (getter)pyAGAnim_getStart, (setter)pyAGAnim_setStart, NULL, NULL },
        { _pycs("end"), (getter)pyAGAnim_getEnd, (setter)pyAGAnim_setEnd, NULL, NULL },
        { _pycs("name"), (getter)pyAGAnim_getName, (setter)pyAGAnim_setName, NULL, NULL },
        { _pycs("applicators"), (getter)pyAGAnim_getApps, (setter)pyAGAnim_setApps, NULL, NULL },
        { NULL, NULL, NULL, NULL, NULL }
    };

    PyTypeObject pyAGAnim_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        "PyHSPlasma.plAGAnim",              /* tp_name */
        sizeof(pyAGAnim),                   /* tp_basicsize */
        0,                                  /* tp_itemsize */

        NULL,                               /* tp_dealloc */
        NULL,                               /* tp_print */
Example #21
0
static int pyLayerLinkAnimation_setLeavingAge(pyLayerLinkAnimation* self, PyObject* value, void*) {
    if (value == NULL || !PyInt_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "leavingAge should be a bool");
        return -1;
    }
    self->fThis->setLeavingAge(PyInt_AsLong(value) == 0 ? false : true);
    return 0;
}

static PyMethodDef pyLayerLinkAnimation_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyLayerLinkAnimation_GetSet[] = {
    { _pycs("linkKey"), (getter)pyLayerLinkAnimation_getLinkKey,
        (setter)pyLayerLinkAnimation_setLinkKey, NULL, NULL },
    { _pycs("leavingAge"), (getter)pyLayerLinkAnimation_getLeavingAge,
        (setter)pyLayerLinkAnimation_setLeavingAge, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyLayerLinkAnimation_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plLayerLinkAnimation",  /* tp_name */
    sizeof(pyLayerLinkAnimation),       /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
Example #22
0
      "Params: key\n"
      "Add an Interface to the Scene Object" },
    { "addModifier", (PyCFunction)pySceneObject_addModifier, METH_VARARGS,
      "Params: key\n"
      "Add a Modifier to the Scene Object" },
    { "delInterface", (PyCFunction)pySceneObject_delInterface, METH_VARARGS,
      "Params: idx\n"
      "Removes an interface from the Scene Object" },
    { "delModifier", (PyCFunction)pySceneObject_delModifier, METH_VARARGS,
      "Params: idx\n"
      "Removes a modifier from the Scene Object" },
    { NULL, NULL, 0, NULL }
};

PyGetSetDef pySceneObject_GetSet[] = {
    { _pycs("draw"), (getter)pySceneObject_getDraw, (setter)pySceneObject_setDraw,
        _pycs("DrawInterface"), NULL },
    { _pycs("sim"), (getter)pySceneObject_getSim, (setter)pySceneObject_setSim,
        _pycs("SimulationInterface"), NULL },
    { _pycs("coord"), (getter)pySceneObject_getCoord, (setter)pySceneObject_setCoord,
        _pycs("CoordinateInterface"), NULL },
    { _pycs("audio"), (getter)pySceneObject_getAudio, (setter)pySceneObject_setAudio,
        _pycs("AudioInterface"), NULL },
    { _pycs("sceneNode"), (getter)pySceneObject_getNode, (setter)pySceneObject_setNode,
        _pycs("The SceneNode this object belongs to"), NULL },
    { _pycs("interfaces"), (getter)pySceneObject_getIntfs, (setter)pySceneObject_setIntfs,
        _pycs("Extra SceneObject Interfaces"), NULL },
    { _pycs("modifiers"), (getter)pySceneObject_getMods, (setter)pySceneObject_setMods,
        _pycs("SceneObject Modifiers"), NULL },
    { NULL, NULL, NULL, NULL, NULL }
};
    }
    if (!pyController_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "controller should be a plController");
        return -1;
    }
    self->fThis->setController(((pyController*)value)->fThis);
    ((pyController*)value)->fPyOwned = false;
    return 0;
}

static PyMethodDef pyMatrixControllerChannel_Methods[] = {
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyMatrixControllerChannel_GetSet[] = {
    { _pycs("controller"), (getter)pyMatrixControllerChannel_getController,
        (setter)pyMatrixControllerChannel_setController, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyMatrixControllerChannel_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plMatrixControllerChannel", /* tp_name */
    sizeof(pyMatrixControllerChannel),  /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
        }
        if (!pyController_Check(value)) {
            PyErr_SetString(PyExc_TypeError, "transformCtl should be a plController");
            return -1;
        }
        self->fThis->setTransformCtl(((pyController*)value)->fThis);
        ((pyController*)value)->fPyOwned = false;
        return 0;
    }

    static PyMethodDef pyLayerAnimationBase_Methods[] = {
        { NULL, NULL, 0, NULL }
    };

    static PyGetSetDef pyLayerAnimationBase_GetSet[] = {
        {   _pycs("preshadeCtl"), (getter)pyLayerAnimationBase_getPreshade,
            (setter)pyLayerAnimationBase_setPreshade, NULL, NULL
        },
        {   _pycs("runtimeCtl"), (getter)pyLayerAnimationBase_getRuntime,
            (setter)pyLayerAnimationBase_setRuntime, NULL, NULL
        },
        {   _pycs("ambientCtl"), (getter)pyLayerAnimationBase_getAmbient,
            (setter)pyLayerAnimationBase_setAmbient, NULL, NULL
        },
        {   _pycs("specularCtl"), (getter)pyLayerAnimationBase_getSpecular,
            (setter)pyLayerAnimationBase_setSpecular, NULL, NULL
        },
        {   _pycs("opacityCtl"), (getter)pyLayerAnimationBase_getOpacity,
            (setter)pyLayerAnimationBase_setOpacity, NULL, NULL
        },
        {   _pycs("transformCtl"), (getter)pyLayerAnimationBase_getTransform,
    PyErr_SetString(PyExc_RuntimeError, "type is read-only");
    return -1;
}

static PyMethodDef pyGUICtrlProcWriteableObject_Methods[] = {
    { "Read", (PyCFunction)pyGUICtrlProcWriteableObject_Read, METH_VARARGS | METH_STATIC,
      "Params: stream\n"
      "Read a writable GUI Proc object from `stream`" },
    { "Write", (PyCFunction)pyGUICtrlProcWriteableObject_Write, METH_VARARGS | METH_STATIC,
      "Params: stream, proc\n"
      "Write a writable GUI Proc object to `stream`" },
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyGUICtrlProcWriteableObject_GetSet[] = {
    { _pycs("type"), (getter)pyGUICtrlProcWriteableObject_getType,
        (setter)pyGUICtrlProcWriteableObject_setType, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyGUICtrlProcWriteableObject_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyPlasma.pfGUICtrlProcWriteableObject", /* tp_name */
    sizeof(pyGUICtrlProcWriteableObject), /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
Example #26
0
      "Params: key\n"
      "Add a command" },
    { "delCommand", (PyCFunction)pyLogicModBase_delCommand, METH_NOARGS,
      "Params: idx\n"
      "Remove a command" },
    { "getLogicFlag", (PyCFunction)pyLogicModBase_getFlag, METH_VARARGS,
      "Params: flag\n"
      "Returns True if the LogicMod flag is set" },
    { "setLogicFlag", (PyCFunction)pyLogicModBase_setFlag, METH_VARARGS,
      "Params: flag, value\n"
      "Sets the specified LogicMod flag" },
    { NULL, NULL, 0, NULL }
};

static PyGetSetDef pyLogicModBase_GetSet[] = {
    { _pycs("commands"), (getter)pyLogicModBase_getCommands,
        (setter)pyLogicModBase_setCommands, NULL, NULL },
    { _pycs("notify"), (getter)pyLogicModBase_getNotify,
        (setter)pyLogicModBase_setNotify, NULL, NULL },
    { _pycs("disabled"), (getter)pyLogicModBase_getDisabled,
        (setter)pyLogicModBase_setDisabled, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyLogicModBase_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyPlasma.plLogicModBase",          /* tp_name */
    sizeof(pyLogicModBase),             /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
Example #27
0
    }
    self->fThis->setMaxs(*((pyVector3*)value)->fThis);
    return 0;
}

static int pyBounds3_setCenter(pyBounds3* 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;
}

static PyGetSetDef pyBounds3_GetSet[] = {
    { _pycs("mins"), (getter)pyBounds3_getMins, (setter)pyBounds3_setMins, NULL, NULL },
    { _pycs("maxs"), (getter)pyBounds3_getMaxs, (setter)pyBounds3_setMaxs, NULL, NULL },
    { _pycs("center"), (getter)pyBounds3_getCenter, (setter)pyBounds3_setCenter, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyBounds3_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.hsBounds3",             /* tp_name */
    sizeof(pyBounds3),                  /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
Example #28
0
static PyObject* pyKeyPressConditionalObject_getKeyEvent(pyKeyPressConditionalObject* self, void*) {
    return PyInt_FromLong(self->fThis->getKeyEvent());
}

static int pyKeyPressConditionalObject_setKeyEvent(pyKeyPressConditionalObject* self, PyObject* value, void*) {
    if (value == NULL || !PyInt_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "keyEvent should be an int");
        return -1;
    }
    self->fThis->setKeyEvent((plKeyDef)PyInt_AsLong(value));
    return 0;
}

static PyGetSetDef pyKeyPressConditionalObject_GetSet[] = {
    { _pycs("keyEvent"), (getter)pyKeyPressConditionalObject_getKeyEvent,
       (setter)pyKeyPressConditionalObject_setKeyEvent, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyKeyPressConditionalObject_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plKeyPressConditionalObject", /* tp_name */
    sizeof(pyKeyPressConditionalObject),      /* tp_basicsize */
    0,                                      /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
Example #29
0
    { NULL, NULL, 0, NULL }
};

static PyObject* pyOneShotMsg_getCallbacks(pyOneShotMsg* self, void*) {
    const plOneShotCallbacks& cbs = self->fThis->getCallbacks();
    PyObject* tup = PyTuple_New(cbs.getNumCallbacks());
    for (size_t i = 0; i < cbs.getNumCallbacks(); ++i) {
        const auto& cb = cbs.getCallbacks()[i];
        PyObject* value = Py_BuildValue("OOh", PlStr_To_PyStr(cb.fMarker), pyKey_FromKey(cb.fReceiver), cb.fUser);
        PyTuple_SET_ITEM(tup, i, value);
    }
    return tup;
}

static PyGetSetDef pyOneShotMsg_GetSet[] = {
    { _pycs("callbacks"), (getter)pyOneShotMsg_getCallbacks, NULL, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyOneShotMsg_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plOneShotMsg",          /* tp_name */
    sizeof(pyOneShotMsg),               /* tp_basicsize */
    0,                                  /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */
    NULL,                               /* tp_repr */
Example #30
0
};

static PyObject* pyANDConditionalObject_getANDs(pyANDConditionalObject* self, void*) {
    PyObject* children = PyTuple_New(self->fThis->getChildren().size());
    for (size_t i = 0; i < self->fThis->getChildren().size(); ++i)
        PyTuple_SET_ITEM(children, i, pyKey_FromKey(self->fThis->getChildren()[i]));
    return children;
}

static int pyANDConditionalObject_setANDs(pyANDConditionalObject* self, PyObject*, void*) {
    PyErr_SetString(PyExc_RuntimeError, "To add children, use addChild()");
    return -1;
}

static PyGetSetDef pyANDConditionalObject_GetSet[] = {
    { _pycs("children"), (getter)pyANDConditionalObject_getANDs,
       (setter)pyANDConditionalObject_setANDs, NULL, NULL },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject pyANDConditionalObject_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "PyHSPlasma.plANDConditionalObject", /* tp_name */
    sizeof(pyANDConditionalObject),      /* tp_basicsize */
    0,                                   /* tp_itemsize */

    NULL,                               /* tp_dealloc */
    NULL,                               /* tp_print */
    NULL,                               /* tp_getattr */
    NULL,                               /* tp_setattr */
    NULL,                               /* tp_compare */