Refactoring, docs.
This commit is contained in:
@@ -89,6 +89,11 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
ShowSphere(ref sphere);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the viewport to visualize selected actors.
|
||||
/// </summary>
|
||||
/// <param name="actor">The actors to show.</param>
|
||||
/// <param name="orientation">The used orientation.</param>
|
||||
public void ShowActor(Actor actor, ref Quaternion orientation)
|
||||
{
|
||||
Editor.GetActorEditorSphere(actor, out BoundingSphere sphere);
|
||||
@@ -117,6 +122,11 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
ShowSphere(ref mergesSphere);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the viewport to visualize selected actors.
|
||||
/// </summary>
|
||||
/// <param name="actors">The actors to show.</param>
|
||||
/// <param name="orientation">The used orientation.</param>
|
||||
public void ShowActors(List<SceneGraphNode> actors, ref Quaternion orientation)
|
||||
{
|
||||
if (actors.Count == 0)
|
||||
|
||||
@@ -542,13 +542,7 @@ namespace FlaxEditor.Viewport
|
||||
if (_isOrtho)
|
||||
{
|
||||
var orient = ViewOrientation;
|
||||
if (!Editor.Instance.SceneEditing.HasSthSelected)
|
||||
{
|
||||
var pos = new Vector3(0.0f) + Vector3.Backward * ViewOrientation * 1000.0f;
|
||||
((FPSCamera)ViewportCamera).MoveViewport(pos, ViewOrientation);
|
||||
}
|
||||
else
|
||||
((FPSCamera)ViewportCamera).ShowActors(Editor.Instance.Windows.EditWin.Viewport.TransformGizmo.SelectedParents, ref orient);
|
||||
OrientViewport(ref orient);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -567,13 +561,7 @@ namespace FlaxEditor.Viewport
|
||||
cameraView.ButtonClicked += button =>
|
||||
{
|
||||
var orient = Quaternion.Euler((Vector3)button.Tag);
|
||||
if (Editor.Instance.SceneEditing.HasSthSelected)
|
||||
((FPSCamera)ViewportCamera).ShowActors(Editor.Instance.Windows.EditWin.Viewport.TransformGizmo.SelectedParents, ref orient);
|
||||
else
|
||||
{
|
||||
var pos = new Vector3(0.0f) + Vector3.Backward * orient * 2000.0f;
|
||||
((FPSCamera)ViewportCamera).MoveViewport(pos, orient);
|
||||
}
|
||||
OrientViewport(ref orient);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -676,6 +664,19 @@ namespace FlaxEditor.Viewport
|
||||
task.Begin += OnRenderBegin;
|
||||
}
|
||||
|
||||
private void OrientViewport(ref Quaternion orientation)
|
||||
{
|
||||
if (Editor.Instance.SceneEditing.HasSthSelected)
|
||||
{
|
||||
((FPSCamera)ViewportCamera).ShowActors(Editor.Instance.Windows.EditWin.Viewport.TransformGizmo.SelectedParents, ref orientation);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos = new Vector3(0.0f) + Vector3.Backward * orientation * 2000.0f;
|
||||
((FPSCamera)ViewportCamera).MoveViewport(pos, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEditorOptionsChanged(EditorOptions options)
|
||||
{
|
||||
_mouseSensitivity = options.Viewport.MouseSensitivity;
|
||||
|
||||
Reference in New Issue
Block a user