godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.01k stars 21.09k forks source link

Nested `CSGShape3D`' doesn't update aabb gizmo if visibility is disabled #98021

Open dustdfg opened 4 hours ago

dustdfg commented 4 hours ago

Tested versions

4.3, current master

System information

Godot v4.3.stable - Debian GNU/Linux trixie/sid trixie - Wayland - GLES3 (Compatibility) - Mesa Intel(R) HD Graphics 520 (SKL GT2) - Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz (4 Threads)

Issue description

If the nested CSGShape3D has disabled visibility it doesn't update it is aabb gizmo while it happens when it is visible

https://github.com/user-attachments/assets/cb3212c1-7434-437b-9db2-3994f81d9036

Steps to reproduce

  1. Create scene with two CSGShape's one inside another
  2. Disable visibility of nested one
  3. Select the nested one (to see aabb gizmo)
  4. Change it is size

You expect to see size change

Minimal reproduction project (MRP)

csg_test.zip

dustdfg commented 4 hours ago

I have a patch (though it seems that it doesn't work for collision gizmo) so I am sure it is wrong or uses non perfect approach

diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 8c81c0ce4e..66ede58b1c 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -160,7 +160,8 @@ void CSGShape3D::_make_dirty(bool p_parent_removing) {

        if (!is_root_shape()) {
                parent_shape->_make_dirty();
-       } else if (!dirty) {
+       }
+       if (!dirty) {
                callable_mp(this, &CSGShape3D::_update_shape).call_deferred();
        }

@@ -297,10 +298,6 @@ void CSGShape3D::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const
 }

 void CSGShape3D::_update_shape() {
-       if (!is_root_shape()) {
-               return;
-       }
-
        set_base(RID());
        root_mesh.unref(); //byebye root mesh
JekSun97 commented 31 minutes ago

Sounds like my problem #96969