Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for infinite loop in Build2DFaces::_find_edge_intersections #76520

Closed
wants to merge 1 commit into from

Conversation

justinwash
Copy link
Contributor

This PR solves issue #73927 in which _find_edge_intersections could loop infinitely while creating new faces from edge intersections by keeping track of which edges we have already processed and skipping edges with the same points and uvs that come up in subsequent loops.

Had some concern about the glitchy faces that appear in subtract mode, but that appears to also occur in the most recent master post- #74771 so I'm not sure they really need to be covered in this fix, or if its even related.

This branch working:
https://user-images.githubusercontent.com/6236852/234983317-df6c0734-25f3-4790-80c6-24844062dde8.mp4

Most recent Master branch crashing, also exhibiting similar geometry wonkiness:
https://user-images.githubusercontent.com/6236852/234984769-620a2f24-968e-4a08-9a56-f4cc383c6d27.mp4

Also this is my first time touching both the Godot source and C++ so uh... don't hold back :D

@justinwash justinwash requested a review from a team as a code owner April 27, 2023 20:44
@fire fire self-requested a review April 27, 2023 20:52
@@ -1079,14 +1081,30 @@ void CSGBrushOperation::Build2DFaces::_find_edge_intersections(const Vector2 p_s

// Check each edge.
for (int face_edge_idx = 0; face_edge_idx < 3; ++face_edge_idx) {
Vector2 edge_points[2] = {
Vector<Vector2> edge_points_and_uvs = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try LocalVector

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalVector doesn't work here as the .find(), both for LocalVector (core/templates/local_vector.h(251)) and std Vector, don't seem able to parse LocalVector as a type for equality checking:

error C2678: binary '==': no operator found which takes a left-hand operand of type 'const T' (or there is no acceptable conversion)
        with
        [
            T=LocalVector<Vector2,uint32_t,false,false>
        ]

I'm a little over my head here trying to parse what would need to change for this to be allowed.

modules/csg/csg.cpp Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Apr 27, 2023

Also read our PR guidelines. https://docs.godotengine.org/en/stable/contributing/workflow/pr_workflow.html

As far as I can tell you need to git squash and address comments.

@justinwash
Copy link
Contributor Author

Thanks, will do.

Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
@justinwash
Copy link
Contributor Author

justinwash commented Apr 27, 2023

I've well and truly destroyed this PR trying to squash it :( Remaking according to the PR Guidelines. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants