mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
c85bf90558
The OBJ serializer wrote the normal index into the texture-coordinate slot of a v/vt/vn face (emitting v/vn/vn), so exported UVs were wrong. Track a separate texcoord counter and emit the correct vt index. Per review, the material lookup is left relying on ApplyDefaultMaterials (default on, and IfcConvert exposes no toggle to disable it) so an unstyled element is given the default style before triangulation and material_ids never contain the -1 no-style sentinel, matching how the Collada serializer already indexes its materials without an ad hoc guard. The earlier material_id >= 0 guard is therefore removed. Verified on OCC 7.9.2: a styled box exports its material, an unstyled box exports the injected DefaultMaterial (valid index, no out-of-bounds) on both the default and --generate-uvs paths, and the UV path now emits correct v/vt/vn indices. Generated with the assistance of an AI coding tool. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>