From a10a21f407bcd707e5374956b6ff26a39c670149 Mon Sep 17 00:00:00 2001 From: simpuid Date: Thu, 19 Mar 2020 12:13:25 +0530 Subject: [PATCH] Fixes transform gizmo position when node has default transform Changes made: * Added dirty bit for SpatialEditorSelectedItem's last_xform * SpatialEditorViewport checks that dirt bit too before skipping the selection (cherry picked from commit 19825436d4d77025cb48c85a3d7300ff8857b12e) --- editor/plugins/spatial_editor_plugin.cpp | 3 ++- editor/plugins/spatial_editor_plugin.h | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 2c563014e3a..be5dbe23680 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2392,9 +2392,10 @@ void SpatialEditorViewport::_notification(int p_what) { Transform t = sp->get_global_gizmo_transform(); exist = true; - if (se->last_xform == t) + if (se->last_xform == t && !se->last_xform_dirty) continue; changed = true; + se->last_xform_dirty = false; se->last_xform = t; VisualInstance *vi = Object::cast_to(sp); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 25c676d6907..b84dc85f3fc 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -469,10 +469,14 @@ public: Transform original; // original location when moving Transform original_local; Transform last_xform; // last transform + bool last_xform_dirty; Spatial *sp; RID sbox_instance; - SpatialEditorSelectedItem() { sp = NULL; } + SpatialEditorSelectedItem() { + sp = NULL; + last_xform_dirty = true; + } ~SpatialEditorSelectedItem(); };