fix(ir): preserve geometry referencing Unknown/Unresolved colors during baking#65
Open
bkfunk wants to merge 2 commits into
Open
fix(ir): preserve geometry referencing Unknown/Unresolved colors during baking#65bkfunk wants to merge 2 commits into
bkfunk wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes IR part baking so geometry that references ColorReference::Unknown(_) or ColorReference::Unresolved(_) is no longer silently dropped during baking. This aligns with the codebase’s existing ability to later reify color references (e.g., via Part::resolve_colors) once a ColorCatalog is available.
Changes:
- Treat
ColorReference::Unknown(_)andColorReference::Unresolved(_)the same asColorReference::Color(_)when selecting a destination mesh buffer during baking. - Remove the now-unreachable fallback match arm in
PartBufferBundleBuilder::query_mesh.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
260
to
270
| (ColorReference::Color(_), _) => { | ||
| (ColorReference::Color(_) | ColorReference::Unknown(_) | ColorReference::Unresolved(_), _) => { | ||
| Some(self.colored_meshes.entry(group.clone()).or_default()) | ||
| } |
Author
There was a problem hiding this comment.
Good catch — addressed in f36398c. query_mesh now returns &mut MeshBuffer directly, the call site is simplified accordingly, and the dead Skipping unknown color group_key branch is gone.
After the previous commit, query_mesh's match is exhaustive over ColorReference and always returns Some(...). Drop the Option wrapper and simplify the call site (the "Skipping unknown color group_key" branch was dead code). Per review feedback on segfault87#65. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
PartBufferBundleBuilder::query_meshinir/src/part.rspreviously matched onlyColorReference::Current,ColorReference::Complement, andColorReference::Color, returningNonefor theUnknownandUnresolvedvariants. As a result, any geometry that referenced a color whose definition wasn't (yet) in the catalog was silently dropped duringbake_part_from_*, even when aColorCatalogwas provided.This patch folds
UnknownandUnresolvedinto the same arm asColor, so their geometry is preserved in a dedicated mesh buffer and can be reified later viaPart::resolve_colors.Repro (before the fix)
Baking a part that contains a reference to a color not in the supplied
ColorCatalogproduces aPartwith missing geometry — no warning, no error.Change
The wildcard arm is no longer reachable, so it's removed (compiles cleanly because
ColorReferenceonly has these four constructors).Test plan
cargo check --workspacepasses