def add_vcolor(mesh, representation, layerID):
"""copies vertex colors (layer `layerID`) from the representation to the blender mesh"""
vx_layer = mesh.vertex_colors.new("v_color_"+str(layerID))
vx_layer_a = mesh.vertex_colors.new("v_color_alpha_"+str(layerID))
# alpimg = bpy.data.images.new(mesh.name+'_vcol_alpha_'+str(layerID), 256, 256)
# XCX image method buggy -> disabled
for num, com in enumerate(representation.loops):
vx_layer.data[num].color = mathutils.Color(com.VColors[layerID][:3])
vx_layer_a.data[num].color = mathutils.Color(tuple(com.VColors[layerID][3])*3)
评论列表
文章目录