From 649c87b9573c62814e20cfbad4deaa07c13fa87d Mon Sep 17 00:00:00 2001 From: 31 <31eee384@gmail.com> Date: Sun, 16 Jun 2024 13:53:55 -0700 Subject: [PATCH] Make CSG shape dirty after changing Snap, update doc Update doc to mention that Snap only takes effect at the top level. Co-authored-by: Hugo Locurcio --- modules/csg/csg_shape.cpp | 5 +++++ modules/csg/doc_classes/CSGShape3D.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 8d2847ab1a81..296cda627aa3 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -141,7 +141,12 @@ bool CSGShape3D::is_root_shape() const { } void CSGShape3D::set_snap(float p_snap) { + if (snap == p_snap) { + return; + } + snap = p_snap; + _make_dirty(); } float CSGShape3D::get_snap() const { diff --git a/modules/csg/doc_classes/CSGShape3D.xml b/modules/csg/doc_classes/CSGShape3D.xml index 0414aa362d50..f9017e47c74c 100644 --- a/modules/csg/doc_classes/CSGShape3D.xml +++ b/modules/csg/doc_classes/CSGShape3D.xml @@ -73,7 +73,7 @@ The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent. - Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust. + Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust. The top-level CSG shape's snap value is used for the entire CSG tree. Adds a collision shape to the physics engine for our CSG shape. This will always act like a static body. Note that the collision shape is still active even if the CSG shape itself is hidden. See also [member collision_mask] and [member collision_priority].