Skip to content

Commit 1aa4c04

Browse files
committed
Fix for Node3D request gizmos multiple times
This can result in multiple gizmos being created for the same nodes in some circumstances
1 parent 1cf573f commit 1aa4c04

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

scene/3d/node_3d.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ void Node3D::_notification(int p_what) {
229229
}
230230

231231
#ifdef TOOLS_ENABLED
232-
if (is_part_of_edited_scene()) {
232+
if (is_part_of_edited_scene() && !data.gizmos_requested) {
233+
data.gizmos_requested = true;
233234
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
234235
}
235236
#endif
@@ -753,7 +754,10 @@ void Node3D::update_gizmos() {
753754
}
754755

755756
if (data.gizmos.is_empty()) {
756-
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
757+
if (!data.gizmos_requested) {
758+
data.gizmos_requested = true;
759+
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
760+
}
757761
return;
758762
}
759763
if (data.gizmos_dirty) {
@@ -1450,6 +1454,7 @@ Node3D::Node3D() :
14501454
data.fti_frame_xform_force_update = false;
14511455

14521456
#ifdef TOOLS_ENABLED
1457+
data.gizmos_requested = false;
14531458
data.gizmos_disabled = false;
14541459
data.gizmos_dirty = false;
14551460
data.transform_gizmo_visible = true;

scene/3d/node_3d.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class Node3D : public Node {
154154

155155
#ifdef TOOLS_ENABLED
156156
Vector<Ref<Node3DGizmo>> gizmos;
157+
bool gizmos_requested : 1;
157158
bool gizmos_disabled : 1;
158159
bool gizmos_dirty : 1;
159160
bool transform_gizmo_visible : 1;

0 commit comments

Comments
 (0)