pywavefront / PyWavefront

Python library for importing Wavefront .obj files
BSD 3-Clause "New" or "Revised" License
312 stars 80 forks source link

Can you access vertices and UV of a face in PyWavefront? #146

Open nickponline opened 1 year ago

nickponline commented 1 year ago

@einarf How do you find the vertices and UV associated with a face. I can access the faces (scene.mesh_list[0].faces) and the vertices and UV of each material:

for name, material in scene.materials.items():
    print(name)
    print("   ", material.vertex_format) # T2F_V3F
    print("   ", len(material.vertices))

But no matter what I try I cannot take a face (v1, v2, v3) and find the vertices and UV associated with it? Am I missing something obvious?

fjansson commented 1 year ago

I think I have the same question. In a .obj file with several materials, how do I know which faces belong to which material? I'd like to have a material-specific list scene.materials['materialname'].faces to match scene.materials['materialname'].vertices.

There is some discussion in #87, #88.