Repository navigation
fix parsing of state-setting OBJ attributes (ex: material_name) - #122
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #122 +/- ##
==========================================
- Coverage 79.49% 79.47% -0.03%
==========================================
Files 11 11
Lines 839 843 +4
==========================================
+ Hits 667 670 +3
- Misses 172 173 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
Would be good to have a test with a (small) obj file that fails to load correctly without these changes |
Contributor
Author
Done! I added a small six-sided die which explicitly names each face (via vertex groups in Blender). It ends up being very similar to the "simple example" given in my initial message. |
jrbaxter0
force-pushed
the
fix-attribute-state-setting
branch
from
September 15, 2026 12:51
10cc990 to
1911937
Compare
Collaborator
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group name (
g), smoothing group (s), object name (o), and material (usemtl) statements in OBJ files are all state-setting, meaning they continue to take effect until explicitly changed.1 The current parser does not respect this, and this patch fixes it, enabling correct loading of complex texturedMetaMeshes.Simple Example
In this OBJ file snippet, both groups
face0andfaceshould havematerial0applied, but the current parser only applies it to the former:It should be parsed as:
but it is instead parsed as:
Plotting the latter with Makie via
mesh(my_meta_mesh)will result in the error:KeyError: key nothing not found.Realistic Example
The earlier example is small to make it understandable, but a more realistic test can be done with this file:
Drone.zip (OBJ export of https://github.com/SimonDanisch/RayDemo/blob/main/GLTF/Drone.glb)
With the patch, the drone will be correctly rendered with a black body, silver landing gear, and orange-striped propellors.
Without the patch, it will fail:
Footnotes
https://paulbourke.net/dataformats/obj/ ↩