-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Crash when adding CSGBox3D node due to gizmo drawing #60936
Comments
The crash happens here in line 352. If you delete this code section the crash goes away. godot/modules/csg/editor/csg_gizmos.cpp Lines 350 to 356 in a38aafc
The problem is that the cs object has no root_mesh when cs->get_meshes() is called which makes cs->get_meshes() return an empty array and then the program crashes when it tries to access index 1. The crash also disappears if you change this code to update the shape if necessary. godot/modules/csg/csg_shape.cpp Lines 598 to 608 in a38aafc
changed to:
This is because _update_shape() creates the missing root_mesh. |
This might be a stupid question but what exactly is a gizmo? I thought the gizmo was the little handle you use to move/rotate objects in the editor but when I remove all functions related to updating/redrawing the gizmo apparently nothing happens. |
A gizmo is a helper that is drawn only in the editor. It can use any material, although shadeless lines and transparent planes are typically used. It can have manipulation handles (displayed in red), but it's not a strict requirement. |
If the crash is really caused by aabbb40 then the fix is simply changing from Line 183 in 677b63d
There might be more calls that expect deferred mode. |
Or you can change this code: godot/modules/csg/editor/csg_gizmos.cpp Lines 350 to 356 in 677b63d
to check whether there are csg_meshes:
I checked how many times csg_meshes is empty by printing to the console and it is only once so this is just a problem with the gizmo not yet updated or something. Apparently the necessary update happens between the first and second call to CSGShape3DGizmoPlugin::redraw and after that everything is fine. |
@Mathis-Z Can you create a PR? It's pretty simple to do and you could become a contributor to the Godot source code. |
Namely:
@KoBeWi This seems to fix too the issue with CSG nodes. Could you create a PR too? |
I can confirm this issue in Godot 3.5 rc1. Should I report a bug for 3.5 rc1 or is this backported/merged to the 3.5 branch? |
Related to #58284.
Godot version
4.0.alpha (694baff)
System information
Fedora 34, GeForce GTX 1080 (NVIDIA 510.60.02)
Issue description
The editor crashes when adding a CSGBox3D node due to gizmo drawing. This occurs when adding a CSG node, or reopening the editor on a scene that has a CSG node saved. I can consistently reproduce the crash every time I open the editor on such a scene.
This also occurs with other CSG nodes such as CSGSphere3D.
I don't get such a crash on a build from a few days prior (9923179).
Edit: I bisected the regression to aabbb40.
Backtrace
Steps to reproduce
Minimal reproduction project
test_csg_crash.zip
The text was updated successfully, but these errors were encountered: