Removing vertex colors for all selected objects

Information about the mesh vertices colors is stored in its vertex_colors property, as well as in its color_attributes property. To remove vertex color data from the mesh, we need to clear these mesh properties.

First, let’s loop through all the selected objects:

If the mesh vertex colors were applied by painting with a brush in the “Vertex Paint” mode, the vertex color data is stored in the vertex_colors mesh property.

The vertex_color property is a collection, so we can remove data from it by calling the remove() method and specifying the data to be removed as a parameter.

If we first created a container for vertex colors by clicking on the plus button in the Data Properties tab – Color Attributes, or, for example, transferred colors to mesh vertices from Geometry Nodes, the vertex colors data is stored in the special attribute.

To remove color attribute data, we can use the same remove() method on the color_attributes collection.

To take effect immediately, update the mesh

and redraw the viewport screen.

Now, for each of the selected meshes, all color data has been completely removed from its vertices.

Full code:

0 0 votes
Article Rating
Notify of

0 Comment
Inline Feedbacks
View all comments