Skip to content

Commit

Permalink
Merge pull request #36963 from JFonS/fix_rotation_gizmo_update
Browse files Browse the repository at this point in the history
Fix rotation gizmo for empty Spatials
  • Loading branch information
akien-mga authored Mar 12, 2020
2 parents 14b41d0 + a0af309 commit 676fcca
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions editor/plugins/spatial_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,23 +2416,25 @@ 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
Basis aabb_s;
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);
}

Expand Down

0 comments on commit 676fcca

Please sign in to comment.