I’ve been trying to get all the verices from vertex groups from within the Python API. I created a vertex group for the default Cube in 3D view and then entered the following code in the Python console:
>>> a = bpy.data.objects["Cube"]
>>> a
bpy.data.objects['Cube']
>>> a.vertex_groups
bpy.data.objects['Cube'].vertex_groups
>>> a.vertex_groups["Group"]
bpy.data.objects['Cube']...VertexGroup
>>> a.vertex_groups.keys()
['Group']
>>> a.vertex_groups["Group"]
bpy.data.objects['Cube']...VertexGroup
>>> a.vertex_groups["Group"][0]
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: this type doesn't support IDProperties
>>> a.vertex_groups["Group"].keys()
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: bpy_struct.keys(): this type doesn't support IDProperties
>>> a.vertex_groups["Group"].keys
<built-in method keys of VertexGroup object at 0x000000000AF6CF08>
>>> a.vertex_groups["Group"].keys(0)
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: keys() takes no arguments (1 given)
I don’t understand why a.vertex_groups.keys returns a message saying that it is a built in method, but when I actually call keys(), I get an error. How do I get a list of vertices of a vertex group from within Python?