Adding vertex groups and weights

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Envil
Posts: 2
Joined: Sun Nov 25, 2012 3:03 pm

Adding vertex groups and weights

Postby Envil » Sun Nov 25, 2012 3:14 pm

I'm trying to write an importer script and managed to import the mesh and bones so far. Now i want to add vertex groups to the mesh and assign the weights to each vertex. Apparently the weights are stored in VertexGroupElement's for each vertex in the mesh, but this is marked as read-only so how would i add new ones? And how can i add the vertex groups to the mesh first of all? The documentation seems a bit lacking on examples or I'm to blind to find the right stuff :P

Envil
Posts: 2
Joined: Sun Nov 25, 2012 3:03 pm

Postby Envil » Sun Nov 25, 2012 9:28 pm

Well found it ^^

Code: Select all

vg = obj.vertex_groups.new("group name")
vg.add([vertice index], weight, "ADD")

obj being the mesh object.


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest