Skip to content

[BUGFIX] Fix ChBlender UV Export for Meshes with Per-Vertex UVs - #867

Merged
rserban merged 1 commit into
projectchrono:mainfrom
Noah-Parsons:fix-blender-per-vertex-uv
Nov 14, 2026
Merged

rserban merged 1 commit into
projectchrono:mainfrom
Noah-Parsons:fix-blender-per-vertex-uv

Conversation

@Noah-Parsons

Copy link
Copy Markdown
Contributor

Summary

For a ChTriangleMeshConnected with per-vertex UVs (m_UV.size() == m_vertices.size() and no m_face_uv_indices), ChBlender wrote the UVs of every third triangle only, so the Blender add-on could not import the mesh. The loop in that branch stepped through the UV array in threes while indexing the face list. It now loops over the faces, writing the UV of each corner's vertex, as the per-corner branch above it does.

Related Issue(s)

Fixes #865.

Author(s)

@Noah-Parsons (independent).

Licensing

By submitting this pull request, I agree, that my contribution will be included in Chrono and redistributed under the BSD-3-Clause License.

Backward Compatibility

No change to inputs or the API. Meshes with per-vertex UVs now export one UV pair per face corner, which is what the Blender add-on expects. The previous loop could also index past the end of m_face_v_indices for a mesh with more vertices than triangles.

Detailed Description

Verified on Linux (GCC 13.3, Release) against main at 652118b, by exporting a 4 x 4 vertex grid (16 vertices, 18 triangles, per-vertex UVs) with ChBlender::ExportScript and comparing the uvs block in the generated assets script with the UV of each face corner's vertex:

  • Before: 36 values written, against 108 expected (2 per corner, 3 corners per triangle).
  • After: 108 values written, all matching.

git clang-format reports no changes. There are no unit tests for Chrono::Postprocess at present; I am happy to add one for this export under src/tests/unit_tests if that would be useful.

Post Submission Checklist

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • The feature has been verified to work with the CMake based build system

@rserban

rserban commented Nov 14, 2026

Copy link
Copy Markdown
Member

Thanks, Noah!

I don't think a unit test for this is needed at this time.

@rserban
rserban merged commit c2865ec into projectchrono:main Nov 14, 2026
@Noah-Parsons
Noah-Parsons deleted the fix-blender-per-vertex-uv branch November 14, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ChBlender: meshes with per-vertex UVs export too few UV values, and the Blender import fails

2 participants