[Bf-python] Vertex Influence for no-armatured objs

models at paposo.com models at paposo.com
Mon Sep 15 02:17:30 CEST 2003


I wrote this to test the pointers:

 if(!((void*)((Mesh*)object->data) == (void*)(((BPy_NMesh*)self)->mesh)))
  return EXPP_ReturnPyObjError (PyExc_TypeError,
                 "object is not linked to this mesh!");

where object is a BPy_Object passed in as a parameter.
This code works but there are some problems:

1) Using PutRaw() is not going to work with this.  You need the name of a
BPy_Object object to match pointers with you BPy_NMesh.  PutRaw() never
returns a python object and just gives some default name to the object it
creates. This name you don't know until after PutRaw() returns. The user
needs to know the name of the object to assign vertex groups to. It would be
better to let the user have control over naming the object to be created and
then use that name to assign vertex groups.
2) GetRawFromObject() doesn't work because the NMesh->mesh pointer is set to
0 for reasons we've already talked about
3) Object.link() will not work (even if we got it to function like it
should) because it calls NMesh_FromPyObject() which calls Mesh_fromNMesh()
which returns a new mesh for linking to the object.  This is not the same
mesh as the NMesh->mesh pointer.  So calling:
mesh = Blender.NMesh.New()
object.link(mesh)
mesh.addVertGroup(object, 'myGroup')
will not work because the mesh->mesh pointer and the object->data pointer
now refer to different meshes, for the reason that object.link() created a
new mesh from the python one for linking.

My point is that testing the pointers doesn't work well with the current way
things are set up. Any ideas?




More information about the Bf-python mailing list