Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import bpy
def paintVerteces():
ob = bpy.context.object
maxZ = float(“-inf”)
minZ = float(“inf”)
for face in
for vert_idx in face.vertices:
position =[vert_idx].co
z = position.z
if z<minZ:
minZ = z
if z>maxZ:
maxZ = z
for face in
for vert_idx, loop_idx in zip(face.vertices, face.loop_indices):
position =[vert_idx].co
z = position.z
color = remap(minZ,0,maxZ,1,z)["Col"].data[loop_idx].color = (color,color,color,255)
def remap(min1,min2,max1,max2, value):
return min2 + (value - min1) * (max2 - min2) / (max1 - min1)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.