if local_mesh.uv!=[]:
#Loading UV tex coords
uvtex1 = newmesh.uv_textures.new()#create uvset
if uvtex1:
uvtex = newmesh.uv_layers.active.data[:]
j=0
for i in range(len(local_mesh.faces)):
nb = len(local_mesh.faces[i])
# triangle or quad
if nb >= 3:
uvtex[j+0].uv = local_mesh.uv[j+0]
uvtex[j+1].uv = local_mesh.uv[j+1]
uvtex[j+2].uv = local_mesh.uv[j+2]
#quad
if nb == 4:
uvtex[j+3].uv = local_mesh.uv[j+3]
j += len(local_mesh.faces[i])
found = False
if local_mesh.tex_name != "":
imgname = local_mesh.tex_name
imgpath = os.path.dirname(path_file_name) +"/" +imgname
img = bpy.data.images.load( imgpath )
uvtex1.data[i].image = img
found = True
TheTom wrote in Thu May 03, 2012 8:03 pm:I've pushed a new version which also imports materials and textures. For me it works, but there can be problems with more then 4 vertices per face and just edges without faces.
Users browsing this forum: No registered users and 1 guest