moderngl-window icon indicating copy to clipboard operation
moderngl-window copied to clipboard

load_scene has incorrect mesh name

Open klattimer opened this issue 2 years ago • 2 comments

In an obj file with o MyObject accompanied by a mtl file with newmtl MyMaterial the mesh.name has the same value as mash.material.name.

klattimer avatar Jun 06 '23 11:06 klattimer

Definitely it looks like the material name is used for the mesh name. I don't quite remember why this was done.

https://github.com/moderngl/moderngl-window/blob/200f2b9ea8b350b0ac9bb6a2d24310c0d8227794/moderngl_window/loaders/scene/wavefront.py#L111

einarf avatar Jun 06 '23 17:06 einarf

I think it's because vertices with the same material are by default consolidated into a single mesh. This is also reflected in the json/bin cache files when that is enabled. Will have to look at the possibilities later in 3.0. obj files are generally a nightmare to deal with due to the loose standard. The best path is likely to make a new loader using trimesh. Just archive or throw out the old one.

einarf avatar Nov 29 '24 01:11 einarf