Here is some of my code which I'm now working with.
Take a look and perhaps you can give me some advise.

                uvFace = []
                uname = objname + 'UVs'
                smfUVLayer = mesh.uv_textures.new(uname)
                for i in range (len(faces)):
                        for j in range (len(faces[i])):
                                uvFace = smfUVLayer.data[i],
                                uvFace += ((uvs[faces[i][0]])),
                                uvFace += ((uvs[faces[i][1]])),
                                uvFace += ((uvs[faces[i][2]]))
                                   
                        print('\n181 - face UV loaded', uvFace)
 
                print('184 - Importing materials...')
                material = bpy.data.materials.new(objname + 'Mat')
                mesh.materials.append(material)
                tex_map = [('use_map_color_diffuse', 0)]
                for map, i in tex_map:  
                        mapName = os.path.basename(str(mapname))
                        tex = bpy.data.textures.new(objname + 'Tex', 
type='IMAGE')
                        import bpy_extras.image_utils
                        tex.image = bpy_extras.image_utils.load_image(mapName, 
'/Users/paulcoones/UNPODDED/art')
                        if tex.image != None:
                                print("smf_import: !INFO! Loaded %s" % 
(mapName))
                        else:
                                print("smf_import: !WARNING! Cannot find 
texture \"%s\"" % (mapName))
                        mtex = material.texture_slots.add()
                        mtex.texture = tex
                        mtex.texture_coords = 'UV'
                        if i == 9:
                                mtex.normal_factor = 0.1        # Just a guess, 
seems to look nice
                        mtex.use_map_color_diffuse = (i == 0)
                        setattr(mtex, map, True)
                        bpy.ops.object.editmode_toggle()
                        bpy.ops.uv.unwrap() 
                        bpy.ops.object.editmode_toggle()
                        mesh.update(calc_edges=True)
                        print('208 - this part unwrapped')


181 - face UV loaded 
(bpy.data.meshes['axleRMesh.009'].uv_textures["axleRUVs"].data[581], (0.8149, 
0.33006500000000005), (0.8149, 0.322731), 0.840416, 0.322731)

181 - face UV loaded 
(bpy.data.meshes['axleRMesh.009'].uv_textures["axleRUVs"].data[582], (0.840416, 
0.315396), (0.840416, 0.315396), 0.8149, 0.315396)

181 - face UV loaded 
(bpy.data.meshes['axleRMesh.009'].uv_textures["axleRUVs"].data[583], (0.8149, 
0.315396), (0.8149, 0.315396), 0.840416, 0.315396)

Paul Coones
[email protected]



_______________________________________________
Bf-python mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-python

Reply via email to