vertex color animation script blender
make a mesh i like grids
- make vertex colors on it
- make material and turn on vcol paint
- set drawtype to textured
- open text window and load this script:
wordpress invariably destroys my python when i try and put it in code tags for ya, sorry. you’ll haftu fix the indents but hay what fun
#!BPY
“”"
Name:’AYVABTU’
Blender:245
Group:’Mesh’
Tooltip:’Selects Vertice moduli indices’
“”"
import Blender
import bpy
from Blender import Draw
from Blender import Window
from Blender import sys
import math
global N,inverting_modulus_truth,color_a,color_b,init_color_a,init_color_b,skipping_hidden,irf,igf,ibf
irf=igf=ibf=1.005
N = 2
skipping_hidden=bool(0)
inverting_modulus_truth = bool(1)
init_color_a=(0.8, 0.2, 0.8)
init_color_b=(0.2, 0.8, 0.2)
class Freq:
def __init__(self,freq):
self.freq=freq
def getN(self,n):
return int(math.sin(self.freq*n)*128)+128
class freqs:
def __init__(self,freqset):
self.fqs=[]
for fq in freqset:
self.fqs.append(Freq(fq))
def getN(self,n):
ret=[]
for fq in self.fqs:
ret.append(fq.getN(n))
return ret
t= Blender.sys.time()
print “===================[%s]======” % t
###########################################
scn=Blender.Scene.GetCurrent()
meshes = [me for me in scn.objects.selected if (me.type=='Mesh')]
if len(meshes)<1:
scn.objects.selected=[]
res=Draw.PupIntInput(“res for default grid:”,32,2,100)
if res==None:Blender.Draw.Exit()
nu=Blender.Mesh.Primitives.Grid(res,res,2)
nuob=scn.objects.new(nu,”nu”)
scn.objects.active=nuob
Window.RedrawAll()
Window.EditMode(0)
sce= bpy.data.scenes.active
ob_act = sce.objects.active
obj= ob_act.getData(mesh=1)
obj.vertexColors=True
Window.EditMode(0)
mt=Blender.Get(‘curframe’)
print “frame:”
print “\t”,mt
freq_set=freqs([irf+mt,igf+mt,ibf+mt])
for f in obj.faces:
for i,v in enumerate(f.verts):
if v.sel==1:
r,g,b=freq_set.getN(v.index)
print “–r%d g%d b%d–” %(r,g,b)
f.col[i].r=r
f.col[i].g=g
f.col[i].b=b
- go to script links and make a world scriptlink on framechanged that runs the text whalleva ucallit
- change the frame forward manually with arrow key
- tab into and out of the object
- you should see results but sometimes tinkering is needed
- now you can render an animation or just watch it slowly
- big meshes obviously cooler than little ones


Leave a Reply