Fix #2579: keep blender_idxs in sync with dots_edges dedup#2724
Open
Builder106 wants to merge 1 commit into
Open
Fix #2579: keep blender_idxs in sync with dots_edges dedup#2724Builder106 wants to merge 1 commit into
Builder106 wants to merge 1 commit into
Conversation
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.
Problem
Exporting a custom float attribute on loose edges could produce mangled geometry: each exported vertex's position and its attribute value could end up belonging to two different original Blender vertices.
@julienduroure traced the first-order cause to
fast_structured_np_uniquevsnp.uniquebehaving differently. @Mysteryem dug further and found the actual mismatch: inprimitive_creation_edges_and_points,self.blender_idxswas computed via a standalonenp.unique(self.blender_idxs_edges)call, independent of thefast_structured_np_unique(self.dots_edges, ...)dedup used for the attribute data itself, unlike the matching pattern inprimitive_creation_shared/primitive_creation_not_shared.Since
__set_positions_attributebuildsPOSITIONfromself.locs[self.blender_idxs], while other attributes are read straight offdots_edges, the two independently-sorted arrays don't share row order, so position and attribute data get paired up incorrectly.Solution
Derive
self.blender_idxsfrom the same deduplicatedself.dots_edgesused for the attribute data, matching the existing pattern in the two sibling functions, per @Mysteryem's proposed fix in the issue thread.Verification
fast_structured_np_unique: 11/12 row mismatches with the old logic, 0/12 after the fix.POSITIONand the custom attribute present and correctly paired.Closes #2579