AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Python / Python exporter messed UVS
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

Python exporter messed UVS
Rate this thread
 
65932
 
Permlink of this thread  
avatar
  • ditus
  • Posted: 09 April 2012 01:18 AM
  • Total Posts: 17
  • Joined: 26 August 2007 11:34 AM

hi everyone,
im out of any idea, it seems the polyedituv is quite buggy or the entire python module is.

i wrote an exporter for my LSD webgl (http://ditus00.blogspot.com/ you can find here related information about the progess) engine in python. but maybe im doing something wrong, or the pyhton maya modul. for any reason, the uvs gets wrong exported?!

thanx for any tips.

here is the python exporter class i wrote:

class export():
    
def __init__(self,classes):
        
self.classes classes     
        self
.selection cmds.lsselection=True )
        print 
"export Modul loaded..."
        
    
def getTRIS(self,*args):
        
#OPEN WEB DIRECT format (dirk hochegger 2012)
        #includes 
        # - vert pos
        # - uvs
        # - soon normalen
        # - soon vert animation
        # - soon bone kinematic
        # - soon sound
        
fc cmds.polyEvaluatef=True )
        
path "C:/homepage/LSD/source/models/"
     
#   path = "C:/"
        
ext ".owd"
        
file path+"modell"+ext
        entirePATH 
file
        face 
=  {}
        uv 
{}
        normale 
{}
        
for i in range(fc):
            
pnt str(self.selection[0]+".f["+str(i)+"]")
            
cmds.select(pnt)
            
vertsID cmds.polyInfofv=True )[0]
  
            vert0 
int(vertsID[16:21])
            
vert1 int(vertsID[22:26])
            
vert2 int(vertsID[27:40])

            
pos cmds.xform(TrueTruews TrueTrue)
            
            
pos0 str(pos[0])[0:6],str(pos[1])[0:6],str(pos[2])[0:6]
            pos1 
str(pos[3])[0:6],str(pos[4])[0:6],str(pos[5])[0:6]
            pos2 
str(pos[6])[0:6],str(pos[7])[0:6],str(pos[8])[0:6]
            
            uvPNT0 
str(self.selection[0]+".map["+str(vert0)+"]")
            
cmds.select(uvPNT0)
            
tmpU0 cmds.polyEditUV(False,Truequery=True )
            
tmpV0 cmds.polyEditUV(False,Truequery=True )
            
uvPOS0 tmpU0,tmpV0
            
            
            uvPNT1 
str(self.selection[0]+".map["+str(vert1)+"]")
            
cmds.select(uvPNT1)
            
tmpU1 cmds.polyEditUV(False,Truequery=True )
            
tmpV1 cmds.polyEditUV(False,Truequery=True )
            
uvPOS1 tmpU1,tmpV1
            
            uvPNT2 
str(self.selection[0]+".map["+str(vert2)+"]")
            
cmds.select(uvPNT2)
            
tmpU2 cmds.polyEditUV(False,Truequery=True )
            
tmpV2 cmds.polyEditUV(False,Truequery=True )
            
uvPOS2 tmpU2,tmpV2

            face[i] 
pos0,pos1,pos2
            uv[i] 
uvPOS0,uvPOS1,uvPOS2

        f 
open(entirePATH,'w')
        for 
i in range(len(face)):
            
vert0 face[i][0]
            vert0_x 
vert0[0]
            vert0_y 
vert0[1]
            vert0_z 
vert0[2]
            
            vert1 
face[i][1]
            vert1_x 
vert1[0]
            vert1_y 
vert1[1]
            vert1_z 
vert1[2]
            
            vert2 
face[i][2]
            vert2_x 
vert2[0]
            vert2_y 
vert2[1]
            vert2_z 
vert2[2]
            
            uv0 
uv[i][0][0]
            uv1 
uv[i][1][0]
            uv2 
uv[i][2][0]
            
            vertSTR 
str("<<VERTS>>"+str(vert0_x)+"|"+str(vert0_y)+"|"+str(vert0_z)+"||"+
                               
str(vert1_x)+"|"+str(vert1_y)+"|"+str(vert1_z)+"||"+
                               
str(vert2_x)+"|"+str(vert2_y)+"|"+str(vert2_z))
                               
            
uvSTR str("<<UVS>>"+str(uv0[0])+"|"+str(uv0[1])+"||"+
                                   
str(uv1[0])+"|"+str(uv1[1])+"||"+
                                   
str(uv2[0])+"|"+str(uv2[1]))
            
            
f.write(str(vertSTR))
            
f.write(str(uvSTR))

        
f.close()
            
    
def export(self):
         
pass

here is the entire toolset:
http://www.aries-lenov.com/projekte/webgl/dev/LSD/toolsets/tentacleTOOLS.py

greetz
ditus



Replies: 0