Created
September 16, 2015 09:53
-
-
Save zeffii/4b2502e6300bccf48e14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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