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

models at paposo.com models at paposo.com
Wed Sep 17 03:47:18 CEST 2003


I had to use my brain here :o

getData() is good for this but GetRaw() might not be because you are
searching for a mesh datablock by name with GetRaw() and there is no object
reference per se. Mesh datablock may have links to multiple objects. Here
you could set object = NULL in GetRaw().
Also GetRawFromObject() would be good with an object pointer.
New() would just be a pointer to NULL - no prob.
PutRaw() could just save the object it creates in a pointer - no prob.
Update() just updates the NMesh's mesh data (and materials) but wouldn't
affect an object pointers. So it would have no effect on the object pointer.

So you would use the mesh from getData() or the mesh from PutRaw(), really.
The NMesh would have a pointer to Object and you would simply use
(Mesh*)NMesh->Object->data for all the mesh calls and
NMesh->Object for all the object calls.
If there has been no association between this NMesh and an object , then
NMesh->Object == NULL and would flag a python script error.
You could get around the NMesh->mesh = 0 problem in GetRawFromObject() like
this by using NMesh->Object->data to set the vertex groups.

Examples:

1) (optional)  object = Blender.Object.New('Mesh', 'myObject')
2) mesh = Blender.NMesh.New()
3) add verts, etc. to mesh

    now either:
4) object.link(mesh) (this will work if you get rid of the default mesh data
creation in Object.link())
5) meshdata = object.getData()
6) meshdata.addVertGroup('myGroup')
    or
4) mesh.PutRaw()
5) mesh.addVertGroup('myGroup')

alternatively you could do:
1) mesh = GetRawFromObject('myObject')
2) mesh.addVertGroup('myGroup')

NMesh->object would be NULL until PutRaw(), getData() or GetRawFromObject()
was called.
So I think it's a good idea, but would require a little work to put
together.






More information about the Bf-python mailing list