Message 1 of 1
Python exporter messed UVS
Not applicable
04-09-2012
05:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
here is the entire toolset:
http://www.aries-lenov.com/projekte/webgl/dev/LSD/toolsets/tentacleTOOLS.py
greetz
ditus
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.ls( selection=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.polyEvaluate( f=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+".f")
cmds.select(pnt)
vertsID = cmds.polyInfo( fv=True )
vert0 = int(vertsID)
vert1 = int(vertsID)
vert2 = int(vertsID)
pos = cmds.xform(q = True, a = True, ws = True, t = True)
pos0 = str(pos),str(pos),str(pos)
pos1 = str(pos),str(pos),str(pos)
pos2 = str(pos),str(pos),str(pos)
uvPNT0 = str(self.selection+".map")
cmds.select(uvPNT0)
tmpU0 = cmds.polyEditUV(r = False,u = True, query=True )
tmpV0 = cmds.polyEditUV(r = False,v = True, query=True )
uvPOS0 = tmpU0,tmpV0
uvPNT1 = str(self.selection+".map")
cmds.select(uvPNT1)
tmpU1 = cmds.polyEditUV(r = False,u = True, query=True )
tmpV1 = cmds.polyEditUV(r = False,v = True, query=True )
uvPOS1 = tmpU1,tmpV1
uvPNT2 = str(self.selection+".map")
cmds.select(uvPNT2)
tmpU2 = cmds.polyEditUV(r = False,u = True, query=True )
tmpV2 = cmds.polyEditUV(r = False,v = True, query=True )
uvPOS2 = tmpU2,tmpV2
face = pos0,pos1,pos2
uv = uvPOS0,uvPOS1,uvPOS2
f = open(entirePATH,'w')
for i in range(len(face)):
vert0 = face
vert0_x = vert0
vert0_y = vert0
vert0_z = vert0
vert1 = face
vert1_x = vert1
vert1_y = vert1
vert1_z = vert1
vert2 = face
vert2_x = vert2
vert2_y = vert2
vert2_z = vert2
uv0 = uv
uv1 = uv
uv2 = uv
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)+"|"+str(uv0)+"||"+
str(uv1)+"|"+str(uv1)+"||"+
str(uv2)+"|"+str(uv2))
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