From ab8612a914398aa9e4017b3bbe88a455471ae10e Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 14 Jul 2025 22:24:27 +0200 Subject: [PATCH] Add profiler events to editor gizmo --- Source/Editor/Gizmo/TransformGizmo.cs | 3 +++ Source/Editor/SceneGraph/RootNode.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Gizmo/TransformGizmo.cs b/Source/Editor/Gizmo/TransformGizmo.cs index 8294a4302..91e37ca25 100644 --- a/Source/Editor/Gizmo/TransformGizmo.cs +++ b/Source/Editor/Gizmo/TransformGizmo.cs @@ -155,6 +155,7 @@ namespace FlaxEditor.Gizmo // Ensure player is not moving objects if (ActiveAxis != Axis.None) return; + Profiler.BeginEvent("Pick"); // Get mouse ray and try to hit any object var ray = Owner.MouseRay; @@ -243,6 +244,8 @@ namespace FlaxEditor.Gizmo { sceneEditing.Deselect(); } + + Profiler.EndEvent(); } /// diff --git a/Source/Editor/SceneGraph/RootNode.cs b/Source/Editor/SceneGraph/RootNode.cs index 1a3e47be8..30e469657 100644 --- a/Source/Editor/SceneGraph/RootNode.cs +++ b/Source/Editor/SceneGraph/RootNode.cs @@ -97,13 +97,16 @@ namespace FlaxEditor.SceneGraph /// Hit object or null if there is no intersection at all. public SceneGraphNode RayCast(ref Ray ray, ref Ray view, out Real distance, RayCastData.FlagTypes flags = RayCastData.FlagTypes.None) { + Profiler.BeginEvent("RayCastScene"); var data = new RayCastData { Ray = ray, View = view, Flags = flags }; - return RayCast(ref data, out distance, out _); + var result = RayCast(ref data, out distance, out _); + Profiler.EndEvent(); + return result; } /// @@ -117,13 +120,16 @@ namespace FlaxEditor.SceneGraph /// Hit object or null if there is no intersection at all. public SceneGraphNode RayCast(ref Ray ray, ref Ray view, out Real distance, out Vector3 normal, RayCastData.FlagTypes flags = RayCastData.FlagTypes.None) { + Profiler.BeginEvent("RayCastScene"); var data = new RayCastData { Ray = ray, View = view, Flags = flags }; - return RayCast(ref data, out distance, out normal); + var result = RayCast(ref data, out distance, out normal); + Profiler.EndEvent(); + return result; } internal static Quaternion RaycastNormalRotation(ref Vector3 normal)