@@ -13,6 +13,7 @@ namespace FlaxEditor.Gizmo
|
||||
public abstract class GizmoBase
|
||||
{
|
||||
private IGizmoOwner _owner;
|
||||
private bool _visible = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gizmo owner.
|
||||
@@ -34,6 +35,11 @@ namespace FlaxEditor.Gizmo
|
||||
/// </summary>
|
||||
public virtual BoundingSphere FocusBounds => BoundingSphere.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this gizmo is visible.
|
||||
/// </summary>
|
||||
public bool Visible { get { return _visible; } set { _visible = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GizmoBase"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace FlaxEditor.Gizmo
|
||||
|
||||
private readonly List<SceneGraphNode> _selection = new List<SceneGraphNode>();
|
||||
private readonly List<SceneGraphNode> _selectionParents = new List<SceneGraphNode>();
|
||||
private bool _visible = true;
|
||||
|
||||
/// <summary>
|
||||
/// The event to apply objects transformation.
|
||||
@@ -53,11 +52,6 @@ namespace FlaxEditor.Gizmo
|
||||
/// </summary>
|
||||
public List<SceneGraphNode> SelectedParents => _selectionParents;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="TransformGizmo"/> is visible.
|
||||
/// </summary>
|
||||
public bool Visible { get { return _visible; } set { _visible = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TransformGizmo" /> class.
|
||||
/// </summary>
|
||||
@@ -281,13 +275,6 @@ namespace FlaxEditor.Gizmo
|
||||
base.OnSelectionChanged(newSelection);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw(ref RenderContext renderContext)
|
||||
{
|
||||
if (Visible)
|
||||
base.Draw(ref renderContext);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override int SelectionCount => _selectionParents.Count;
|
||||
|
||||
|
||||
@@ -391,9 +391,12 @@ namespace FlaxEditor.Viewport
|
||||
public void DrawEditorPrimitives(GPUContext context, ref RenderContext renderContext, GPUTexture target, GPUTexture targetDepth)
|
||||
{
|
||||
// Draw gizmos
|
||||
for (int i = 0; i < Gizmos.Count; i++)
|
||||
foreach (var gizmo in Gizmos)
|
||||
{
|
||||
Gizmos[i].Draw(ref renderContext);
|
||||
if (gizmo.Visible)
|
||||
{
|
||||
gizmo.Draw(ref renderContext);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw selected objects debug shapes and visuals
|
||||
|
||||
@@ -720,9 +720,12 @@ namespace FlaxEditor.Viewport
|
||||
public override void DrawEditorPrimitives(GPUContext context, ref RenderContext renderContext, GPUTexture target, GPUTexture targetDepth)
|
||||
{
|
||||
// Draw gizmos
|
||||
for (int i = 0; i < Gizmos.Count; i++)
|
||||
foreach (var gizmo in Gizmos)
|
||||
{
|
||||
Gizmos[i].Draw(ref renderContext);
|
||||
if (gizmo.Visible)
|
||||
{
|
||||
gizmo.Draw(ref renderContext);
|
||||
}
|
||||
}
|
||||
|
||||
base.DrawEditorPrimitives(context, ref renderContext, target, targetDepth);
|
||||
|
||||
Reference in New Issue
Block a user