[Bf-python] vertex groups

models at paposo.com models at paposo.com
Fri Sep 5 17:19:50 CEST 2003


> Gee, we forgot to warn you ... that's the ancient Blender dev curse.

I just knew i was cursed!

My choice is D:
> - assignVertIndicesToGroup

Hey i was wondering if you could use a modification of
M_NMesh_GetRawFromObject() to return the mesh from a named object and then
do the vertex operations....

something like this:
Mesh *getMeshFromObject(char* name)
{
  Object *ob;
  Mesh *me;

  ob = (Object*)GetIdFromList(&(G.main->object), name);

  if (!ob)
    return EXPP_ReturnPyObjError (PyExc_AttributeError, name);
  else if (ob->type != OB_MESH)
    return EXPP_ReturnPyObjError (PyExc_AttributeError,
                    "Object does not have Mesh data");

    me = (Mesh*)ob->data;

 return me;
}
    then,  for the vertex operations you would need to call this as a helper
function. It would require passing the named obeject as the first parameter
though.
    I guess my problem with this is that it's kinda confusing. You would be
writing
mesh.assignVertIndecesToGroup('Object', vertlist, 'Group', weight,
'Assignmode')
    The problem here is that the mesh must be linked to an object and this
function could not be called until the entire mVert structure is finished
and updated in the mesh (the real mesh not a nmesh), which would make this
usage a bit awkward.
    I think it's better to have it in object, because you wouldn't link the
mesh data to the object until your finished with the mesh and the mVerts are
constructed.  There are also no added calls to find the object because you
would be calling from the object.
    The last and possibly most complex way of doing it might be to
dynamically size the dvert structure in an Nmesh (youd have to add it to the
python mesh) to the current size of the verts in Nmesh and then set the
dVerts to the real mesh when you convert a Nmesh to mesh.  This might be a
big bite to chew though.

P.s. can someone explain what a DispList is to me?




More information about the Bf-python mailing list