I’m trying to write a script to manipulate colorbands, but I haven’t been able to figure out how to add entries to them.
#!BPY
“”"
Name: ‘Blend Interpolate’
Blender: 248
Group: ‘Misc’
Tooltip: ‘Creates a color in a colorband’
“”"
import BPyMesh
import Blender
import BPyMessages
reload(BPyMessages)
import bpy
from Blender import Scene, Mesh, Window, sys, Texture, Material
def main():
sce = bpy.data.scenes.active t = sys.time() is_editmode = Window.EditMode() Window.EditMode(0) tex1 = Blender.Texture.Get('Test') if not tex1: tex1 = Blender.Texture.New('Test') #tex1.setFlags() tex1.colorband.append( [.1,.1,.1,1,.5] ) Blender.Redraw()
print 'Interpolation finished in %.2f seconds' % (sys.time()-t) Window.WaitCursor(0) if is_editmode: Window.EditMode(1)
main()
the texture is created, but the colorband only contains the default entries.