How can I set my favorite color to all of the selected objects?

I can't attach my objects not at all.

The number of objects is high and I can not adjust their color vertex one by one.

Sorry for my bad english.



this answer is for vertex color of single object enter image description here

I converted it to multiple objects:

import bpy
import random
import time
# start in object mode
objects = bpy.context.scene.objects
for obj in objects:
    mesh = obj.data

    if not mesh.vertex_colors:

    color_layer = mesh.vertex_colors["Col"]

    # or you could avoid using the color_layer name
    # color_layer = mesh.vertex_colors.active  

    i = 0
    for poly in mesh.polygons:
        for idx in poly.loop_indices:
            color_layer.data[i].color = (0, 1, 0, 1)
            i += 1
    # set to vertex paint mode to see the result
  • $\begingroup$ Hello Seyed, I'm trying to use your script and keep getting this error with not much happening- Traceback (most recent call last): File "M:\3D\Jen_n_Tim\ShatteredMoon\ShatteredMoon_V2.Bake.blend\Text", line 10, in <module> AttributeError: 'NoneType' object has no attribute 'vertex_colors' Error: Python script failed, check the message in the system console Any ideas, or does it not work in Blender 2.92? I tried with both mesh.vertex_colors.new() and mesh.vertex_colors.active same result. $\endgroup$
    – MarkS
    Apr 10 '21 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.