Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created September 16, 2015 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/4b2502e6300bccf48e14 to your computer and use it in GitHub Desktop.
Save zeffii/4b2502e6300bccf48e14 to your computer and use it in GitHub Desktop.
import bpy
obj = bpy.data.objects['sodark']
vcols = obj.data.vertex_colors
layer = vcols['Col']
def find_range(layer):
lower = [1,1,1]
higher = [0,0,0]
for i in layer.data:
col = i.color
r, g, b = col.r, col.g, col.b
if (r < lower[0] and g < lower[1] and b < lower[2]):
lower = [r,g,b]
if (r > higher[0] and g > higher[1] and b > higher[2]):
higher = [r,g,b]
return lower, higher
lower, higher = find_range(layer)
print(lower, higher)
layer2 = vcols.new('copy')
def adjust(layer, layer2, amp=2):
for j, i in zip(layer.data, layer2.data):
col = j.color
i.color = col.r * amp, col.g * amp, col.b * amp
adjust(layer, layer2, amp=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment