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;