Blender Python Question

Is there a way to remove vertex colors from multiple objects? Found this code that does the same trick but for Vertex Groups. I’ve tried replacing vgroup with vcol and vertex_groups with vertex_colors but that doesn’t work. Please help!

PS: Also need one for UV Maps

import bpy
for ob in bpy.context.selected_editable_objects:
    for vgroup in ob.vertex_groups:
        ob.vertex_groups.remove(vgroup)

I guess its like that:

import bpy
for ob in bpy.context.selected_editable_objects:
    for vcol in ob.data.vertex_colors:
        ob.data.vertex_colors.remove(vcol)
1 Like

Hi,
This should work.

import bpy

for obj in bpy.context.selected_objects:
    if obj.type == 'MESH':
        v_color = obj.data.vertex_colors
        while v_color:
            v_color.remove(v_color[0])
1 Like