Merge pull request #36963 from JFonS/fix_rotation_gizmo_update

Fix rotation gizmo for empty Spatials
This commit is contained in:
Rémi Verschelde 2020-03-12 12:35:18 +01:00 committed by GitHub
commit 676fcca988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -2416,11 +2416,18 @@ void SpatialEditorViewport::_notification(int p_what) {
if (!se)
continue;
Transform t = sp->get_global_gizmo_transform();
exist = true;
if (se->last_xform == t)
continue;
changed = true;
se->last_xform = t;
VisualInstance *vi = Object::cast_to<VisualInstance>(sp);
se->aabb = vi ? vi->get_aabb() : _calculate_spatial_bounds(sp);
Transform t = sp->get_global_gizmo_transform();
t.translate(se->aabb.position);
// apply AABB scaling before item's global transform
@ -2428,11 +2435,6 @@ void SpatialEditorViewport::_notification(int p_what) {
aabb_s.scale(se->aabb.size);
t.basis = t.basis * aabb_s;
exist = true;
if (se->last_xform == t)
continue;
changed = true;
se->last_xform = t;
VisualServer::get_singleton()->instance_set_transform(se->sbox_instance, t);
}