From 9e801f93b683a5f871a791c1315a489e662a9c58 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 10:15:00 -0700 Subject: [PATCH] fix(brush): NaN-guard EditorBrush::setPosition applyBrush already early-outs on NaN brush position, but the stored worldPos_ would still capture NaN and surface it to UI panels and the brush-circle indicator (which renders a NaN ring). Reject NaN at the setter so the editor state itself stays sane. --- tools/editor/editor_brush.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/editor/editor_brush.hpp b/tools/editor/editor_brush.hpp index f9fef177..e419e6db 100644 --- a/tools/editor/editor_brush.hpp +++ b/tools/editor/editor_brush.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include namespace wowee { namespace editor { @@ -31,7 +32,13 @@ public: void setActive(bool a) { active_ = a; } const glm::vec3& getPosition() const { return worldPos_; } - void setPosition(const glm::vec3& pos) { worldPos_ = pos; } + void setPosition(const glm::vec3& pos) { + // applyBrush already early-outs on NaN, but rejecting at the + // setter keeps the stored state itself sane — handy for UI + // panels that read the current brush position back. + if (std::isfinite(pos.x) && std::isfinite(pos.y) && std::isfinite(pos.z)) + worldPos_ = pos; + } float getInfluence(float distance) const;