bmesh py api:

added access to deform weights, access to weights acts like a python dict so you can do...

  print(group in dvert)
  dvert[group] = 0.5
  print(dvert[group])
  del dvert[group]
  print(dvert.items())
This commit is contained in:
Campbell Barton
2012-03-27 10:30:10 +00:00
parent 1e7bcece44
commit 7f1e9b8c41
7 changed files with 369 additions and 15 deletions

View File

@@ -104,6 +104,25 @@ Here are some examples ...
print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
.. code-block:: python
# in this example the active vertex group index is used,
# this is stored in the object, not the BMesh
group_index = obj.vertex_groups.active_index
# only ever one deform weight layer
dvert_lay = bm.verts.layers.deform.active
for vert in bm.verts:
dvert = vert[dvert_lay]
if group_index in dvert:
print("Weight %f" % dvert[group_index])
else:
print("Setting Weight")
dvert[group_index] = 0.5
Keeping a Correct State
-----------------------

View File

@@ -342,7 +342,8 @@ MODULE_GROUPING = {
"BMLayerCollection",
"BMLayerItem",
("Custom-Data Layer Types", '-'),
"BMLoopUV"
"BMLoopUV",
"BMDeformVert"
)
}