diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ac99480f0..1d8b429ba 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -135,9 +135,6 @@ LLVector3 gReSitOffset; BOOL LLAgent::exlPhantom = 0; BOOL LLAgent::mForceTPose = 0; -LLVector3 LLAgent::exlStartMeasurePoint = LLVector3::zero; -LLVector3 LLAgent::exlEndMeasurePoint = LLVector3::zero; - const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index bdb616695..82513766e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -255,9 +255,6 @@ public: SHLureRequest *mPendingLure; void showLureDestination(const std::string fromname, const int global_x, const int global_y, const int x, const int y, const int z, const std::string maturity); void onFoundLureDestination(LLSimInfo *siminfo = NULL); - - static LLVector3 exlStartMeasurePoint; - static LLVector3 exlEndMeasurePoint; // private: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0135e4d1d..c359a356d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2683,44 +2683,37 @@ class LLObjectMeasure : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if(object) + static LLVector3 startMeasurePoint = LLVector3::zero; + static bool startpoint_set = false; + + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if(!object) + return false; + + LLVector3 position = object->getPositionEdit(); + + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + + if (!startpoint_set) { - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - - if (LLAgent::exlStartMeasurePoint.isExactlyZero()) - { - LLAgent::exlStartMeasurePoint = object->getPosition(); + startMeasurePoint = position; + startpoint_set = true; - chat.mText = llformat("Start point set"); - LLFloaterChat::addChat(chat); - } - else if (LLAgent::exlEndMeasurePoint.isExactlyZero()) - { - LLAgent::exlEndMeasurePoint = object->getPosition(); - - chat.mText = llformat("End point set"); - LLFloaterChat::addChat(chat); - } - else - { - LLAgent::exlStartMeasurePoint = LLVector3::zero; - LLAgent::exlEndMeasurePoint = LLVector3::zero; - return false; - } - - if (!LLAgent::exlStartMeasurePoint.isExactlyZero() && !LLAgent::exlEndMeasurePoint.isExactlyZero()) - { - F32 fdist = dist_vec(LLAgent::exlStartMeasurePoint, LLAgent::exlEndMeasurePoint); - LLAgent::exlStartMeasurePoint = LLVector3::zero; - LLAgent::exlEndMeasurePoint = LLVector3::zero; - - chat.mText = llformat("Distance: %fm", fdist); - LLFloaterChat::addChat(chat); - } + chat.mText = llformat("Start point set"); + LLFloaterChat::addChat(chat); } + else + { + chat.mText = llformat("End point set"); + LLFloaterChat::addChat(chat); + F32 fdist = dist_vec(startMeasurePoint, position); + + chat.mText = llformat("Distance: %fm", fdist); + LLFloaterChat::addChat(chat); + startpoint_set = false; + } return true; } };