SImplify editor code for actors debug shapes drawing

This commit is contained in:
2025-07-11 23:00:53 +02:00
parent 3e82e550f3
commit 4af26a5516
4 changed files with 15 additions and 23 deletions
@@ -374,14 +374,7 @@ namespace FlaxEditor.Viewport
// Draw selected objects debug shapes and visuals // Draw selected objects debug shapes and visuals
if (DrawDebugDraw && (renderContext.View.Flags & ViewFlags.DebugDraw) == ViewFlags.DebugDraw) if (DrawDebugDraw && (renderContext.View.Flags & ViewFlags.DebugDraw) == ViewFlags.DebugDraw)
{ {
unsafe _debugDrawData.DrawActors();
{
fixed (IntPtr* actors = _debugDrawData.ActorsPtrs)
{
DebugDraw.DrawActors(new IntPtr(actors), _debugDrawData.ActorsCount, true);
}
}
DebugDraw.Draw(ref renderContext, target.View(), targetDepth.View(), true); DebugDraw.Draw(ref renderContext, target.View(), targetDepth.View(), true);
} }
} }
@@ -643,14 +643,7 @@ namespace FlaxEditor.Viewport
if (selectedParents[i].IsActiveInHierarchy) if (selectedParents[i].IsActiveInHierarchy)
selectedParents[i].OnDebugDraw(_debugDrawData); selectedParents[i].OnDebugDraw(_debugDrawData);
} }
_debugDrawData.DrawActors();
unsafe
{
fixed (IntPtr* actors = _debugDrawData.ActorsPtrs)
{
DebugDraw.DrawActors(new IntPtr(actors), _debugDrawData.ActorsCount, false);
}
}
// Debug draw all actors in prefab and collect actors // Debug draw all actors in prefab and collect actors
var view = Task.View; var view = Task.View;
+12
View File
@@ -88,6 +88,18 @@ namespace FlaxEditor
} }
} }
/// <summary>
/// Draws the collected actors via <see cref="DebugDraw"/>.
/// </summary>
/// <param name="drawScenes">True if draw all loaded scenes too, otherwise will draw only provided actors.</param>
public unsafe void DrawActors(bool drawScenes = false)
{
fixed (IntPtr* actors = ActorsPtrs)
{
DebugDraw.DrawActors(new IntPtr(actors), _actors.Count, drawScenes);
}
}
/// <summary> /// <summary>
/// Called when task calls <see cref="SceneRenderTask.CollectDrawCalls" /> event. /// Called when task calls <see cref="SceneRenderTask.CollectDrawCalls" /> event.
/// </summary> /// </summary>
+1 -7
View File
@@ -510,13 +510,7 @@ namespace FlaxEditor.Windows
selectedParents[i].OnDebugDraw(drawDebugData); selectedParents[i].OnDebugDraw(drawDebugData);
} }
} }
unsafe drawDebugData.DrawActors(true);
{
fixed (IntPtr* actors = drawDebugData.ActorsPtrs)
{
DebugDraw.DrawActors(new IntPtr(actors), drawDebugData.ActorsCount, true);
}
}
} }
DebugDraw.Draw(ref renderContext, task.OutputView); DebugDraw.Draw(ref renderContext, task.OutputView);