add mixbox for python

This commit is contained in:
Ondrej Jamriska
2022-09-21 05:05:52 +02:00
parent 4bfc462204
commit 334932d8fe
7 changed files with 384 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import bpy
import mixbox
rgb1 = (0.0, 0.015, 0.235) # blue
rgb2 = (0.973, 0.651, 0.0) # yellow
n = 5
for i in range(0, n):
bpy.ops.mesh.primitive_cube_add(location = ((i - n/2 + 0.5) * 3, 0, 0))
mat = bpy.data.materials.new("material")
mat.diffuse_color = mixbox.lerp_linear_float(rgb1, rgb2, i / (n - 1))
bpy.context.object.active_material = mat