Refactor editor viepwort camera to unify focusing on selected objects

This commit is contained in:
Wojtek Figat
2024-03-16 16:46:10 +01:00
parent f81e89d7d4
commit 8d149b94f1
4 changed files with 92 additions and 99 deletions

View File

@@ -770,14 +770,7 @@ namespace FlaxEditor.Viewport
/// <param name="orientation">The target view orientation.</param>
public void FocusSelection(ref Quaternion orientation)
{
if (TransformGizmo.SelectedParents.Count == 0)
return;
var gizmoBounds = Gizmos.Active.FocusBounds;
if (gizmoBounds != BoundingSphere.Empty)
((FPSCamera)ViewportCamera).ShowSphere(ref gizmoBounds, ref orientation);
else
((FPSCamera)ViewportCamera).ShowActors(TransformGizmo.SelectedParents, ref orientation);
ViewportCamera.FocusSelection(Gizmos, ref orientation);
}
/// <summary>