[Bf-python] Emesh init problems

joeedh joeeagar at prodigy.net
Thu Oct 7 16:53:58 CEST 2004


Hi, for some reason when I try to add a PyObject to my EMesh module, 
Blender crashes on startup.  Heres the module init code (oh and by the 
way, part of it will be moved to another function, if you were wondering).

PyObject *EMesh_Init()
{
    PyObject *submodule;
    PyObject *vertlist;
    PyObject *a;
    EditMesh *em = G.editMesh;
     /*if (!em) return; decided to leave this out in favor of
       empty verts, edges faces lists*/
    EditVert *eve;
    int num_verts, i;
    num_verts = count_editverts();
 
    EMesh_EditVertType.ob_type = &PyType_Type;
   
    if (PyType_Ready(&EMesh_EditVertType) < 0);
        return;
       
    vertlist = PyList_New(num_verts);
    eve = em->verts.first;
    for (i = 0; i < num_verts; i++)
    {
        PyList_SET_ITEM(vertlist, i, make_editvert(eve));
        eve=eve->next;
    }   
    submodule = Py_InitModule3( "Blender.EMesh", M_EMesh_methods,
                M_EMesh_doc );
   
     a = Py_BuildValue("i", 1);
    PyModule_AddObject(submodule, "verts", a); //vertlist);
   
    g_emesh_module = submodule;
    g_emesh_verts = vertlist;
    Py_INCREF(submodule);
   
}   

joeedh



More information about the Bf-python mailing list