Skip to content

Commit 6253814

Browse files
committed
Merge pull request #106070 from IphStich/fix-duplicate-gizmos
Fix for Node3D request gizmos multiple times
2 parents 8d04657 + 1aa4c04 commit 6253814

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
@@ -841,7 +842,10 @@ void Node3D::update_gizmos() {
841842
}
842843

843844
if (data.gizmos.is_empty()) {
844-
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
845+
if (!data.gizmos_requested) {
846+
data.gizmos_requested = true;
847+
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
848+
}
845849
return;
846850
}
847851
if (data.gizmos_dirty) {
@@ -1542,6 +1546,7 @@ Node3D::Node3D() :
15421546
data.fti_processed = false;
15431547

15441548
#ifdef TOOLS_ENABLED
1549+
data.gizmos_requested = false;
15451550
data.gizmos_disabled = false;
15461551
data.gizmos_dirty = false;
15471552
data.transform_gizmo_visible = true;

scene/3d/node_3d.h

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

158158
#ifdef TOOLS_ENABLED
159159
Vector<Ref<Node3DGizmo>> gizmos;
160+
bool gizmos_requested : 1;
160161
bool gizmos_disabled : 1;
161162
bool gizmos_dirty : 1;
162163
bool transform_gizmo_visible : 1;

0 commit comments

Comments
 (0)