How can I access the weight values of a polygon resp. it's vertices by the vertex group name?
ob = bpy.context.active_object
vertexGrp = ob.vertex_groups["Group1"]
for poly in ob.data.polygons:
weight = 0
for vert in poly.vertices:
weight += ob.data.vertices[vert].groups[vertexGrp].weight
# The commented lines didn't work either
#weight += ob.data.vertices[vert].groups[1].weight
#weight += ob.data.vertices[vert].groups["Group1"].weight
#do something with the weight
It's about the last line, including the commented ones, that give me an error, it seems I don't use it right. Googled for hours, but didn't find an example I could understand. Please help.