def display_color_callback():
if bpy.context.object.mode == 'EDIT':
if display_color[0]:
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
quads = tris = ngons = 0
ngons_to_tris = 0
verts = len(bm.verts)
faces = len(bm.faces)
for f in bm.faces:
v = len(f.verts)
if v == 3: # tris
f.material_index = 2
elif v == 4: # quads
f.material_index = 0
elif v > 4: # ngons
f.material_index = 1
bmesh.update_edit_mesh(me)
评论列表
文章目录