From b831bbcbc976214d83a4a7259c6d4123f6a829c3 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 20:05:45 -0700 Subject: [PATCH] fix(editor): toast on non-finite fly-to target instead of silent no-op Camera::setPosition now refuses NaN, so flyToSelected() would silently do nothing if the selected entity had a corrupted position. Surface it as a toast so the user knows the selection is unusable rather than wondering why the camera didn't move. --- tools/editor/editor_app.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 8d336520..61955765 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -1576,6 +1576,15 @@ void EditorApp::flyToSelected() { have = true; } if (!have) return; + // Reject NaN target — would feed NaN into camera.setPosition (which + // now refuses it but the user would get no camera movement and no + // error message). Show the toast instead so the user knows the + // selection is corrupt. + if (!std::isfinite(target.x) || !std::isfinite(target.y) || + !std::isfinite(target.z)) { + showToast("Selection has non-finite position; can't fly to it"); + return; + } // Place camera back-and-up from the target along the current view direction // and aim it at the target. Distance scales with camera speed so it works