Vinc3r / ReTiCo

Real Time Companion, a Blender add-on made to work faster, oriented 3D realtime and glTF workflow.
https://nothing-is-3d.com/
Do What The F*ck You Want To Public License
21 stars 4 forks source link

assign random object color but same for instances #83

Open Vinc3r opened 3 years ago

Vinc3r commented 3 years ago

need to take into account instances (so they get same color):

import bpy
import random

def returnRandColor():
    return random.randrange(0, 1000000) / 1000000

for obj in bpy.context.selected_objects:
    obj.color = (returnRandColor(), returnRandColor(), returnRandColor(), 1)
Vinc3r commented 2 years ago

https://github.com/Vinc3r/Blender-Python-Snippets/blob/master/blender-2.8%2B/random-color-on-selected.py

Vinc3r commented 2 years ago

also useful for wireframe > object color