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)
    Début   Index
précédent Painting Erazer
Fonctions de b2.23 Suivant

 
Normal vers les mesh colors : complet, 3 axes
unidirectionnel, 1  axe au choix

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()


 
précédent Painting Erazer
 Fonctions de b2.23 Suivant
Vers le Haut de page

Les questions concernant cette page  peuvent être posées sur  :
 news://news.zoo-logique.org/3D.Blender


 

 

Livre en français
Blender : apprenez, pratiquez, Créez, livre, Ed. Campus Press, coll. Starter Kit
Blender Starter Kit

Forum
FAQ
Lexique
Didacticiels
Compilations
Blender2KT
Débuter
Modelage
Blender python
Materiaux
Lumière
Animation
API python (eng)
Archives nzn
Statistiques
Doc flash Sculptris
Galerie Sculptris

mon site de démos sur youtube