Fix duplicate quad faces in OBJ export for triangulated quads#135
Open
alsomar wants to merge 1 commit intothomthom:1.0from
Open
Fix duplicate quad faces in OBJ export for triangulated quads#135alsomar wants to merge 1 commit intothomthom:1.0from
alsomar wants to merge 1 commit intothomthom:1.0from
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.
When exporting to OBJ, any quad face represented as two triangles (triangulated quad) was being exported as two separate quad polygons instead of one. This caused geometry duplication in the exported file.
You can find the issue here: #134. I thinks it's also the root cause of these other issues: #127, #124, #120
In
EntitiesProvider#get_entity, when a triangulated quad's native faces had been previously cached as plainSketchup::Faceobjects (which happens duringEntitiesProvider.new), the condition guardingcache_entityprevented the createdQuadFacefrom being stored in@faces_to_quads:During OBJ export,
write_entitiescallsSurface.get(native_entities, true), which groups the two triangles of a quad into a singleSurface(they share a soft edge). Thenentities.get(surface.faces)is called on[triangle1, triangle2].Because neither triangle was in
@faces_to_quadsyet, two separateQuadFaceinstances were created for the same underlying triangles. SinceQuadFacehas no==method,.uniqcould not deduplicate them, and both were written to the OBJ file.Remove the guard condition so that
cache_entityis always called whenadd_to_cacheistrue:After caching the
QuadFacecreated fromtriangle1, bothtriangle1andtriangle2are registered in@faces_to_quads. Whentriangle2is subsequently processed, it returns the sameQuadFaceinstance, so.uniqcorrectly collapses the list to a single quad.