Ejemplo n.º 1
0
PyObject* grpThingGenerate(PyObject* poSelf, PyObject* poArgs)
{
    char * szFileName;
    if (!PyTuple_GetString(poArgs, 0, &szFileName))
        return Py_BuildException();

    if (strlen(szFileName) <= 0)
        return Py_BuildValue("i", 0);

    CResource* pResource = CResourceManager::Instance().GetResourcePointer(szFileName);

    if (!pResource->IsType(CGraphicThing::Type()))
        return Py_BuildException();

    CGraphicThingInstance * pThingInstance = CGraphicThingInstance::New();
    pThingInstance->ReserveModelThing(1);
    pThingInstance->ReserveModelInstance(1);
    pThingInstance->RegisterModelThing(0, static_cast<CGraphicThing*>(pResource));
    pThingInstance->SetModelInstance(0, 0, 0);
    return Py_BuildValue("i", pThingInstance);
}
Ejemplo n.º 2
0
PyObject* grpThingSetFileName(PyObject* poSelf, PyObject* poArgs)
{
    CGraphicThingInstance * pThingInstance;
    if (!PyTuple_GetThingInstance(poArgs, 0, &pThingInstance))
        return Py_BuildException();

    char* szFileName;
    if (!PyTuple_GetString(poArgs, 1, &szFileName))
        return Py_BuildException();

    CResource* pResource = CResourceManager::Instance().GetResourcePointer(szFileName);

    if (!pResource->IsType(CGraphicThing::Type()))
        return Py_BuildException();

    pThingInstance->Clear();
    pThingInstance->ReserveModelThing(1);
    pThingInstance->ReserveModelInstance(1);
    pThingInstance->RegisterModelThing(0, static_cast<CGraphicThing*>(pResource));
    pThingInstance->SetModelInstance(0, 0, 0);
    return Py_BuildNone();
}