Fix viewpoints.
This commit is contained in:
@@ -656,11 +656,20 @@ namespace FlaxEditor.Viewport
|
|||||||
/// Focuses the viewport on the current selection of the gizmo.
|
/// Focuses the viewport on the current selection of the gizmo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FocusSelection()
|
public void FocusSelection()
|
||||||
|
{
|
||||||
|
var orientation = ViewOrientation;
|
||||||
|
FocusSelection(ref orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Focuses the viewport on the current selection of the gizmo.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orientation">The target view orientation.</param>
|
||||||
|
public void FocusSelection(ref Quaternion orientation)
|
||||||
{
|
{
|
||||||
if (TransformGizmo.SelectedParents.Count == 0)
|
if (TransformGizmo.SelectedParents.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var orientation = ViewOrientation;
|
|
||||||
var gizmoBounds = Gizmos.Active.FocusBounds;
|
var gizmoBounds = Gizmos.Active.FocusBounds;
|
||||||
if (gizmoBounds != BoundingSphere.Empty)
|
if (gizmoBounds != BoundingSphere.Empty)
|
||||||
((FPSCamera)ViewportCamera).ShowSphere(ref gizmoBounds, ref orientation);
|
((FPSCamera)ViewportCamera).ShowSphere(ref gizmoBounds, ref orientation);
|
||||||
@@ -725,9 +734,10 @@ namespace FlaxEditor.Viewport
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OrientViewport(ref Quaternion orientation)
|
protected override void OrientViewport(ref Quaternion orientation)
|
||||||
{
|
{
|
||||||
FocusSelection();
|
if (TransformGizmo.SelectedParents.Count != 0)
|
||||||
|
FocusSelection(ref orientation);
|
||||||
base.OrientViewport(ref orientation);
|
else
|
||||||
|
base.OrientViewport(ref orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -787,11 +787,20 @@ namespace FlaxEditor.Viewport
|
|||||||
/// Focuses the viewport on the current selection of the gizmo.
|
/// Focuses the viewport on the current selection of the gizmo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FocusSelection()
|
public void FocusSelection()
|
||||||
|
{
|
||||||
|
var orientation = ViewOrientation;
|
||||||
|
FocusSelection(ref orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Focuses the viewport on the current selection of the gizmo.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orientation">The target view orientation.</param>
|
||||||
|
public void FocusSelection(ref Quaternion orientation)
|
||||||
{
|
{
|
||||||
if (TransformGizmo.SelectedParents.Count == 0)
|
if (TransformGizmo.SelectedParents.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var orientation = ViewOrientation;
|
|
||||||
var gizmoBounds = Gizmos.Active.FocusBounds;
|
var gizmoBounds = Gizmos.Active.FocusBounds;
|
||||||
if (gizmoBounds != BoundingSphere.Empty)
|
if (gizmoBounds != BoundingSphere.Empty)
|
||||||
((FPSCamera)ViewportCamera).ShowSphere(ref gizmoBounds, ref orientation);
|
((FPSCamera)ViewportCamera).ShowSphere(ref gizmoBounds, ref orientation);
|
||||||
@@ -802,9 +811,10 @@ namespace FlaxEditor.Viewport
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OrientViewport(ref Quaternion orientation)
|
protected override void OrientViewport(ref Quaternion orientation)
|
||||||
{
|
{
|
||||||
FocusSelection();
|
if (TransformGizmo.SelectedParents.Count != 0)
|
||||||
|
FocusSelection(ref orientation);
|
||||||
base.OrientViewport(ref orientation);
|
else
|
||||||
|
base.OrientViewport(ref orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
Reference in New Issue
Block a user