[Bf-python] vertex groups

models at paposo.com models at paposo.com
Wed Sep 3 15:49:10 CEST 2003


Hello it's me joseph again.

I have come down with some sort of plague today. (Cough.. cough...) Anway, I made the the needed changes to the vertex group stuff in object.c.  It now has the following:

@selectVertexGroup(name) - selects vertex group based on 'name'
@deselectVertexGroup(name) - deselects group
@addVertexGroup(name) - adds a new group to object by name
@removeVertexGroup(name) - removes a group by name
@assignVertexToGroup(vertexList, group, weight, assignmode) - takes a python list of vertex point indeces, groupname, weight, assignmode. This function should not be called though until all mverts are in the mesh because it creates a new array of size(mverts) if no dverts are detected.
@removeVertexFromGroup(group, vertexList) - takes a group and a python list of vertex points (optional), the group name alone will remove all
@returnVertexFromGroup(group, vertexList) - takes a group and a python list of vertex points (optional), the group name alone will return all. Data is returned as a python list corresponding to [(x,y,z,index),(x,y,z,index),etc..]. If the vertexList contains indeces not part of the group passed no data is returned in the list for it, which could be used as a test for whether a vertex is in a group.

Try it, you'll like it :)

Attached is the object files, and a script to do selections on a UVSphere.  (before this was pretty slow - but i fixed that).  Also I threw some definitions into the .py file (just in case).

I have tested it on primatives but not on a scripted importer, that's my only concern. I don't see any reason why they wouldn't work though on 1 and not the other.. 

So I know that this is not the best place for some of this stuff. The assignVertexToGroup, removeVertexFromGroup, returnVertexFromGroup, would probably be better in NMesh, however, that would require getting a pointer to the object that owns the mesh data. Also, assignVertexToGroup will create a new dvert mesh matching the mvert mesh in the mesh data, so it might be more intuitive to create the mesh, link it and then select vertex points from the mesh to add to groups. One of the reasons i thought that returning data is good is both for testing vertex/group associations and also because most file exports might need to know that stuff.

So, in conclusion, if my rambling post makes little sense it's because im sick. 

Joseph
                                                  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20030903/17858dac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: object.zip
Type: application/x-zip-compressed
Size: 18782 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20030903/17858dac/attachment.bin>


More information about the Bf-python mailing list