Blender (jusqu'à 2.49)
|
Python
Trucs
et Astuces(6)
Description:
mapping de couleurs basé sur la valeur de la normale.
(Mise à
jour pour b2.33 et suivants)
|
|
Normal vers
les mesh colors : complet, 3 axes
import Blender
from Blender import NMesh, Object
Me=Object.GetSelected()
me=Me[0].getData()
me.hasVertexColours(1)
for f in me.faces:
for v in f.v:
c=Blender.NMesh.Col(int(v.no[0]*127+128),
int(v.no[1]*127+128),
int(v.no[2]*127+128),
255)
try:
f.col[f.v.index(v)]=c
except:
f.col.append(None)
f.col[f.v.index(v)]=c
me.update()
Blender.Redraw() |
Normal
vers les mesh colors : unidirectionnel, 1 axe au choix
import Blender
from Blender import NMesh, Object
# direction ==> Y=0 , X=1, Z=2
direction=2
Me=Object.GetSelected()
me=Me[0].getData()
me.hasVertexColours(1)
for f in me.faces:
for v in f.v:
c=Blender.NMesh.Col(int(v.no[direction]*127+128),
int(v.no[direction]*127+128),
int(v.no[direction]*127+128),
255)
try:
f.col[f.v.index(v)]=c
except:
f.col.append(None)
f.col[f.v.index(v)]=c
me.update()
Blender.Redraw() |
Les questions concernant cette page
peuvent être posées sur :
news://news.zoo-logique.org/3D.Blender
|