Merge branch 'xxSeys1-DebugDrawClearInEditor'
This commit is contained in:
@@ -968,6 +968,14 @@ namespace FlaxEditor.Viewport
|
|||||||
debugView.VisibleChanged += WidgetViewModeShowHide;
|
debugView.VisibleChanged += WidgetViewModeShowHide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear Debug Draw
|
||||||
|
{
|
||||||
|
var button = ViewWidgetButtonMenu.AddButton("Clear Debug Draw");
|
||||||
|
button.CloseMenuOnClick = false;
|
||||||
|
button.Clicked += () => DebugDraw.Clear();
|
||||||
|
ViewWidgetButtonMenu.VisibleChanged += (Control cm) => { button.Visible = DebugDraw.CanClear(); };
|
||||||
|
}
|
||||||
|
|
||||||
ViewWidgetButtonMenu.AddSeparator();
|
ViewWidgetButtonMenu.AddSeparator();
|
||||||
|
|
||||||
// Brightness
|
// Brightness
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
if (!AudioMuted)
|
if (!AudioMuted)
|
||||||
Audio.MasterVolume = value;
|
Audio.MasterVolume = value;
|
||||||
|
|
||||||
_audioVolume = value;
|
_audioVolume = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -677,6 +676,14 @@ namespace FlaxEditor.Windows
|
|||||||
checkbox.StateChanged += x => ShowDebugDraw = x.Checked;
|
checkbox.StateChanged += x => ShowDebugDraw = x.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear Debug Draw
|
||||||
|
if (DebugDraw.CanClear())
|
||||||
|
{
|
||||||
|
var button = menu.AddButton("Clear Debug Draw");
|
||||||
|
button.CloseMenuOnClick = false;
|
||||||
|
button.Clicked += () => DebugDraw.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
menu.AddSeparator();
|
menu.AddSeparator();
|
||||||
|
|
||||||
// Mute Audio
|
// Mute Audio
|
||||||
|
|||||||
@@ -347,6 +347,11 @@ struct DebugDrawContext
|
|||||||
DebugDrawData DebugDrawDepthTest;
|
DebugDrawData DebugDrawDepthTest;
|
||||||
Float3 LastViewPos = Float3::Zero;
|
Float3 LastViewPos = Float3::Zero;
|
||||||
Matrix LastViewProj = Matrix::Identity;
|
Matrix LastViewProj = Matrix::Identity;
|
||||||
|
|
||||||
|
inline int32 Count() const
|
||||||
|
{
|
||||||
|
return DebugDrawDefault.Count() + DebugDrawDepthTest.Count();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -739,6 +744,13 @@ void DebugDraw::SetContext(void* context)
|
|||||||
Context = context ? (DebugDrawContext*)context : &GlobalContext;
|
Context = context ? (DebugDrawContext*)context : &GlobalContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DebugDraw::CanClear(void* context)
|
||||||
|
{
|
||||||
|
if (!context)
|
||||||
|
context = &GlobalContext;
|
||||||
|
return ((DebugDrawContext*)context)->Count() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Vector3 DebugDraw::GetViewPos()
|
Vector3 DebugDraw::GetViewPos()
|
||||||
|
|||||||
@@ -62,6 +62,13 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The context or null.</param>
|
/// <param name="context">The context or null.</param>
|
||||||
API_FUNCTION() static void SetContext(void* context);
|
API_FUNCTION() static void SetContext(void* context);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if can clear all debug shapes displayed on screen. Can be used to disable this functionality when not needed for the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The context.</param>
|
||||||
|
/// <returns>True fi context can be cleared (has any shapes), otherwise false.</returns>
|
||||||
|
API_FUNCTION() static bool CanClear(void* context = nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Gets the last view position when rendering the current context. Can be sued for custom culling or LODing when drawing more complex shapes.
|
// Gets the last view position when rendering the current context. Can be sued for custom culling or LODing when drawing more complex shapes.
|
||||||
|
|||||||
Reference in New Issue
Block a user