Thread: [cgkit-commits] cgkit2/cgkit maimport.py,1.8,1.9
Brought to you by:
mbaas
From: Matthias B. <mb...@us...> - 2005-06-06 13:18:51
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4312 Modified Files: maimport.py Log Message: Import mesh vertex colors if available Index: maimport.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/maimport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** maimport.py 5 Jun 2005 17:42:02 -0000 1.8 --- maimport.py 6 Jun 2005 13:18:36 -0000 1.9 *************** *** 366,385 **** # Set texture coordinates... uvset = node.getAttrValue("uvSet", "uvst", type=None, n=None) ! stlst = list(uvset[0].uvsp) ! if valid_st and len(stlst)>0: ! geom.newVariable("st", USER, FLOAT, 2, len(stlst)) ! st = geom.slot("st") ! for i,stval in enumerate(stlst): ! st[i] = stval ! # Set the tex coord faces... ! geom.newVariable("stfaces", FACEVARYING, INT) ! stfaces = geom.slot("stfaces") i = 0 for face in faces: ! for mulst in face.mu: ! for id in mulst[0][1]: ! stfaces[i] = id i+=1 - # Apply vertex tweaks... --- 366,403 ---- # Set texture coordinates... uvset = node.getAttrValue("uvSet", "uvst", type=None, n=None) ! if uvset!=None: ! stlst = list(uvset[0].uvsp) ! if valid_st and len(stlst)>0: ! geom.newVariable("st", USER, FLOAT, 2, len(stlst)) ! st = geom.slot("st") ! for i,stval in enumerate(stlst): ! st[i] = stval ! # Set the tex coord faces... ! geom.newVariable("stfaces", FACEVARYING, INT) ! stfaces = geom.slot("stfaces") ! i = 0 ! for face in faces: ! for mulst in face.mu: ! for id in mulst[0][1]: ! stfaces[i] = id ! i+=1 ! ! # Set colors... ! colattr = node.getAttrValue("colors", "clr", type="float4", n=None) ! if colattr!=None: ! collst = list(colattr) ! geom.newVariable("Cs", USER, COLOR, 1, len(collst)) ! Cs = geom.slot("Cs") ! for i,Csval in enumerate(collst): ! Cs[i] = vec3(Csval[:3]) ! # Set the color faces... ! geom.newVariable("Csfaces", FACEVARYING, INT) ! Csfaces = geom.slot("Csfaces") i = 0 for face in faces: ! for fclst in face.fc: ! for id in fclst: ! Csfaces[i] = id i+=1 # Apply vertex tweaks... |