Hello, I hope this is not off topic here.
I'd like to create an object using Python. What already works: - creating the object - naming it - adding verices - creating faces from the vertices What I'd like to do now is to vertex paint the faces. This does not work yet, I'm struggling with the data structures and the commands necessary. I wonder if there are some examples around that I could use or if there is a description of the python data structures? I'd like to do the vertex painting based on the faces. The faces that I create have known positions and I do not want to go through the polygons of the object I created because I would not know which face maps to which polygon. # create an object bpy.ops.object.add(type='MESH', location=(0, 0, 0)) cs = bpy.context.active_object cs.name = 'color_sphere' bpy.ops.object.mode_set(mode = 'EDIT') bm = bmesh.from_edit_mesh(cs.data) # color handling / preparation cl = cs.data.vertex_colors if len(cl) == 0: cl.new() cm = cl['Col'] # vertex and fae creation ... vert[y][x] = bm.verts.new( (xp, yp, zp) ) ... face[y][x] = bm.faces.new( (vert[y][x], ..., vert[y][x+1]) ) ... bmesh.update_edit_mesh(cs.data) # now the vertex painting, it does not work as expected for loop in face[y][x].loops: for v in loop.vert: print(v) # this part works, but I'm unsure which face maps to which polygon #for poly in cs.data.polygons: # for idx in poly.loop_indices: # cm.data[idx].color = color[idx] I constructed this Frankenstein code from several examples I found in the internet. It does not work and I'm pretty unsure about what seveal parts in there are actually doing. Some hint on where to get the correct information to proceed would be great. Thanks for any hints, Torsten _______________________________________________ Bf-committers mailing list Bf-committers@blender.org https://lists.blender.org/mailman/listinfo/bf-committers