Fix 436 and 1251
This commit is contained in:
@@ -11,6 +11,11 @@ namespace FlaxEditor.Gizmo
|
|||||||
[HideInEditor]
|
[HideInEditor]
|
||||||
public interface IGizmoOwner
|
public interface IGizmoOwner
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the gizmos collection.
|
||||||
|
/// </summary>
|
||||||
|
FlaxEditor.Viewport.EditorViewport Viewport { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the gizmos collection.
|
/// Gets the gizmos collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -162,10 +162,23 @@ namespace FlaxEditor.Gizmo
|
|||||||
|
|
||||||
// Scale gizmo to fit on-screen
|
// Scale gizmo to fit on-screen
|
||||||
Vector3 position = Position;
|
Vector3 position = Position;
|
||||||
Vector3 vLength = Owner.ViewPosition - position;
|
if (Owner.Viewport.UseOrthographicProjection)
|
||||||
float gizmoSize = Editor.Instance.Options.Options.Visual.GizmoSize;
|
{
|
||||||
_screenScale = (float)(vLength.Length / GizmoScaleFactor * gizmoSize);
|
//[hack] this is far form ideal the View Position is in wrong location, any think using the View Position will have problem
|
||||||
|
//the camera system needs rewrite the to be a camera on springarm, similar how the ArcBallCamera is handled
|
||||||
|
//the ortho projection cannot exist with fps camera because there is no
|
||||||
|
// - focus point to calculate correct View Position with Orthographic Scale as a reference and Orthographic Scale from View Position
|
||||||
|
// with make the camera jump
|
||||||
|
// - and deaph so w and s movment in orto mode moves the cliping plane now
|
||||||
|
float gizmoSize = Editor.Instance.Options.Options.Visual.GizmoSize;
|
||||||
|
_screenScale = gizmoSize * (50 * Owner.Viewport.OrthographicScale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 vLength = Owner.ViewPosition - position;
|
||||||
|
float gizmoSize = Editor.Instance.Options.Options.Visual.GizmoSize;
|
||||||
|
_screenScale = (float)(vLength.Length / GizmoScaleFactor * gizmoSize);
|
||||||
|
}
|
||||||
// Setup world
|
// Setup world
|
||||||
Quaternion orientation = GetSelectedObject(0).Orientation;
|
Quaternion orientation = GetSelectedObject(0).Orientation;
|
||||||
_gizmoWorld = new Transform(position, orientation, new Float3(_screenScale));
|
_gizmoWorld = new Transform(position, orientation, new Float3(_screenScale));
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ namespace FlaxEditor.Viewport
|
|||||||
Gizmos[i].Update(deltaTime);
|
Gizmos[i].Update(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <inheritdoc />
|
||||||
|
public EditorViewport Viewport => this;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public GizmosCollection Gizmos { get; }
|
public GizmosCollection Gizmos { get; }
|
||||||
|
|||||||
@@ -306,6 +306,8 @@ namespace FlaxEditor.Viewport
|
|||||||
var orient = ViewOrientation;
|
var orient = ViewOrientation;
|
||||||
((FPSCamera)ViewportCamera).ShowActors(TransformGizmo.SelectedParents, ref orient);
|
((FPSCamera)ViewportCamera).ShowActors(TransformGizmo.SelectedParents, ref orient);
|
||||||
}
|
}
|
||||||
|
/// <inheritdoc />
|
||||||
|
public EditorViewport Viewport => this;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public GizmosCollection Gizmos { get; }
|
public GizmosCollection Gizmos { get; }
|
||||||
|
|||||||
Reference in New Issue
Block a user