Fix measurement tool

This commit is contained in:
Siana Gearz
2012-07-23 14:18:45 +02:00
parent 1ad4597d7a
commit 89be317a00
3 changed files with 27 additions and 40 deletions

View File

@@ -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;

View File

@@ -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;
// </edit>
private:

View File

@@ -2683,44 +2683,37 @@ class LLObjectMeasure : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> 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;
}
};